[vtk-developers] VTK and transparency problems

Lisa Avila lisa.avila at kitware.com
Fri Sep 30 16:50:49 EDT 2005


Two things to consider for whoever is implementing this:

First, the vtkCuller already sort props based on some criteria - we should 
make sure these two don't work against each other. That is - if you are 
sorting front to back for some other reason and you change one of your 
actors to have non 1 opacity then some things start rendering back to front 
but the user won't know why. My recommendation would be to use the 
vtkFrustumCoverageCuller to do the sorting - turn sorting on even though it 
isn't on whenever you encounter more than one translucent prop. By default, 
sorting is off so this will work fine. If sorting is on and isn't 
back-to-front, or a different culler is in use (don't know of another one 
in existence) then there is a problem - but this is something to user 
should then be able to find since you can describe this conflict in the 
documentation for vtkCuller and vtkRenderer. I assume the sorting you need 
is back to front, which is also what volume rendering needs so this change 
would also make multiple (non-overlapping) volumes render correctly too. If 
you do this change (and what I say below), you would then be able to 
correctly render a volume inside a translucent box although why you would 
want to do that I don't know.... :-)

Second, keep in mind that UpdateGeometry renders props, not actors. So - if 
you render a prop that is actually a vtkVolume twice, it will show up twice 
since the settings of glCullFace do not matter. You'll need to determine if 
the prop is a volume and not render it in either of your two passes, but 
render it between these two passes. So you wind up with three passes - one 
for non-volumes with front faces culled, then all volumes, then again for 
all non-volumes with back faces culled. Thinking about it - I am not sure 
it is the same sorting you need for the first and last pass - right? If you 
have nested spheres, A inside of B, and B inside of C, then you want to 
draw C, B, A (any volumes) A, B, C - right? You generally need to reverse 
the order for the second geometry pass....



Lisa




At 04:21 PM 9/30/2005, Ken Martin wrote:
> > Every so often we encounter users (on vtkusers and elsewhere) who run
> > into difficulties with VTK and transparent actors.  VTK does so many
> > things out-of-the-box and does them so well that they are usually
> > quite surprised that something that *they* think ought to be a simple
> > issue does not work correctly at all.
> >
> > I am no expert but do understand that this is not a trivial thing to
> > solve especially when performance is concerned.  However, this issue
> > comes up very often and the requirement is not entirely unreasonable
> > either.
> >
> > I noticed that Clinton Stimpson had this response:
> >
> >  http://public.kitware.com/pipermail/vtkusers/2005-January/077971.html
> >
> > It appears from his comments that this approach works 90% (?) of the
> > time.  So would it be possible to make this the default behavior as
> > part of VTK?  Or is there a better way than this?  Comments?
>
>The approach he describes would certainly improve the quality of transparent
>renderings at a cost of rendering the transparent actors twice. His approach
>is a very good compromise between performance and correct renderings.
>Someone should add this to VTK in my opinion.
>
>Thanks
>Ken
>
>
>
>_______________________________________________
>vtk-developers mailing list
>vtk-developers at vtk.org
>http://www.vtk.org/mailman/listinfo/vtk-developers





More information about the vtk-developers mailing list