[vtkusers] vtkImageSlice and depth peeling

David Gobbi david.gobbi at gmail.com
Wed Jan 9 12:48:40 EST 2013


Hi Guiseppe,

Do your images have an alpha component?  The difficulty is that
blending of images via the alpha component does not work when depth
peeling is enabled.  If you run ctest (e.g. ctest -R Alpha), do the
existing image rendering tests pass?

 - David


On Wed, Jan 9, 2013 at 9:20 AM, Giuseppe D'Angelo
<giuseppe.dangelo at kdab.com> wrote:
> Hello,
>
> as reported here http://www.vtk.org/Wiki/VTK/Image_Rendering_Classes , it
> seems that depth peeling can't be used when using vtkImageSlice.
>
> This matches the code in vtkImageSlice.cxx:
>
>> // Does this prop have some translucent polygonal geometry?
>> int vtkImageSlice::HasTranslucentPolygonalGeometry()
>> {
>>   // Always render during opaque pass, to keep the behavior
>>   // predictable and because depth-peeling kills alpha-blending.
>>   // In the future, the Renderer should render images in layers,
>>   // i.e. where each image will have a layer number assigned to it,
>>   // and the Renderer will do the images in their own pass.
>>   return 0;
>> }
>
>
> However very little explanation is provided about why this is impossible (or
> undesirable) to do. In other words, why doesn't that method do something
> like:
>
>   return GetProperty()->GetOpacity() != 1.0;
>
> ?
>
> HasTranslucentPolygonalGeometry is also used in the
> RenderTranslucentPolygonalGeometry method, which has a reasonable
> implementation:
>
>> int vtkImageSlice::RenderTranslucentPolygonalGeometry(vtkViewport*
>> viewport)
>> {
>>   vtkDebugMacro(<< "vtkImageSlice::RenderTranslucentPolygonalGeometry");
>>
>>   if (this->HasTranslucentPolygonalGeometry())
>>     {
>>     this->Render(vtkRenderer::SafeDownCast(viewport));
>>     return 1;
>>     }
>>
>>   return 0;
>> }
>
>
> This makes me think that I can safely override
> HasTranslucentPolygonalGeometry and perform the aforementioned check.
> Indeed, by doing so and enabling depth peeling, the results seem to be
> correct.
>
> Is there anything I should be aware of? :)
>
> Cheers,
> --
> Giuseppe D'Angelo | giuseppe.dangelo at kdab.com | Software Engineer
> KDAB (UK) Ltd., a KDAB Group company
> Tel. UK +44-1738-450410, Sweden (HQ) +46-563-540090
> KDAB - Qt Experts - Platform-independent software solutions
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers



More information about the vtkusers mailing list