It looks to me like you are setting all values from 0 to 255 to be opaque.&nbsp; This means that you will see a solid cube that is however big your dataset is.&nbsp; You need to make at least the 0's surrounding your spheres transparent so you can see the spheres inside.&nbsp; I believe that would be something like:<br><br>AddSegment 0 0.0 255 1.0<br><br>If you used this for your color it would also give you something besides solid black.<br><br><b><i>Jian Wu &lt;eewujian@gmail.com&gt;</i></b> wrote:<blockquote class="replbq" style="border-left: 2px solid rgb(16, 16, 255); margin-left: 5px; padding-left: 5px;"> Hi, everyone,<br>I'm a new VTK user. I was failed to produced the similar results for a sample code I came upon with in the book "The VTK User's Guide (VTK4.4)". Page 122. Here is the code that I used. I made a few modification 'cause it is incomplete and has a few obvious errors for the original one. It is supposed to display two similar spheres. But I found the one
 given by ray-casting was incorrect. It displayed as a dark cube. Is there anyone know the reason? Thanks! <br><br>Jian Wu<br><br>######################################################################<br>package require vtk<br>package require vtkinteraction<br><br># Create the standard renderer, render window<br># and interactor <br>vtkRenderer ren1<br>vtkRenderWindow renWin<br>&nbsp;&nbsp;&nbsp; renWin AddRenderer ren1<br>vtkRenderWindowInteractor iren<br>&nbsp;&nbsp;&nbsp; iren SetRenderWindow renWin<br><br># Create a geometric sphere<br>vtkSphereSource sphere<br>&nbsp;&nbsp;&nbsp; sphere SetRadius 20 <br>&nbsp;&nbsp;&nbsp; sphere SetCenter 70 25 25<br>&nbsp;&nbsp;&nbsp; sphere SetThetaResolution 50<br>&nbsp;&nbsp;&nbsp; sphere SetPhiResolution 50<br><br>vtkPolyDataMapper mapper<br>&nbsp;&nbsp;&nbsp; mapper SetInput [sphere GetOutput]<br><br>vtkActor actor<br>&nbsp;&nbsp;&nbsp; actor SetMapper mapper <br>&nbsp;&nbsp;&nbsp; [actor GetProperty] SetColor 1 1
 1<br>&nbsp;&nbsp;&nbsp; [actor GetProperty] SetAmbient 0.01<br>&nbsp;&nbsp;&nbsp; [actor GetProperty] SetDiffuse 0.7<br>&nbsp;&nbsp;&nbsp; [actor GetProperty] SetSpecular 0.5<br>&nbsp;&nbsp;&nbsp; [actor GetProperty] SetSpecularPower 70.0<br> <br># Read in a volumetric sphere<br>vtkSLCReader reader<br>&nbsp;&nbsp;&nbsp; reader SetFileName "$VTK_DATA_ROOT/Data/sphere.slc"<br><br># Use this tfun for both opacity and color<br>vtkPiecewiseFunction tfun<br>&nbsp;&nbsp;&nbsp; tfun AddSegment 0  1.0 255 1.0<br><br># Make the volume property match the geometric one<br>vtkVolumeProperty volumeProperty<br>&nbsp;&nbsp;&nbsp; volumeProperty SetColor tfun<br>&nbsp;&nbsp;&nbsp; volumeProperty SetScalarOpacity tfun<br>&nbsp;&nbsp;&nbsp; volumeProperty ShadeOn<br>&nbsp;&nbsp;&nbsp; volumeProperty SetInterpolationTypeToLinear <br>&nbsp;&nbsp;&nbsp; volumeProperty SetDiffuse 0.7<br>&nbsp;&nbsp;&nbsp; volumeProperty SetAmbient 0.01<br>&nbsp;&nbsp;&nbsp; volumeProperty SetSpecular
 0.5<br>&nbsp;&nbsp;&nbsp; volumeProperty SetSpecularPower 70.0<br><br>vtkVolumeRayCastCompositeFunction&nbsp; compositeFunction<br> vtkVolumeRayCastMapper volumeMapper<br>&nbsp;&nbsp;&nbsp; volumeMapper SetInputConnection [reader GetOutputPort]<br>&nbsp;&nbsp;&nbsp; volumeMapper SetVolumeRayCastFunction compositeFunction<br><br>vtkVolume volume<br>&nbsp;&nbsp;&nbsp; volume SetMapper volumeMapper <br>&nbsp;&nbsp;&nbsp; volume SetProperty volumeProperty<br><br># Add both the geometric and volumetric spheres to the renderer<br>ren1 AddViewProp volume<br>ren1 AddViewProp actor<br><br># Create a red, green, and blue light<br>vtkLight redlight <br>&nbsp;&nbsp;&nbsp; redlight SetColor 1 0 0<br>&nbsp;&nbsp;&nbsp; redlight SetPosition 1000 25 25<br>&nbsp;&nbsp;&nbsp; redlight SetFocalPoint 25 25 25<br>&nbsp;&nbsp;&nbsp; redlight SetIntensity 0.5<br><br>vtkLight greenlight<br>&nbsp;&nbsp;&nbsp; greenlight SetColor 0 1 0<br>&nbsp;&nbsp;&nbsp; greenlight SetPosition 25 1000 25
 <br>&nbsp;&nbsp;&nbsp; greenlight SetFocalPoint 25 25 25<br>&nbsp;&nbsp;&nbsp; greenlight SetIntensity 0.5<br><br>vtkLight bluelight<br>&nbsp;&nbsp;&nbsp; bluelight SetColor 0 0 1<br>&nbsp;&nbsp;&nbsp; bluelight SetPosition 25 25 1000<br>&nbsp;&nbsp;&nbsp; bluelight SetFocalPoint 25 25 25<br>&nbsp;&nbsp;&nbsp; bluelight SetIntensity  0.5<br><br># Add the light to the renderer<br>ren1 AddLight redlight<br>ren1 AddLight greenlight<br>ren1 AddLight bluelight<br>ren1 SetBackground 0.1 0.1 0.2<br><br># Render it!<br>renWin Render<br><br>proc TkCheckAbort {} { <br>&nbsp; set foo [renWin GetEventPending]<br>&nbsp; if {$foo != 0} {renWin SetAbortRender 1}<br>}<br>renWin AddObserver AbortCheckEvent {TkCheckAbort}<br><br>iren AddObserver UserEvent {wm deiconify .vtkInteract}<br>iren Initialize <br><br>wm withdraw .<br><br>######################################################################<br> _______________________________________________<br>This is the private VTK discussion
 list. <br>Please keep messages on-topic. Check the FAQ at: http://www.vtk.org/Wiki/VTK_FAQ<br>Follow this link to subscribe/unsubscribe:<br>http://www.vtk.org/mailman/listinfo/vtkusers<br></blockquote><br>