[osg-users] Polygon offset for line geometries, Z-fighting of edges and triangles
Sebastian Messerschmidt
sebastian.messerschmidt at gmx.de
Thu Jul 14 05:03:01 PDT 2016
Am 14.07.2016 um 13:05 schrieb Peter Bako:
> 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.
Yes it is expected to have no effect on lines, since it is call
Polygon-Offset ;-)
You can do it the other way round and use a negative polygon offset on
your solid object and render the lines normally. That should work.
If it is not working you can also modify the projection matrix for the
second set of objects by adding some small offset to the near and far
plane. But I'd recommend not to do this, unless you're using shaders
anyways.
Third option is to physically move the lines along the normal vector of
the first geometry.
>
> 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.
Nay.. Don't do this. Degnerate triangles might end up totally unexpected.
>
> 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
Cheers
Sebastian
>
> 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
>
>
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
More information about the osg-users
mailing list