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

Ken Martin ken.martin at kitware.com
Tue Aug 23 12:56:11 EDT 2016


If you could use VTK 7+ Your approach 3 would be the best way to do it. Be
aware

 vtkPolyDataMapper::SetResolveCoincidentTopologyLineOffsetParameters(-2,.2);

In calls like that the two parameters should have the same sign for best
results.

Using an old version of VTK I think you can do option 3 but with the
following calls

vtkMapper::SetResolveCoincidentTopologyToPolygonOffset();
vtkMapper::SetResolveCoincidentTopologyPolygonOffsetParameters(-2.0,-5.0);

play with the -2.0 and -10.0 to get the best results.

Thanks
Ken




On Mon, Aug 22, 2016 at 5:54 PM, Greg Schussman <greg.schussman at gmail.com>
wrote:

> 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::SetResolveCoincidentTopologyPo
>> lygonOffsetParameters(0,0);
>>    vtkPolyDataMapper::SetResolveCoincidentTopologyLi
>> neOffsetParameters(-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.
>
> Greg
>
>
>
>
>
>
> On Mon, Aug 15, 2016 at 5:29 PM, Greg Schussman <greg.schussman at gmail.com>
> wrote:
>
>> 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
>>
>>
>
> _______________________________________________
> 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:
> http://public.kitware.com/mailman/listinfo/vtkusers
>
>


-- 
Ken Martin PhD
Chairman & CFO
Kitware Inc.
28 Corporate Drive
Clifton Park NY 12065
518 371 3971

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: <http://public.kitware.com/pipermail/vtkusers/attachments/20160823/f444de59/attachment.html>


More information about the vtkusers mailing list