[vtkusers] Volume rendering
Lisa Sobierajski Avila
lisa.avila at kitware.com
Thu Sep 27 22:57:45 EDT 2001
Hello Natraj,
Having binary data may be the problem. A central difference technique is
used to generate normals - and with only 0's and 1's there are a very
limited number of possible normals. Perhaps the "bad" lighting is caused by
this.
Lisa
At 02:59 PM 9/27/2001, Natraj Iyer wrote:
>Hi,
>
>I am having problems in volume rendering a voxelized object. The
>lighting seems to be really bad. I tried adding lights but it does not
>help.. Does anyone have any suggestions on how to rectify this.. When I
>generate the isosurface using vtkContourFilter it works fine..
>
>My voxel.vtk file just contains 1's and 0's.
>
>I have to use vtkImageCast because VTK gives me an error saying Data
>Type 2 is unsupported.
>
>Thanks
>
>Natraj
>
>My tcl script is as follows:
>
>vtkDataSetReader areader
> areader SetFileName voxel.vtk
>
>vtkImageCast reader
>reader SetOutputScalarTypeToUnsignedShort
>reader SetInput [areader GetOutput]
>
># Create transfer functions for opacity and color
>vtkPiecewiseFunction opacityTransferFunction
> opacityTransferFunction AddPoint 0 0.0
> opacityTransferFunction AddPoint 1 1.0
>
>vtkColorTransferFunction colorTransferFunction
> colorTransferFunction AddRGBPoint 0.0 1.0 0.0 0.0
> colorTransferFunction AddRGBPoint 1.0 0.0 0.0 0.3
>
># Create properties, mappers, volume actors, and ray cast function
>vtkVolumeProperty volumeProperty
> volumeProperty SetColor colorTransferFunction
> volumeProperty SetScalarOpacity opacityTransferFunction
> volumeProperty ShadeOn
> volumeProperty SetDiffuse 1.0
> volumeProperty SetAmbient 0.3
> volumeProperty SetSpecular 1.0
> volumeProperty SetSpecularPower 100.0
>
>vtkVolumeRayCastCompositeFunction compositeFunction
>
>vtkVolumeRayCastMapper volumeMapper
> volumeMapper SetInput [reader GetOutput]
> volumeMapper SetVolumeRayCastFunction compositeFunction
>
>vtkVolume volume
> volume SetMapper volumeMapper
> volume SetProperty volumeProperty
>
>vtkLight light1
>light1 SetPositional 1
>light1 SetPosition 15.0 15.0 15.0
>
>vtkLight light2
>light2 SetPositional 1
>light2 SetPosition -5.0 -5.0 -5.0
>
>vtkRenderer ren1
>vtkRenderWindow renWin
> renWin AddRenderer ren1
> renWin SetSize 300 300
>vtkRenderWindowInteractor iren
> iren SetRenderWindow renWin
> iren LightFollowCameraOn
>
>ren1 AddVolume volume
>ren1 SetBackground 1.0 1.0 0.9
>ren1 AddLight light1
>ren1 AddLight light2
>
>renWin Render
>
>
>_______________________________________________
>This is the private VTK discussion list.
>Please keep messages on-topic. Check the FAQ at:
><http://public.kitware.com/cgi-bin/vtkfaq>
>Follow this link to subscribe/unsubscribe:
>http://public.kitware.com/mailman/listinfo/vtkusers
More information about the vtkusers
mailing list