<div dir="ltr"><div>For the OpenGL2 backend VTK version 7.0 the offset code is based on two properties, the factor and units. The shader math is shown below but the basic gist is that the units (coffset below) impacts all fragments while the factor (cfactor below) is weighted by the slope of the fragment. The greater the z-slope of a fragment the farther you need to offset to make sure the two fragments are not coincident. Positive values push farther back in the z buffer. The properties are unitless in that the coordinate system your actor is defined in has no impact on the values.</div><div><br></div><div><div><pre class="" style="font-family:Menlo,'Liberation Mono',Consolas,'DejaVu Sans Mono','Ubuntu Mono','Courier New','andale mono','lucida console',monospace;padding:10px;margin-top:0px;margin-bottom:0px;word-wrap:normal;color:rgb(51,51,51);border-left-width:1px;border-style:none none none solid;border-color:rgb(239,239,241);border-radius:0px;font-size:13px!important;line-height:1.5!important"><code style="font-family:Menlo,'Liberation Mono',Consolas,'DejaVu Sans Mono','Ubuntu Mono','Courier New','andale mono','lucida console',monospace;font-size:inherit;padding:0px;color:inherit;border-radius:0px;word-wrap:normal;background-color:transparent"><span id="LC1250" class="" style="display:inline-block"> <span class="" style="color:rgb(221,17,68)">"float cscale = length(vec2(dFdx(gl_FragCoord.z),dFdy(gl_FragCoord.z)));</span><span class="" style="color:rgb(221,17,68)">\n</span><span class="" style="color:rgb(221,17,68)">"</span></span>
<span id="LC1251" class="" style="display:inline-block"> <span class="" style="color:rgb(221,17,68)">" gl_FragDepth = gl_FragCoord.z + cfactor*cscale + 0.000016*coffset;</span><span class="" style="color:rgb(221,17,68)">\n</span><span class="" style="color:rgb(221,17,68)">"</span></span></code></pre></div><div><br></div></div><div><br></div><div>VTK defaults these properties to the following values for polygons/lines/points such that if you turn on resolving coincident topology using polygon offset the defaults should work fairly well to put points on top of lines and line on top of polygons. Also be aware in VTK 7 you can specify mapper specific adjustments to these globals using the SetRelativeCoincidentTopologyPolygonOffsetParameters style methods. Those methods add the mapper specific value to the global for that mapper. Values in the range of -10 --- +10 generally make sense. The factor and units should typically have the same sign.</div><div><br></div><pre class="" style="font-family:Menlo,'Liberation Mono',Consolas,'DejaVu Sans Mono','Ubuntu Mono','Courier New','andale mono','lucida console',monospace;padding:10px;margin-top:0px;margin-bottom:0px;word-wrap:normal;color:rgb(51,51,51);border-left-width:1px;border-style:none none none solid;border-color:rgb(239,239,241);border-radius:0px;font-size:13px!important;line-height:1.5!important"><code style="font-family:Menlo,'Liberation Mono',Consolas,'DejaVu Sans Mono','Ubuntu Mono','Courier New','andale mono','lucida console',monospace;font-size:inherit;padding:0px;color:inherit;border-radius:0px;word-wrap:normal;background-color:transparent"><span id="LC40" class="" style="display:inline-block"><span class="" style="font-weight:bold">static</span> <span class="" style="color:rgb(68,85,136);font-weight:bold">double</span> <span class="" style="">vtkMapperGlobalResolveCoincidentTopologyPolygonOffsetFactor</span> <span class="" style="font-weight:bold">=</span> <span class="" style="color:rgb(0,153,153)">2.0</span><span class="" style="">;</span></span>
<span id="LC41" class="" style="display:inline-block"><span class="" style="font-weight:bold">static</span> <span class="" style="color:rgb(68,85,136);font-weight:bold">double</span> <span class="" style="">vtkMapperGlobalResolveCoincidentTopologyPolygonOffsetUnits</span> <span class="" style="font-weight:bold">=</span> <span class="" style="color:rgb(0,153,153)">2.0</span><span class="" style="">;</span></span>
<span id="LC42" class="" style="display:inline-block"><span class="" style="font-weight:bold">static</span> <span class="" style="color:rgb(68,85,136);font-weight:bold">double</span> <span class="" style="">vtkMapperGlobalResolveCoincidentTopologyLineOffsetFactor</span> <span class="" style="font-weight:bold">=</span> <span class="" style="color:rgb(0,153,153)">1.0</span><span class="" style="">;</span></span>
<span id="LC43" class="" style="display:inline-block"><span class="" style="font-weight:bold">static</span> <span class="" style="color:rgb(68,85,136);font-weight:bold">double</span> <span class="" style="">vtkMapperGlobalResolveCoincidentTopologyLineOffsetUnits</span> <span class="" style="font-weight:bold">=</span> <span class="" style="color:rgb(0,153,153)">1.0</span><span class="" style="">;</span></span>
<span id="LC44" class="" style="display:inline-block"><span class="" style="font-weight:bold">static</span> <span class="" style="color:rgb(68,85,136);font-weight:bold">double</span> <span class="" style="">vtkMapperGlobalResolveCoincidentTopologyPointOffsetUnits</span> <span class="" style="font-weight:bold">=</span> <span class="" style="color:rgb(0,153,153)">0.0</span><span class="" style="">;</span></span></code></pre><div><br></div><div>Hope that helps</div><div>Ken</div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Apr 11, 2016 at 4:26 PM, marcin.krotkiewski <span dir="ltr"><<a href="mailto:marcin.krotkiewski@gmail.com" target="_blank">marcin.krotkiewski@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hello,<br>
<br>
I am wondering if there were any major changes between VTK6.3 and VTK7 in how SetResolveCoincidentTopologyPolygonOffsetParameters in the OpenGL2 backend works.<br>
<br>
I have been using OpenGL2 and polygon offset to display contour lines on 3D surface meshes (digital elevation models). The parameters I use are (1, mesh_size), where mesh_size is some value related to the 'physical' distance between nodes in my surface meshes. In VTK7 that gives very wrong results. To get similar behavior I seem to have to use (2, 1), regardless of 'physical' distances between the mesh nodes.<br>
<br>
Could anyone shed some light on that?<br>
<br>
Thanks!<br>
<br>
Marcin<br>
<br>
_______________________________________________<br>
Powered by <a href="http://www.kitware.com" rel="noreferrer" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" rel="noreferrer" 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" rel="noreferrer" 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" rel="noreferrer" target="_blank">http://markmail.org/search/?q=vtkusers</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://public.kitware.com/mailman/listinfo/vtkusers" rel="noreferrer" target="_blank">http://public.kitware.com/mailman/listinfo/vtkusers</a><br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature">Ken Martin PhD<div>Chairman & CFO<br>Kitware Inc.<br>28 Corporate Drive<br>Clifton Park NY 12065<br>518 371 3971<div><br></div><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>