[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


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

osg::PolygonMode* polymode = new osg::PolygonMode;

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!


Read this topic online here:


More information about the osg-users mailing list