How long is a piece of string, that's the sort of answer to your question..
The are a plethora of techniques you can used to try and mitigate the artifacts of z-fight and lack of precision in the z/depth buffer , a quick Google should throw up quite a lot, as this has been discussed adnosium on many graphics related, sites, lists and forums ( old Performer list, Vega, Creator,OpenGL etc and this list to name but a few) The problem with many techniques is that they are really view dependent, such that even a simple change in viewing distance or angle will cause the unwanted artifacts of z-fighting to appear, typically you need to apply more than one technique and in many cases change what your doing every time you change you viewing position. In the case of coplanar polygons using the polygon offset is one technique that can help at times (GL_POLYGON_OFFSET, glPolygonOffset(...)) Also factor such as the ratio between you far and near clipping planes affect the precision of the z-buffer, the distance from the origin etc Here's a useful link to Steve Bakers' Z-buffer calculate that illustrates how near and far clip planes and distance effect the precision http://www.sjbaker.org/steve/omniv/love_your_z_buffer.html Gordon Product Manager 3d __________________________________________________________ Gordon Tomlinson Email : gtomlinson @ overwatch.textron.com __________________________________________________________ -----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of Robert Osfield Sent: Tuesday, October 20, 2009 3:55 AM To: [email protected] Subject: Re: [osg-users] How to avoid Z Fighting Hi Miguel, The OSG will try to do it's best at optimizing the near/far planes out of the box, but it isn't a magic wand that solves all z fighting issues. There are a range of strategies that you can use to help avoid z fighting, from using depth partitioning (see the osgdepthpartion example) to tweaking your database to avoid issues. I can't say what would be most appropriate as I really don't know enough about your particular apps needs. Robert. On Tue, Oct 20, 2009 at 8:06 AM, Miguel Lokida <[email protected]> wrote: > Hi, > > Here 's my problem. My scenegraph contains some big an little objects. > But when rendering, I have some Z fighting with coplanar triangles and also, when I place my camera around a little object the znear is to big and my object is cutted. > > So I have used setNearFarRatio with 0.00001. Like this my little object is well int the frustum. But Zfighting appears with big coplanars objects. > > So I have tried to use setCullingActive(true) and setCullingMode( > osg::CullSettings::COMPUTE_NEAR_FAR_USING_PRIMITIVES ) > > and commenting setNearFarRatio but nothing happens. > > So, I wonder if I could have access to the objects that are seen by the camera (node visitor or something else), compute their importance in the scene and use setNearFarRatio to avoid this problem of Z fighting. > Typically this would be done in the camera callback (when changing camera). > > May be there is a better solution ? > > Thank you > > ------------------ > Read this topic online here: > http://forum.openscenegraph.org/viewtopic.php?p=18423#18423 > > > > > > _______________________________________________ > osg-users mailing list > [email protected] > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph. > org > _______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.or g _______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

