[osg-users] Hiding a node from a single view
Hi, I have a scene with a number of 3D models and I need to be able to view the scene from the point of view of one of the models. When I view the scene from one of the models, I'd like to hide that model from view so it doesn't block the view. I'm using Switch nodes to enable/disable the models now, but I need to add support for multiple views with different viewpoints, and I want the model to be visible from those other viewpoints. I tried using update callbacks to set the node masks to zero to hide the models, but then the callbacks stopped getting called and I couldn't unhide the models. What is the best way to accomplish this? Node masks, cull callbacks? I'm using version 2.8.4 of OSG. Thank you! Cheers, Don (P.S. This is my first post in the OSG forums!) -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=46003#46003 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Hiding a node from a single view
Nodemasks can be set on the Nodes, and each view can have a unique nodemask. The bitwise AND of the two must be non-zero for a Node to display in a view. -- Chris 'Xenon' Hanson, omo sanza lettere. xe...@alphapixel.com http://www.alphapixel.com/ Training • Consulting • Contracting 3D • Scene Graphs (Open Scene Graph/OSG) • OpenGL 2 • OpenGL 3 • OpenGL 4 • GLSL • OpenGL ES 1 • OpenGL ES 2 • OpenCL Digital Imaging • GIS • GPS • Telemetry • Cryptography • Digital Audio • LIDAR • Kinect • Embedded • Mobile • iPhone/iPad/iOS • Android ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Hiding a node from a single view
Hi Don, What is the best way to accomplish this? Node masks, cull callbacks? Chris's solution will work fine, but you may have many objects you want to control independently and then you'll run out of bits in your node mask. If that's the case, a cull callback can be another way to do it. In a cull callback, you can dynamic_cast the nodevisitor pointer to an osgUtil::CullVisitor, then get the current camera and its view. If you have any way of identifying the nodes you want to see and the ones you don't, and the views in which you want them to be visible or not (something as simple as a string comparison to the name of the node/view, or a hash map lookup, or whatever) then in the cull callback you can simply not traverse and that node's children (geometry etc) will not be visible. You could get fancy and implement your own PerViewSwitch node, that would inherit from osg::Group and override the traverse() method to decide whether to traverse or not based on the name of the view/camera/node or whatever. Hope this helps, J-S -- __ Jean-Sebastien Guay jean_...@videotron.ca http://whitestar02.dyndns-web.com/ ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org