On Thu, Jun 14, 2012 at 8:51 AM, Jason Anderssen <[email protected]> wrote: > Anyone got a recommendation for the following, or same as a previous post of > mine, is this the wrong forum ? > > Cheers > Jason > > On 13/06/2012, at 8:43 AM, Jason Anderssen wrote: > >> Hi all, >> >> Working with OSG, and all is going well. But would like to know would be >> the "recommended" way to do the following: >> >> User picks an object. Turn off the rest of the scene so only the single >> object they selected is displayed? The most obvious way to do this is with node masks and the cull mask of the camera:
* At the start, nodes have a traversal mask of 0x1, camera's cull mask is 0x1. * After a selection, set the node of interest's mask to 0x2, camera's cull mask to 0x2. * When the object is unselected, set the node's and camera's masks back to 0x1. >> >> also >> >> User picks an object, depth peal the entire scene to the single object >> selected? I'm not sure what you mean by depth peeling here. If you just want the selected object to always be rendered, in effect "cutting away" the geometry in front of it in the scene, you could use the stencil planes to achieve that: * Draw the selected object first, setting the stencil planes. * Draw the whole scene using the stencil test. If you mean that you want to make every object translucent except for selected object, then you need to assign the appropriate StateSet to those objects. Both of these approaches require changing a StateSet that will apply to an object or a part of the scene graph. The simplest way to do that is with a Switch node and two child Group nodes that each hold a different StateSet. Your object would be a child of both those groups. Also, the simplest way to assign a draw object to an object, i.e., draw an object before all other geometry, is to set the render bin utils in StateSet. Look at the osghangglide example. Tim >> >> Thank you in advance for any help >> >> Cheers >> Jason >> _______________________________________________ >> 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 _______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

