[vtkusers] Coincident topology questions

Langer, Stephen A. (Fed) stephen.langer at nist.gov
Wed Jan 17 18:52:02 EST 2018


Hi Ken --

I've attached a short program that reproduces the problem.  It creates a rectilinear grid (gray checkerboard pattern) and an unstructured grid (red tetrahedra).  The surfaces of some of the tetrahedra are coincident with the outer surfaces of the checkerboard.  If you rotate the view, the tetrahedra are not drawn correctly.

I've tested this with vtk 8.1.0 on macOS 10.12.6 (using vtk built for cocoa) and on Ubuntu 17.10 (running under VirtualBox on macOS).

Thanks for taking a look at it.

-- Steve


From: Ken Martin <ken.martin at kitware.com>
Date: Thursday, January 11, 2018 at 2:41 PM
To: "Langer, Stephen A. (Fed)" <stephen.langer at nist.gov>
Cc: "vtkusers at vtk.org" <vtkusers at vtk.org>
Subject: Re: [vtkusers] Coincident topology questions

Yes, that should work and -3, -3 is pretty reasonable for values. Something odd is going on. Can you give a bit more detail or a snippet of code?


On Thu, Jan 11, 2018 at 2:30 PM, Langer, Stephen A. (Fed) <stephen.langer at nist.gov<mailto:stephen.langer at nist.gov>> wrote:
So if I use
     vtkMapper::SetResolveCoincidentTopologyToPolygonOffset();
and
     mapper->SetRelativeCoincidentTopologyPolygonOffsetParameters(-3,- 3);
then polygons drawn with that mapper should obscure coincident polygons drawn with other mappers?  That's not happening.    What am I missing?

-- Steve

From: Ken Martin <ken.martin at kitware.com<mailto:ken.martin at kitware.com>>
Date: Wednesday, January 10, 2018 at 7:52 PM
To: "Langer, Stephen A. (Fed)" <stephen.langer at nist.gov<mailto:stephen.langer at nist.gov>>
Cc: "vtkusers at vtk.org<mailto:vtkusers at vtk.org>" <vtkusers at vtk.org<mailto:vtkusers at vtk.org>>
Subject: Re: [vtkusers] Coincident topology questions

Here is part of an old email that has some description

You can use the relative settings if the two coincident polygons are in two different mappers.


 On Tue, Dec 1, 2015 at 1:29 PM, Ken Martin <ken.martin at kitware.com<https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fpublic.kitware.com%2Fmailman%2Flistinfo%2Fvtkusers&data=02%7C01%7Cstephen.langer%40nist.gov%7Ceb611caace3b43fd388508d5588d7ed0%7C2ab5d82fd8fa4797a93e054655c61dec%7C1%7C0%7C636512287107516935&sdata=MOAz%2BaPGI75IQNOwc551Ke8i2lYFFFyY3aD3E4dq%2BuQ%3D&reserved=0>> wrote:

>

>>

>> I wanted to take a second to write up a recent change I made to how VTK

>> (on the OpenGL2 backend) can handle coincident geometry.  Previously VTK

>> supported global values for specifying a polygonal offset to push surfaces

>> forward or back in the zbuffer. This was often used to draw a surface back

>> a bit in the zbuffer, and then draw the same surface in wireframe mode at

>> the normal z location. The result was a wireframe overlaid on top of the

>> surface. This approach faced a couple limitations. Every surface was offset

>> the same amount and there was no way to offset points from lines.  To

>> address this I have added a few methods to vtkMapper to specify global line

>> and point offsets as well as ivars to hold local offsets per mapper. The

>> global methods look like:

>>

>>   static void SetResolveCoincidentTopologyLineOffsetParameters(

>>     double factor, double units);

>>

>> while the instance methods look like:

>>

>>   void SetRelativeCoincidentTopologyLineOffsetParameters(

>>     double factor, double units);

>>

>> Both signatures use two parameters which are worth mentioning. The first

>> factor is how much to shift the zbuffer based on how quickly the z values

>> of the surface or line changes. This may seem complicated but it addresses

>> a simple issue.  Due to rasterization issues, surfaces and lines with sharp

>> zvalue slopes are more prone to noise in the zvalues they produce. To

>> combat that, we offset them by an amount that is based on their z slope. If

>> the surface is perpendicular to the view direction the factor is

>> irrelevant, but the more the surface is at a sharp angle to the view

>> direction, the more the factor comes into play. A value of 1.0 to 2.0 is

>> fairly typical for the factor. The second parameter is the units, a

>> constant offset to the zbuffer. It is currently specified conservatively in

>> terms of a 16bit zbuffer for the OpenGL backend so a value of 1.0 to 2.0 is

>> a good place to start. For rendering points we do not have a slope so those

>> methods only take the units argument.

>>

>> I have changed the global defaults so that surfaces are offset at

>> 2.0,2.0, lines are offset at 1.0,1.0, and points are at 0.0. There is a new

>> test in OpenGL2/Testing/CXX/TestCoincident.cxx that renders points on top

>> of lines on top of a surface while rendering the points first and the

>> surface last (the opposite order of their visibility).

>>

>> Thanks

>> Ken


On Wed, Jan 10, 2018 at 5:44 PM, Langer, Stephen A. (Fed) <stephen.langer at nist.gov<mailto:stephen.langer at nist.gov>> wrote:
Hi --

How does one set the arguments to the various vtkMapper::SetRelativeCoincidentTopology methods?  I can't find an explanation for 'factor' and 'units'.

The attached screenshot shows a surface representation of a grid of rectangular voxels and a wire-frame grid of tetrahedra.  Four of the tetrahedral elements are also drawn with a surface representation in red and are supposed to obscure the voxels, but a mix of tex and voxel is drawn instead.  The surfaces of the voxels and the tetrahedral are coplanar.  They don't share nodes and edges, but the points on the x=0 face all have x=0 exactly.  Is the coincident topology resolution machinery expected to work in this case?

I'm using vtk 8.1.0.

Thanks.

      -- Steve


_______________________________________________
Powered by www.kitware.com<https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.kitware.com&data=02%7C01%7Cstephen.langer%40nist.gov%7Ceb611caace3b43fd388508d5588d7ed0%7C2ab5d82fd8fa4797a93e054655c61dec%7C1%7C0%7C636512287107516935&sdata=5QzbWO3Fo9lHhuc2VH8Y7Wlun4i%2BdDk1p%2Fd2zzsQuho%3D&reserved=0>

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html<https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.kitware.com%2Fopensource%2Fopensource.html&data=02%7C01%7Cstephen.langer%40nist.gov%7Ceb611caace3b43fd388508d5588d7ed0%7C2ab5d82fd8fa4797a93e054655c61dec%7C1%7C0%7C636512287107516935&sdata=h7DBgY2pmRRUZD6LrmGpIHO1oIOADRTuXF3XffiY%2Fgk%3D&reserved=0>

Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ<https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.vtk.org%2FWiki%2FVTK_FAQ&data=02%7C01%7Cstephen.langer%40nist.gov%7Ceb611caace3b43fd388508d5588d7ed0%7C2ab5d82fd8fa4797a93e054655c61dec%7C1%7C0%7C636512287107516935&sdata=LbMs8SnnejFm%2BgoK7jbU7Q32nAXIUq6tYfeL1%2FrSVhU%3D&reserved=0>

Search the list archives at: http://markmail.org/search/?q=vtkusers<https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fmarkmail.org%2Fsearch%2F%3Fq%3Dvtkusers&data=02%7C01%7Cstephen.langer%40nist.gov%7Ceb611caace3b43fd388508d5588d7ed0%7C2ab5d82fd8fa4797a93e054655c61dec%7C1%7C0%7C636512287107516935&sdata=RBVsZcDO3qCqk7Q%2BNWm74dXagCcgvDWKhwPP2fYdBpc%3D&reserved=0>

Follow this link to subscribe/unsubscribe:
https://vtk.org/mailman/listinfo/vtkusers<https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fvtk.org%2Fmailman%2Flistinfo%2Fvtkusers&data=02%7C01%7Cstephen.langer%40nist.gov%7Ceb611caace3b43fd388508d5588d7ed0%7C2ab5d82fd8fa4797a93e054655c61dec%7C1%7C0%7C636512287107516935&sdata=Cigk%2F94r%2BYZdT6qteN4lhfgTn2SnkHc5nqXvzI3pREc%3D&reserved=0>



--
Ken Martin PhD
Distinguished Engineer
Kitware Inc.
28 Corporate Drive<https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fmaps.google.com%2F%3Fq%3D28%2BCorporate%2BDrive%2B%250D%2BClifton%2BPark%2BNY%2B12065%26entry%3Dgmail%26source%3Dg&data=02%7C01%7Cstephen.langer%40nist.gov%7Cf37855aff09d4873915208d5592b52fe%7C2ab5d82fd8fa4797a93e054655c61dec%7C1%7C0%7C636512964960094193&sdata=C%2Ftp6ax8hFkI0osmhjEhqtg4x1BoiqxdUimXsDuAOYM%3D&reserved=0>
Clifton Park NY 12065

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.



--
Ken Martin PhD
Distinguished Engineer
Kitware Inc.
28 Corporate Drive
Clifton Park NY 12065

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://vtk.org/pipermail/vtkusers/attachments/20180117/f99c9200/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: tetsandcubes.C
Type: application/octet-stream
Size: 7765 bytes
Desc: tetsandcubes.C
URL: <https://vtk.org/pipermail/vtkusers/attachments/20180117/f99c9200/attachment.obj>


More information about the vtkusers mailing list