Hi Chris, This is the classic problem with use and a depth buffer and depth sorting objects as whole objects rather than at the fragment level. You can tweak the sort algorithm and use further point, nearest point or mid point as the OSG uses and you'll best results with different sort values for different model types and different eye points, quite simply there is no best all round sort position. I've take then mid point as the sort value as it'll be a pretty reasonable default for most models, equally good/bad depending upon if you a half full/half empty type...
The solution for this type of problem is typically to just break your objects into smaller segments so that the depth sorting will do a better job. In your case slitting the shelf into two halves will almost certainly produce far better results. You could look at more complex techniques like depth peeling, but given how simple cutting a single bit of geometry into two is I'd go this route. Robert. On Tue, Mar 2, 2010 at 10:52 AM, Chris Denham <[email protected]> wrote: > I'm guessing that this is an old computer graphics problem to do with depth > sorting the drawing sequence of transparent objects, but I'm a bit puzzled > why OSG is having a problem with this little example. > > Basically, in some views of a this example scene, the transparency is not > working properly. See attached JPG screen grab and OSG model. > > I suspect the root cause that in some views, the depthsort is causing a > door to be drawn before a shelf even though the door is nearer. Is the > depthsort ordered by depth of the midpoint of geometries? That would > certainly explain the issue because the midpoint of a shelf could certainly > be infront of the midpoint of a door even though ALL of the door polys are > infront of ALL the shelf polys. (yes, read that last sentence again! lol.) > > I was wondering if the depthsorting algorithm could be improved to fix this > problem, maybe by sorting by deepest geometry vertex rather than geometry > midpoint (if that's what it's doing) ? Is there way to override render bin > depthsort to provide it with different depth values for each > geometry/drawable? > > I know I can also tweak things for special cases e.g. by putting the door > and shelf in different render bins but that's not a general or practical > solution. > > How are others solving this problem? > > Regards. > > Chris D. > > ------------------ > Read this topic online here: > http://forum.openscenegraph.org/viewtopic.php?p=25040#25040 > > > > > Attachments: > http://forum.openscenegraph.org//files/glassproblem_994.osg > http://forum.openscenegraph.org//files/glassproblem_137.jpg > > > _______________________________________________ > 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.org

