[vtkusers] vtkUnstructuredGridVolumeRayCastMapper
Paul McGuinness
mcguinpg at maths.tcd.ie
Wed May 12 09:10:37 EDT 2004
Hi vtk users,
I hope that someone will be able to help me. This is my problem:
I create a vtkUnstructuredGrid and create cells inside this grid by doing
the following:
ugrid->Allocate(num_of_vertices_per_facet, num_of_vertices_per_facet);
ugrid->Initialize();
for (i=0; i<number_of_facets; i++)
ugrid->InsertNextCell(VTK_TRIANGLE, num_of_vertices_per_facet,
facet_vertices[i]);
ugrid->SetPoints(points); //coordinates of vertices
points->Delete();
ugrid->GetPointData()->SetScalars(scalars); //scalar values at vertices
scalars->Delete();
OK so that is pretty basic stuff.
But here is the problem I want to create a volume rendering of this grid.
So I just do the following:
vtkPiecewiseFunction *opacityTransferFunction2 = vtkPiecewiseFunction::New();
opacityTransferFunction2->AddPoint(0.0, 0.1);
opacityTransferFunction2->AddPoint(5.0, 0.3);
opacityTransferFunction2->AddPoint(10, 0.6);
vtkColorTransferFunction *colorTransferFunction2 = vtkColorTransferFunction::New();
colorTransferFunction2->AddRGBPoint( 0.0, 0.0, 0.0, 0.0);
colorTransferFunction2->AddRGBPoint( 5, 1.0, 1.0, 1.0);
colorTransferFunction2->AddRGBPoint( 10, 1, 1, 1);
vtkVolumeProperty *volumeProperty2 = vtkVolumeProperty::New();
volumeProperty2->SetColor(colorTransferFunction2);
volumeProperty2->SetScalarOpacity(opacityTransferFunction2);
volumeProperty2->SetInterpolationTypeToLinear();
vtkUnstructuredGridVolumeRayCastMapper *volumeMapper2 = vtkUnstructuredGridVolumeRayCastMapper::New();
volumeMapper2->SetInput(ugrid);
etc......
When I run my program I get no image, I also get the following warning
message:
Warning: In /cphys/pgrad/mcguinpg/vtk/VTK/Rendering/vtkUnstructuredGridBunykRayCastFunction.cxx, line 583
vtkUnstructuredGridBunykRayCastFunction (0x84cdfb0): Input contains more than tetrahedra - only tetrahedra are supported
Does anyone know what is going on here, I am lost on this one?
Thank you,
Paul.
More information about the vtkusers
mailing list