[vtkusers] using vtkVolumeRayCastMapper to render vtkSampleFunction

Wolfram H Volpi whv88240 at Bayou.UH.EDU
Thu Jan 11 20:29:53 EST 2001


Hi, everybody!
I'm trying to rayCast-render a volume generated by vtkSampleFunction.
It doesn't work because,

vtkVolumeRayCastMapper (0x80c9ef8): The scalar data type: 10 is not
supported when volume rendering. Please convert the  data to unsigned
char or unsigned short.

How do I do that?

The problem code is listed below.  It makes my PC go into virtual
memeory.  My PC has 250 MB of RAM.

Thank you,
Woflv. 
-------------------------------------------------------------------------------
source $VTK_TCL/vtkInt.tcl

# goes into virtual memeory!
vtkSphere sphere
    sphere SetRadius 1

vtkSampleFunction sample
    sample SetImplicitFunction sphere

vtkVolumeProperty volumeProperty
    volumeProperty SetInterpolationTypeToNearest

vtkVolumeRayCastMIPFunction  MIPFunction

vtkVolumeRayCastMapper volumeMapper
    volumeMapper SetInput [sample GetOutput]
    volumeMapper SetVolumeRayCastFunction MIPFunction
    volumeMapper SetSampleDistance 0.25

vtkVolume volume
    volume SetMapper volumeMapper
    volume SetProperty volumeProperty

# graphics stuff
vtkRenderer ren1
    ren1 SetBackground 0.1 0.2 0.4
vtkRenderWindow renWin
    renWin AddRenderer ren1
    renWin SetSize 256 256
vtkRenderWindowInteractor iren
    iren SetRenderWindow renWin

ren1 SetBackground 0 0 0 

ren1 AddVolume volume
renWin SetSize 200 200
renWin Render

iren SetUserMethod {wm deiconify .vtkInteract}
iren SetDesiredUpdateRate 1
iren Initialize

wm withdraw .





More information about the vtkusers mailing list