[vtkusers] vtkImageActor, transparency, and depth peeling

David Feng dfeng at cs.unc.edu
Thu Mar 22 15:26:51 EDT 2007


Makes sense.  It seems then that I have a problem with my vtkImageActor, 
as it really ought to have only one scalar component.  When I step 
through the renderer it apparently ends up having 4 components, even 
though it was initialized with a single-component vtkImageData. 

David

David C Thompson wrote:
>> 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