[vtkusers] Volume Rendering

Lisa Sobierajski Avila lisa.avila at kitware.com
Wed Jun 14 17:19:54 EDT 2000


Hello Asad,

I think you are doing something a bit too simple here. At least part of the 
problem is that you have data of constant value and you are computing 
gradients. The very first gradient will be high (because by default values 
outside the volume are assumed to be 0) but the next one will have zero 
magnitude (and hence no shading). Then you are using ray casting, which is 
a sampling technique. So you have very high frequency data (only the very 
first sample has a high gradient, the others have none) which you are 
sampling inadequately - hence the banding.

Try turning shading off and you should see a solid block.

Lisa


At 04:42 PM 6/14/00, Asad A. Abu-Tarif wrote:
>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/c2818a65/attachment.html>


More information about the vtkusers mailing list