[osg-users] Questions about Data Variance

10 views
Skip to first unread message

George Bekos

unread,
May 23, 2012, 11:36:38 AM5/23/12
to osg-...@lists.openscenegraph.org
Hello OSGers! :)

Let's say that I have an osg::StateSet with some osg::Materials or osg::Uniforms attached to it. The osg::Material or osg::Uniform changes values during the run time, and because of that I set their DataVariance to DYNAMIC. Do I also have to set the DataVariance of the osg::StateSet to DYNAMIC? What if I have an osg::Geode on which I add/remove Drawables during the run-time? What if I have an osg::Drawable which I update its geometry in every frame? Do I have to set the DataVariance of the osg::Geode to DYNAMIC? Could someone tell me if (and when) the DataVariance property of an osg::Object is inherited to its parent or children automatically? Thanks for your time!

Cheers,
George

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=47824#47824





_______________________________________________
osg-users mailing list
osg-...@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Robert Osfield

unread,
May 23, 2012, 12:22:11 PM5/23/12
to osg-...@lists.openscenegraph.org
Hi George,

The DataVariance property of osg::Object is used in couple of ways.
For internal nodes of the scene it is used as a hint to operations
such as the osgUtil::Optimizer that parts of the scene graph are
static or dynamic and to use this information as guide to what can be
optimized and in what ways - generally it means leaving DYNAMIC nodes
alone. The DataVariance property on Nodes isn't used during the
update, cull and draw traversals so it's effectively ignored.

For the leaves of the scene graph - the osg::StateSet and
osg::Drawable (and it's subclasses), the DataVariance is only used
when using the DrawThreadPerContext and
CullThreadPerCameraDrawThreadPerContext threading models and is used
during the draw traversal to prevent the next frame from commensing
till all DYNAMIC StateSet and Drawables are dispatch. For
SingleThreaded and CullDrawThreadPerContext threading models the
DataVariance is not used as the next frame doesn't commence till the
whole draw dispatch is completed.

The DataVariance of the StateAttribute subclasses is not used in
update, cull or draw traversals, and like nodes is only used be
specialist traversals like some of the ones contained in the
Optimizer. So if you want to dynamic update a Uniform then the way to
make sure that draw doesn't overlap the update of it is to set the
DataVariance of the StateSet that enclose it to DYNAMIC. There isn't
an automatic scheme to check the DataVariance of StateAttributes as it
would be prohibitively expensive to do during the draw traversal.

Robert.
Reply all
Reply to author
Forward
0 new messages