[vtkusers] vtkImageActor, transparency, and depth peeling
David C Thompson
dcthomp at sandia.gov
Wed Mar 21 21:59:11 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?
I believe 4 components is assumed to be RGBA data (A=alpha transparency)
and 2 components would be greyscale data plus transparency. But if so,
the number of components mod 2 should be 0 for the test to be correct.
David
More information about the vtkusers
mailing list