Hi,
Short answer: there are no simple way,
You should get all drawables, grab all primitivesets and set instance count for 
them, write shaders that make use of instanceID to calculate vertex position.
also with instanced drawing you should disable display lists, so for 
performance reasons make sure that your drawables have low primitivesets count 
(single primitiveset is good goal), i'd recommend to use osg optimizer with 
INDEX_MESH | VERTEX_PRETRANSFORM | VERTEX_POSSTRANSFORM on models you gonna 
draw instanced.

03.12.2011, 07:03, michael.a.bo...@l-3com.com:
> Hi Everyone,
> I'm trying to implement a fairly dense forested area and simply adding
> in a bunch of osg::MatrixTransform nodes predictably causes the cull to
> crash. I could try reorganizing the scene around an oct-tree as was
> suggested by a previous discussion on this topic, but for draw
> performance reasons, since each tree is the same model, I would like to
> use the "new" draw instanced arb. I see that osgdrawinstanced has been
> referenced in many similar threads, but osgdrawinstanced creates its
> geometry on the fly, and in doing so can quite easily use the command
> syntax for instancing. I am trying to apply the technique to a loaded
> model and there is no obvious easy method.
>
> My question is this, if I load a file using
>
> osgDB::readNodeFile("somefile.osg");
>
> How would I set it up for instanced drawing?
>
> My guess is that I would need to write a node-visitor that collects all
> of the geometry -> drawables and sets them up to use the instanced call
> overload instead of the default. I have tried doing this, but my
> implementation has gotten pretty complex, and I want to make sure there
> isn't a more simple way I have overlooked.
>
> Thank you very much for your time.
>
> Michael A Bosse'
>
> _______________________________________________
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to