[vtkusers] Strange Visualization Results With Transparency on Polydata

Ken Martin ken.martin at kitware.com
Tue Dec 4 16:24:05 EST 2018


In newer versions of VTK (8.2 maybe) this issue should not be as noticeable
as we changed how we handle transparent rendering to yield better (but
still not perfect) results.

On Tue, Dec 4, 2018 at 4:00 PM David Gobbi <david.gobbi at gmail.com> wrote:

> What Eric says is true, depth peeling or Z-sorting is needed for
> transparent polydata.
>
> Here's a long-ish explanation of why the red sphere is rendering wrong:
> since the mapper uses a lookup table that contains alpha values below 1.0,
> VTK decides to use the translucent rendering pass instead of the opaque
> rendering pass.  In the translucent rendering pass, VTK doesn't write to
> the z-buffer, so unless depth peeling is enabled (or polys are pre-sorted
> back-to-front) you'll end up with bad results.
>
>   David
>
> On Tue, Dec 4, 2018 at 1:47 PM Fahlgren, Eric <
> eric.fahlgren at smith-nephew.com> wrote:
>
>> Hi Andrea,
>>
>>
>>
>> Z-sorting of transparent polygons is always a problem.  You can cure it
>> by turning on depth peeling, but it comes at a cost (for our models it
>> makes renders take almost twice as long).
>>
>>
>>
>> # create a rendering window and renderer
>>
>> ren = vtk.vtkRenderer()
>>
>> *ren.SetUseDepthPeeling(True)*
>>
>>
>>
>> Eric
>>
>>
>>
>> *From:* vtkusers <vtkusers-bounces at public.kitware.com> * On Behalf Of *
>> aborsic at ne-scientific.com
>> *Sent:* Tuesday, December 4, 2018 11:20 AM
>> *To:* vtkusers at public.kitware.com
>> *Subject:* [vtkusers] Strange Visualization Results With Transparency on
>> Polydata
>>
>>
>>
>> Dear All,
>>
>>
>>
>> I am experiencing some strange visualization results in VTK 8.1.0 on
>> polydata using a LUT with some transparency for some entries and opacity
>> for others.
>>
>>
>>
>> I am attaching a Python example to reproduce the problem. The code
>> creates two polydata spheres which are spatially separated. An array with a
>> uniform values of 1 is associated to cell data for the first sphere, and an
>> array with values of 2 to the second sphere. The two spheres are appended
>> together for convenience with a polydata append filter.
>>
>>
>>
>> A LUT is created with two entries, solid red RGBA = (1,0,0,1) and
>> transparent green RGBA = (0,1,0,0.2), the scalar range is set to (1,2)
>> mapping the cells of the first sphere to the first LUT entry and the cells
>> of the second sphere to the second LUT entry.
>>
>>
>>
>> As shown by the attached rendering the red sphere also appears as
>> semi-transparent, and in a wired way, if rotated some portions of the
>> sphere seem more transparent, and others less. Setting the second LUT entry
>> to solid green RGBA = (0,1,0,1) makes both spheres opaque – this is
>> expected, but why does modifying the alpha channel of the second LUT entry
>> affects also the appearance of the first sphere?
>>
>>
>>
>> I am experiencing this on two different Windows 10 computers equipped
>> with modern NVIDIA GPUs, and on a 2017 iMac 27 running Mojave, all these
>> computers have VTK 8.1.0.
>>
>>
>>
>> Any comment / advice is welcome,
>>
>>
>>
>> Thanks, Best Regards,
>>
>>
>>
>> Andrea
>>
> _______________________________________________
> 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
>
> Search the list archives at: http://markmail.org/search/?q=vtkusers
>
> Follow this link to subscribe/unsubscribe:
> https://public.kitware.com/mailman/listinfo/vtkusers
>


-- 
Ken Martin PhD
Distinguished Engineer
Kitware Inc.
101 East Weaver Street
Carrboro, North Carolina
27510 USA

This communication, including all attachments, contains confidential and
legally privileged information, and it is intended only for the use of the
addressee.  Access to this email by anyone else is unauthorized. If you are
not the intended recipient, any disclosure, copying, distribution or any
action taken in reliance on it is prohibited and may be unlawful. If you
received this communication in error please notify us immediately and
destroy the original message.  Thank you.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://public.kitware.com/pipermail/vtkusers/attachments/20181204/8156815e/attachment.html>


More information about the vtkusers mailing list