[vtkusers] Subdivided surface with non-subdivided edges (z fighting)

Greg Schussman greg.schussman at gmail.com
Mon Aug 22 17:54:52 EDT 2016

Hi, again.

I got the following advice directly from Jason:

I’ve gotten decent results using approach 3 as described below (although in
> VTK 7) with the following options:
>    vtkPolyDataMapper::SetResolveCoincidentTopologyToPolygonOffset();
>  vtkPolyDataMapper::SetResolveCoincidentTopologyPolygonOffsetParameters(0,0);
>  vtkPolyDataMapper::SetResolveCoincidentTopologyLineOffsetParameters(-2,.2);

As far as I can tell, SetResolveCoincidentTopologyLineOffsetParameters is
not available before vtk-7. I tried building vtk-7, but that turned out to
be problematic...

The root of that problem is that I have to support an industry that still
commonly uses RHEL5 machines, which means I'm stuck with the GCC-4.1.2 that
comes with RHEL5.  But vtk-7 requires at least GCC-4.2.  I looked around a
bit online, and didn't see a technical reason why vtk-7 *had* to have
gcc-4.2, so I disabled the two tests and built it with gcc-4.1, with no
compile/link errors.

Sadly, at runtime, I got a complaint about the mesa version, and a
segfault.   I tried building the requested version of mesa, but that turned
out to be problematic. I had gotten a previous version to work by rewriting
small parts of mesa's install scripts to not use the python ternary
operator.  But the requested version had a lot of other problems and some
new dependencies.

So approach 3 is out.  Does anyone see a way to make approach 1 (vtk edge
flags), or approach 2 ("surface with edges", but without the surface), or
something else work?

My original problem is to show "surface with edges" where the "edges" are
from an original set of geometry, but the "surface" consists of subdivided
geometry.   For example, if the original geometry was just one triangle,
I'd introduce 4 new vertices (one for the triangle center, and 1 for each
edge midpoint).  The subdivided geometry would be 3 quads using those
vertices.   So I need both the original edges and thet new texture mapped
quads (without z fighting).

Thanks in advance for any help.


On Mon, Aug 15, 2016 at 5:29 PM, Greg Schussman <greg.schussman at gmail.com>

> Hi.
> I am trying to do a variation on "surface with edges".  I subdivide the
> surface polygons and put new scalar values at the vertices of the
> sub-polygons.  This is working just fine.  However, I want to show "surface
> with edges", but I want the original edges, not the subdivided ones.
> I've tried several approaches, without success.
> Approach 1:
> I recall OpenGL having an edge flag that did the kind of thing I'm after:
> as I'd issue glVertex calls between a glBegin and a glEnd, I could also set
> the edge flag for whether the edge was to be visible.
> Searching around in VTK, I see that VtkDataSetAttributes has EDGEFLAG as
> one of its AttributeTypes.  I'm afraid I don't understand, because my use
> of attributes has been scalar or vector values associated with points, but
> the edge flag wouldn't be associated with points, but rather with, well,
> edges.  I haven't been able to find an example that uses this, so I'm
> questioning whether it's even the same thing.
> Approach 2:
> I have the original polygons (from before the subdivision).  I Figured I
> could just draw "surface with edges" for those, but set their opacity to 0,
> and leave the edge opacity at 1.  It appears that the cell opacity applies
> to both the cell and the edges, and I don't see a way to set them
> independently.  Although edge visibility can be toggled, I don't see a way
> to toggle the surface visibility while leaving edges visible.
> Approach 3:
> I extracted the edges from the original polygons, and tried drawing them
> together with the subdivided polygons (where the subdivided polygon edge
> visibility is off).  This is resulted in what I was after, except there's z
> fighting between the original edges and the subdivided surfaces.  I read
> about the various ResoveCoincidentTopology options, but those appear to be
> for a polygon with it's own edges, not a polygon with some other edges.  I
> played with them anyway, just in case, but didn't see anything promising.
> So... Am I barking up the wrong trees?  How should I show one set of edges
> on top of another set of polygons?  I'm using python 2.6, talking to
> vtk-5.10.
> Thanks in advance for any help.
> Greg
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20160822/0b45517a/attachment.html>

More information about the vtkusers mailing list