[vtkusers] vtkImageActor, transparency, and depth peeling

David Feng dfeng at cs.unc.edu
Wed Mar 21 21:04:08 EDT 2007


I had some transparency issues when using a vtkImageActor (generated by 
vtkImageViewer2) and depth peeling at the same time.  Some digging 
revealed that my vtkImageActor was not getting rendered into the initial 
opaque layer, but rather somewhere in the transparent layers.  The 
offending line of code is tagged below:

int vtkImageActor::RenderTranslucentPolygonalGeometry(vtkViewport* 
viewport)
{
...
   if (!(this->Opacity >= 1.0) && input->GetNumberOfScalarComponents() % 
2)) ********
     {
     this->Render(vtkRenderer::SafeDownCast(viewport));
     return 1;
     }
...  return 0;
}


The tagged line appears multiple times throughout the file.  When I 
comment out all portions related to scalar components and rely strictly 
on opacity values, depth peeling works wonderfully. What does the number 
of scalar components of the input vtkImageData have to do with 
transparency?

Thanks,
David





More information about the vtkusers mailing list