[osg-users] Polygon offset for line geometries, Z-fighting of edges and triangles

Peter Bako osgforum at tevs.eu
Thu Jul 14 04:05:48 PDT 2016


Hi,

In my application, I am manipulating solid 3D models with edges represented by GL_LINES primitiveSet on an osg::Geometry.
The problem is that I cannot use osg::PolygonOffset, to "highlight" the edges (to avoid dashed edges caused by Z-fighting). This was not working at all, I don't see any difference.

Then I checked the osgFX::Scribe effect and I have realized that there is a triangle model renedered with LINE polygon mode

Code:
osg::PolygonMode* polymode = new osg::PolygonMode;
polymode->setMode(osg::PolygonMode::FRONT_AND_BACK,osg::PolygonMode::LINE);



I've tried to simulate the edges using triangles with (almost) no surface and set the polygon mode to LINE ...
The result is that now I see complete and "not dashed" lines, but the edges are sometimes blinking and "highlighted" through triangles, even they shouldn't be visible. Please check the attached video.

If it is possible, I would like to avoid using offects with multiple passes to achieve my goal.

I am using osg 3.1.3

Thank you!

Cheers,
Peter

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=68133#68133




Attachments: 
http://forum.openscenegraph.org//files/edge_rendering_problem_191.zip
http://forum.openscenegraph.org//files/dashed_255.png





More information about the osg-users mailing list