<div dir="ltr">The coincident topology support in vtkMapper can be used for this. It allows you to specify on a per mapper basis adjustments to the depth of objects.<br></div><br><div class="gmail_quote"><div dir="ltr">On Tue, Dec 4, 2018 at 5:01 PM Fahlgren, Eric <<a href="mailto:eric.fahlgren@smith-nephew.com">eric.fahlgren@smith-nephew.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">





<div lang="EN-US" link="blue" vlink="purple">
<div class="m_-453179318275407575WordSection1">
<p class="MsoNormal">That’s excellent news.  This is a very difficult problem, which I’ve watched evolve over many years and it’s great to see the payoff from all those brain cycles that have been applied to it.<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">Is there any means to manually force render depth for actors/parts?  We have cases where we draw a couple of overlapped X-ray images, transparent so you can see the overlap to align them.  They are overlaid with lines (for example from
 femur head to trochlear groove), all in the same plane with the images.  Sometimes it looks fine, sometimes the line is hidden until you rotate the image by 1e-6 degrees or zoom by a factor of almost nothing, at which point the lines jump in front; zoom a
 little more and they go behind.  Draw order is correct, image first, then lines “on top”, but when the image is oriented exactly in the plane of the view, then this issue pops up. (Our hack-around is to put the lines some small increment in front of the plane
 of the images.)  As I recall, we tried about five years ago to stick something into vtkRenderer to do this as a proof of concept, but never got anywhere near production with it.<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal"><b>From:</b> Ken Martin <<a href="mailto:ken.martin@kitware.com" target="_blank">ken.martin@kitware.com</a>> <br>
<b>Sent:</b> Tuesday, December 4, 2018 1:24 PM<br>
<b>To:</b> David Gobbi <<a href="mailto:david.gobbi@gmail.com" target="_blank">david.gobbi@gmail.com</a>><br>
<b>Cc:</b> Andrea Borsic <<a href="mailto:aborsic@ne-scientific.com" target="_blank">aborsic@ne-scientific.com</a>>; Fahlgren, Eric <<a href="mailto:eric.fahlgren@smith-nephew.com" target="_blank">eric.fahlgren@smith-nephew.com</a>>; <a href="mailto:vtkusers@public.kitware.com" target="_blank">vtkusers@public.kitware.com</a><br>
<b>Subject:</b> Re: [vtkusers] Strange Visualization Results With Transparency on Polydata<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<p class="MsoNormal">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.<u></u><u></u></p>
</div>
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<div>
<p class="MsoNormal">On Tue, Dec 4, 2018 at 4:00 PM David Gobbi <<a href="mailto:david.gobbi@gmail.com" target="_blank">david.gobbi@gmail.com</a>> wrote:<u></u><u></u></p>
</div>
<blockquote style="border:none;border-left:solid #cccccc 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-right:0in">
<div>
<p class="MsoNormal">What Eric says is true, depth peeling or Z-sorting is needed for transparent polydata.<u></u><u></u></p>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">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.<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">  David<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<div>
<p class="MsoNormal">On Tue, Dec 4, 2018 at 1:47 PM Fahlgren, Eric <<a href="mailto:eric.fahlgren@smith-nephew.com" target="_blank">eric.fahlgren@smith-nephew.com</a>> wrote:<u></u><u></u></p>
</div>
<blockquote style="border:none;border-left:solid #cccccc 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-right:0in">
<div>
<div>
<p class="MsoNormal">Hi Andrea,<u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal">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).<u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal"><span style="font-family:"Courier New""># create a rendering window and renderer</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-family:"Courier New"">ren = vtk.vtkRenderer()</span><u></u><u></u></p>
<p class="MsoNormal"><b><span style="font-family:"Courier New"">ren.SetUseDepthPeeling(True)</span></b><u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal">Eric<u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<div>
<div style="border:none;border-top:solid #e1e1e1 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b>From:</b> vtkusers <<a href="mailto:vtkusers-bounces@public.kitware.com" target="_blank">vtkusers-bounces@public.kitware.com</a>>
<b>On Behalf Of </b><a href="mailto:aborsic@ne-scientific.com" target="_blank">aborsic@ne-scientific.com</a><br>
<b>Sent:</b> Tuesday, December 4, 2018 11:20 AM<br>
<b>To:</b> <a href="mailto:vtkusers@public.kitware.com" target="_blank">vtkusers@public.kitware.com</a><br>
<b>Subject:</b> [vtkusers] Strange Visualization Results With Transparency on Polydata<u></u><u></u></p>
</div>
</div>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal">Dear All,<u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal">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.<u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal">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.
<u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal">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. <u></u>
<u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal">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?<u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal">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.<u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal">Any comment / advice is welcome,<u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal">Thanks, Best Regards,<u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal">Andrea<u></u><u></u></p>
</div>
</div>
</blockquote>
</div>
</div>
</div>
<p class="MsoNormal">_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">
http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the VTK FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">
http://www.vtk.org/Wiki/VTK_FAQ</a><br>
<br>
Search the list archives at: <a href="http://markmail.org/search/?q=vtkusers" target="_blank">
http://markmail.org/search/?q=vtkusers</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="https://public.kitware.com/mailman/listinfo/vtkusers" target="_blank">https://public.kitware.com/mailman/listinfo/vtkusers</a><u></u><u></u></p>
</blockquote>
</div>
<p class="MsoNormal"><br clear="all">
<br>
-- <u></u><u></u></p>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal">Ken Martin PhD<u></u><u></u></p>
<div>
<p class="MsoNormal">Distinguished Engineer<br>
<span style="font-size:9.5pt">Kitware Inc.</span><u></u><u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt">101 East Weaver Street<br>
Carrboro, North Carolina<br>
27510 USA<u></u><u></u></p>
<div>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Tahoma",sans-serif">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.</span><u></u><u></u></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>

</blockquote></div><br clear="all"><br>-- <br><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div>Ken Martin PhD<div>Distinguished Engineer<br><span style="font-size:12.8px">Kitware Inc.</span><br></div><div>101 East Weaver Street<br>Carrboro, North Carolina<br>
27510 USA<br><br><div><span style="font-size:10pt;font-family:Tahoma,sans-serif">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.</span></div></div></div></div></div></div></div>