Independent Animation of Shared Objects

34 views
Skip to first unread message

Mauricio Franco

unread,
Apr 20, 2020, 1:53:48 AM4/20/20
to OpenSceneGraph Users
Hello all,
I'm wondering how to design the scenegraph to make LOD and Animation of shared objects to work.

I'm trying to make a simulation of 2,000 human characters.  All characters look the same.  We load 3 FBX files for each level of detail (low, med and high).  Each FBX file has multiple animations (walking, running, standing).  The models are loaded with osgDB cached all option.

The structure of the scenegraph is like this:

(osg::PositionAttitudeTransform) -> (osg::LOD) -> (osg::Node as loaded from the FBX File)

The animation manager callback is extracted from the FBX file and assigned to the osg::PositionAttitudeTransform.

Caching of objects work, LOD works but when I start the animation of one character, it starts the same animation in all the characters at the same time.

How can I achieve independent animations?

Thank you very much in advance,

Mauricio.





OpenSceneGraph Users

unread,
Apr 20, 2020, 4:31:34 AM4/20/20
to OpenSceneGraph Users
Hi Mauricio,

For a large number of independently animated characters I'd use shaders to the the animation and hardware instancing.  This does mean making your own shaders/uniform etc. setup but performance will be far far better than trying to reuse the CPU based architecture.

Robert.

--
You received this message because you are subscribed to the Google Groups "OpenSceneGraph Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to osg-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/osg-users/4f0d0a91-9b05-4403-9fbf-36a6f0c64da5%40googlegroups.com.
_______________________________________________
osg-users mailing list
osg-...@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Mauricio Franco

unread,
Apr 20, 2020, 2:52:40 PM4/20/20
to osg-...@googlegroups.com
Hi Robert,
Thanks a lot for the prompt answer.
Assuming the CPU can handle the load or that we reduce the number of instances, how can I achieve independent animations?

Let's say I have a node containing the FBX file loaded with osgDB called SharedNode.
And I have two instances sharing the same node:
Instance1:  PAT->SharedNode
Instance2:  PAT->SharedNode

I extract the animation manager from the shared node and place a copy of it in the PATs of each instance.  Then I play one instance and then both instances start to play.

Is it possible to share the FBX model while achieving independent animations?

Thanks in advance,

Mauricio.


Mauricio Franco

unread,
Apr 23, 2020, 8:35:23 PM4/23/20
to osg-...@googlegroups.com
I could load 3,000 animated models and have them perform their animations independently of each other.  
I managed to make it work by cloning from the shared node using:
instanceNode = sharedNode->clone(osg::CopyOp::DEEP_COPY_CALLBACKS | osg::CopyOp::DEEP_COPY_NODES));

Thanks so much!
Reply all
Reply to author
Forward
0 new messages