[vtkusers] Bug in depth ordering whilst rendering

David Thompson dcthomp at sandia.gov
Wed Nov 28 03:49:14 EST 2007


> Do any developers hang out here?
Yes.

> I appreciate that having no reply to a question (in what is arguably a
> short time so far), can indicate many things..
>
> * Question asked in wrong place
> * Question missing information
> * Question containing too much information
>
> If anyone is familiar with the rendering code, perhaps they will be  
> able
> to point me in the right direction.
Depth peeling does not appear to be in VTK 5.0.x. It is present in the  
CVS trunk. See http://www.vtk.org/Wiki/VTK/Depth_Peeling for some  
information on how to use it (note the list of GL extensions you need  
in order for it to work). Shy of depth peeling,

> I doubt this is a VTK bug in the strictest sense (as MESA software
> rendering seemed to "fix" it), but without knowing what underlying  
> cause
> is, or having a simple gl / glut test case, reporting a MESA bug isn't
> yet going to get much attention either.
It is not a bug. Without depth peeling, geometry primitives must be  
depth-sorted each time the camera changes. This is not a trivial  
amount of work for large datasets and many people don't have  
transparent geometry to render, so depth sorting is something you must  
set up in your pipeline if you want it to be done (see  
vtkDepthSortPolyData). Without depth sorting, you will see some  
triangles blended into the color buffer in the wrong order. Without a  
screen capture or more details, I would guess that is what you are  
reporting.

> ...
>> I'm visualising some wave data with VTK 5.0.3, and have encountered  
>> some
>> strange issues with rendering.
>>
>> When rotating views in some cases, some objects / surfaces always  
>> draw
>> on top of others, despite them being at the back of the Z-Order for  
>> the
>> scene.
>>
>> Searching for a simple test case, I find that the "three planes" in  
>> the
>> example: Examples/VisualizationAlgorithms/Python/TextureThreshold.py
>> exhibits the symptom. I've been using Mayavi2, and the coordinate  
>> arrows
>> you can add into the view also exhibit the bug, at certain angles
>> objects at the back are drawn on top of closer objects.
>>
>> In the TextureThreshold.py example, it seemed that changing the
>>
>> The rendering
>> "SetOpacity(0.999)" calls to some other value, e.g. 1.5 would stop  
>> the
>> bug manifesting.
Any value above 1.0 gets clamped to 1.0 (fully opaque) and would thus  
not present a problem. It does appear that this example has some  
problems. Adding this line:
   ren.UseDepthPeelingOn()
just after all of the "ren.AddActor(...)" lines fixed things for me  
(on the VTK trunk, not in 5.0.3). Because the example has 3 separate  
translucent datasets, you cannot use vtkDepthSortPolyData directly.  
Instead you would first have to convert each dataset to polydata (done  
currently by the vtkDataSetMapper) and then append the 3 polydata  
objects into a single polydata. At that point, you could pass the  
result to a vtkDepthSortPolyData and then into a mapper.

	David




More information about the vtkusers mailing list