[osg-users] Polygon sorting

Zach Deedler mynamezach at gmail.com
Wed Sep 5 16:04:51 PDT 2007


Hi Michele,

I had a similar problem with intersecting polygons.

I fixed it by editing the model.  First, I broke up the polygon so that no
polygon intersected.  This makes it so the depth sort will work for each
polygon (ie. You don't have to depth sort pixels!).  Then, I strategically
placed group nodes above polygons, so that the groups never overlap.  What
this does, in affect, is really start sorting by polygon.

I'm not sure if this is viable for you?  Are you dynamically intersecting
objects?  In any case, adding more groups should improve the depth tests.

If you can't modify the model, you could try to write a node visitor that
inserts a group node above each polygon.  I'm not sure how difficult that
would be, though.

I think it would be great to add the option of polygon depth sorting to OSG,
but I don't know what affect that would have on performance?

-----Original Message-----
From: osg-users-bounces at lists.openscenegraph.org
[mailto:osg-users-bounces at lists.openscenegraph.org] On Behalf Of Michele
Bosi
Sent: Wednesday, September 05, 2007 6:05 PM
To: osg-users at lists.openscenegraph.org
Subject: [osg-users] Polygon sorting

Hello,
I need to sort the polygons of my meshes in order to obtain decent
transparencies for complex autointerstecting objects like 3d
isosurfaces.
I figured out that a very raw way to do so would be to subclass
Viewer, reimplement frame(), and from there getting the viewMatrix and
sorting my poligons based on their distance from the viewer (having
disabled display list support for the node). The actual sorting would
be done on the list of indices (osg::DrawElementsUInt) since I use
indexed triangles.

Since to get correct results I also have to take into account the
transformation applied to my Geometry I was wondering if there was a
more "clever" way to do all this mess, maybe there are already
mechanisms that inform my Geometry that is going to be drawn so that I
can react sorting my polygons appropriately at the correct moment and
accounting for the currently active transformations, something similar
to the VTK/pipeline system.
Any idea?
Regards,
Mike
_______________________________________________
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