[vtkusers] Volume Rendering
Asad A. Abu-Tarif
tarifa at rpi.edu
Wed Jun 14 16:42:13 EDT 2000
Hi vtk users,
I've been trying to render a vtkStructuredPoints data. The scalars in that data set have a constant value of 100 (just for testing). When I render the data set, I get interlaced black and white planes. The code I'm using to render the data is attached. Can anyone tell me what I'm doing wrong.
I'm using the latest official release of VTK (3.12) with VC++ version 6.0.
**If it is related:
The data dimensions (100X100X100).
My VGA card is Elsa Gloria II Pro with 64MB.
I'm using Windows NT on a Dell workstation with 733Mhz processor and 512 MB RDRAM.
Thanks,
Asad
{Here is where I create the structured data set and fill it with the constant 100.}
vtkPiecewiseFunction *oTFun = vtkPiecewiseFunction::New();
// Get Opacity segments and add them.
oTFun->AddSegment(0,1.0,255,1.0);
// Create a transfer function mapping scalar value to color (grey)
vtkPiecewiseFunction *cTFun = vtkPiecewiseFunction::New();
// Get Color segments and add them.
cTFun->AddSegment(0, 0.0, 255, 1.0);
// Create a property for the volume and set the transfer functions.
vtkVolumeProperty *volumeProperty = vtkVolumeProperty::New();
volumeProperty->SetColor(cTFun);
volumeProperty->SetScalarOpacity(oTFun);
volumeProperty->SetInterpolationTypeToLinear();
volumeProperty->ShadeOn();
// Create a ray function - this is a compositing ray function
vtkVolumeRayCastCompositeFunction *compositeFunction =
vtkVolumeRayCastCompositeFunction::New();
// Create the volume mapper and set the ray function and scalar input
vtkVolumeRayCastMapper *volumeMapper = vtkVolumeRayCastMapper::New();
volumeMapper->SetInput(StructuredPoints); // StructuredPoints is my test vtkStructuredPoints data set.
volumeMapper->SetVolumeRayCastFunction(compositeFunction);
// Create the volume and set the mapper and property
vtkVolume *volume = vtkVolume::New();
volume->SetMapper(volumeMapper);
volume->SetProperty(volumeProperty);
// Add this volume to the renderer and get a closer look
renderer->AddVolume(volume);
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20000614/72c5b719/attachment.html>
More information about the vtkusers
mailing list