<table cellspacing='0' cellpadding='0' border='0' ><tr><td valign='top' style='font: inherit;'>I'm able to use vtkDepthSortPolyData to render a single translucent sphere correctly. but in the following code where I try to render two translucent sphere, their rendering order is incorrect.  Grey sphere always appear in front of red sphere even when it is actually behind of red sphere. Is there a way to sort actors along view direction or some other way to get around this problem? <br><br>Thank you very much!<br><br>Tracy<br><br><br>#include "vtkSphereSource.h"<br>#include "vtkPolyDataMapper.h"<br>#include "vtkActor.h"<br>#include "vtkRenderer.h"<br>#include "vtkRenderWindow.h"<br>#include "vtkRenderWindowInteractor.h"<br>#include "vtkProperty.h"<br>#include "vtkCamera.h"<br>#include "vtkLight.h"<br>#include "vtkLightCollection.h"<br>#include "vtkAppendPolyData.h"<br>#include "vtkDepthSortPolyData.h"<br>#include "vtkCamera.h"<br>#include
 "vtkInteractorStyleTrackballCamera.h"<br>#include "vtkPoints.h"<br>#include "vtkFloatArray.h"<br>#include "vtkCellArray.h"<br>#include "vtkCellData.h"<br>#include "vtkLookupTable.h"<br>#include "vtkPolyDataToPolyDataFilter.h"<br>#include "vtkAppendPolyData.h"<br>#include "vtkAssembly.h"<br>#include "vtkSphereSource.h"<br><br>int main()<br>{<br>vtkSphereSource *sphere = vtkSphereSource::New();<br>vtkDepthSortPolyData *depthSort = vtkDepthSortPolyData::New();<br>&nbsp;&nbsp;&nbsp; depthSort-&gt;SetInputConnection(sphere-&gt;GetOutputPort());<br>&nbsp;&nbsp;&nbsp; depthSort-&gt;SortScalarsOff();<br><br>vtkPolyDataMapper *mapper = vtkPolyDataMapper::New();<br>&nbsp;&nbsp;&nbsp; mapper-&gt;SetInputConnection(depthSort-&gt;GetOutputPort());<br><br>vtkActor *actor = vtkActor::New();<br>&nbsp;&nbsp;&nbsp; actor-&gt;SetMapper(mapper);<br>&nbsp;&nbsp;&nbsp; actor-&gt;GetProperty()-&gt;SetOpacity(0.9);<br>&nbsp;&nbsp;&nbsp;
 actor-&gt;RotateX(-32);<br><br>depthSort-&gt;SetProp3D(actor);<br><br>vtkRenderer *ren = vtkRenderer::New();<br>depthSort-&gt;SetCamera(ren-&gt;GetActiveCamera());<br><br>//*************************<br>vtkSphereSource *sphere2 = vtkSphereSource::New();<br><br>vtkDepthSortPolyData *depthSort2 = vtkDepthSortPolyData::New();<br>&nbsp;&nbsp;&nbsp; depthSort2-&gt;SetInputConnection(sphere2-&gt;GetOutputPort());<br>&nbsp;&nbsp;&nbsp; depthSort2-&gt;SortScalarsOff();<br><br>vtkPolyDataMapper *mapper2 = vtkPolyDataMapper::New();<br>&nbsp;&nbsp;&nbsp; mapper2-&gt;SetInputConnection(depthSort2-&gt;GetOutputPort());<br><br>vtkActor *actor2 = vtkActor::New();<br>&nbsp;&nbsp;&nbsp; actor2-&gt;SetMapper(mapper2);<br>&nbsp;&nbsp;&nbsp; actor2-&gt;GetProperty()-&gt;SetOpacity(0.9);<br>&nbsp;&nbsp;&nbsp; actor2-&gt;GetProperty()-&gt;SetColor(1, 0, 0);<br>&nbsp;&nbsp;&nbsp; actor2-&gt;SetPosition(1.5, 0.0,0.0);<br>&nbsp;&nbsp;&nbsp;
 actor2-&gt;RotateX(-32);<br><br>depthSort2-&gt;SetProp3D(actor2);<br><br>depthSort2-&gt;SetCamera(ren-&gt;GetActiveCamera());<br>//**************************<br><br>vtkRenderWindow *renWin = vtkRenderWindow::New();<br>&nbsp;&nbsp;&nbsp; renWin-&gt;AddRenderer(ren);<br>vtkRenderWindowInteractor *iren = vtkRenderWindowInteractor::New();<br>&nbsp;&nbsp;&nbsp; iren-&gt;SetRenderWindow(renWin);<br>vtkInteractorStyleTrackballCamera *style = vtkInteractorStyleTrackballCamera::New();<br>&nbsp;&nbsp;&nbsp; iren-&gt;SetInteractorStyle(style);<br><br>ren-&gt;AddActor(actor2);<br>ren-&gt;AddActor(actor);<br>ren-&gt;SetBackground(1, 1, 1);<br>renWin-&gt;SetSize(600, 600);<br><br>ren-&gt;ResetCamera();<br>renWin-&gt;Render();<br>iren-&gt;Initialize();<br>iren-&gt;Start();<br>return 0;<br><br>}<br><br><br><br></td></tr></table><br>