[vtkusers] Re: Re:Strange Artefacts with Surface Rendering

Amy Squillacote amy.squillacote at kitware.com
Thu Sep 22 09:30:53 EDT 2005


Hi Tobias,

Actually it is expected that it would change with 
orientation.  In order for transparency to look 
right, the triangles making up your data set need 
to be rendered in back-to-front order; rendering 
in this order keeps things that are in front 
actually looking like they are in front and not 
being rendered behind something else.  There are 
a couple things in VTK you can try to help the 
transparent rendering look better: the 
vtkDepthSortPolyData filter 
(http://www.vtk.org/doc/nightly/html/classvtkDepthSortPolyData.html) 
or use the vtkFrustumCoverageCuller 
(http://www.vtk.org/doc/nightly/html/classvtkFrustumCoverageCuller.html) 
in the renderer -- call the SetSortingStyleToBackToFront method on the culler.

The use of vtkDepthSortPolyData is demonstrated 
in the following VTK example script (written in 
Tcl): VTK/Examples/VisualizationAlgorithms/Tcl/DepthSort.tcl.

To use the culler, you would do something like the following (in C++).

vtkRenderer *ren = vtkRenderer::New();
vtkCullerCollection *cullers = ren->GetCullers();
cullers->InitTraversal();
vtkFrustumCoverageCuller *culler = 
vtkFrustumCoverageCuller::SafeDownCast(cullers->GetNextItem());
culler->SetSortingStyleToBackToFront();


- Amy

At 09:02 AM 9/22/2005, Tobias Mönch wrote:
>Hi Jim,
>
>You are right, the inside-out-look comes from the "inside-surface" which is
>becomes visible when the front-surface gets transparent. But it's strange that
>this happens depending on the orientation. At 
>first everything is drawn right. I
>can turn everything without problems, but at a special angle of rotation the
>surfaces seem to be rendered in a wrong direction. I watched it very carefully
>and noticed that the front-surface suddenly 
>seems to get pushed behind the other
>surfaces (which became visible due to transparency-changes) and the surface
>which would be behind the front surface (= the inside of the opposite side of
>the brain) gets drawn as if it was in front (where it isn't).
>
>Tobias
>
>
>
>----- Original Message -----
>From: "James Carroll" <mrmaple at gmail.com>
>To: "Tobias Mönch" <Tobias.Moench at Student.Uni-Magdeburg.DE>
>Cc: <vtkusers at vtk.org>
>Sent: Thursday, September 22, 2005 2:46 PM
>Subject: Re: [vtkusers] Strange Artefacts with Surface Rendering
>
>
>Hi Tobias,
>
>This is a common 3D rendering issue.  When the surfaces are opaque,
>the surfacae has a  position in the Z buffer, and if the closest face
>gets drawn first, then because of the Z buffer (also called the depth
>test.) things that are behind the surface aren't drawn at all.  As
>soon as you have some transparency, all of the surfaces have to be
>drawn, so the depth test is turned off.  Things that are behind are
>blended equally with things that are in front.
>
>I think this would cause the inside-out look of your brain surface.
>
>This wouldn't cause the parts of the surface disappearing though...  hmm...
>
>-Jim
>
>
>On 9/22/05, Tobias Mönch <Tobias.Moench at student.uni-magdeburg.de> wrote:
> > Hi vtk'ers!
> >
> > I've again some problems. I'm doing a simple 
> SurfaceRendering of a brain using
>a
> > vtkPolyDataMapper (and some smoothing 
> before). When I use no transparency then
> > everything is fine.
> > But if I set the opacity of the surface-actor to some value below 1.0 the
> > following happens:
> > The surface seems to turn its inside out when I rotate it in some direction
> > (sometimes it looks like this). It also seems 
> that some parts of the surface
> > disappear when rotating (as it was clipped). It's no problem to rotate the
> > brain-surface back and then everything is 
> completely closed as it should. But
>in
> > some special positions the described things happen.
> >
> > Does anyone had the same problems or an idea what the problem could be?
> >
> > I attached a screenshot where i marked where 
> the surface already disappeared.
> >
> >
> > Thank you,
> > Tobias
> >
> > _______________________________________________
> > This is the private VTK discussion list.
> > Please keep messages on-topic. Check the FAQ at:
>http://www.vtk.org/Wiki/VTK_FAQ
> > Follow this link to subscribe/unsubscribe:
> > http://www.vtk.org/mailman/listinfo/vtkusers
> >
> >
> >
> >
>
>_______________________________________________
>This is the private VTK discussion list.
>Please keep messages on-topic. Check the FAQ at: 
>http://www.vtk.org/Wiki/VTK_FAQ
>Follow this link to subscribe/unsubscribe:
>http://www.vtk.org/mailman/listinfo/vtkusers




More information about the vtkusers mailing list