[vtkusers] vtkImageSlice and depth peeling

David Gobbi david.gobbi at gmail.com
Thu Jan 10 10:16:28 EST 2013


On Thu, Jan 10, 2013 at 7:55 AM, Giuseppe D'Angelo
<giuseppe.dangelo at kdab.com> wrote:
> Il 10/01/2013 10:44, Giuseppe D'Angelo ha scritto:
>
>> Il 09/01/2013 18:48, David Gobbi ha scritto:
>>>
>>> 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.
>
>
> Hi David,
>
> just did a couple of tests -- yes, indeed the approach of making
> HasTranslucentPolygonalGeometry return true of false depending on the
> image's opacity doesn't work if the image itself is transparent.
>
> In such cases, we should return true, but of course figuring that out could
> be expensive (we need to iterate on all the image's data, possibly do a
> lookup through a table, etc...). Sounds like a job VTK should do for the
> users, maybe controlled by a flag (SetCheckIfImageIsTransparent or something
> like that).
>
> Or, we might be a bit pessimistic and return true unconditionally if there's
> the possibility of transparent content (again, controlled by a flag).
>
> Either way, if HasTranslucentPolygonalGeometry returns true, then I seem to
> get correct blending results even from translucent images, with or without
> setting an opacity on the vtkImageSlice.

I prefer having flags so that the user can control the behaviour.
Adding code to make VTK accurately auto-detect whether image data
might be translucent would be tricky, expensive, and would require
several tests.  Also, VTK is dynamic... a few pixels might change from
opaque to translucent after a pipeline update.  If small changes to
the data can cause the mapper to switch from one render pass to
another, the result could be minor glitches in the rendering that
would be very difficult to track down.

The crucial thing is how the programmer intends the image to be
rendered.  Flags are good for that.

 - David



More information about the vtkusers mailing list