OgreAnimation library!

Discussion area about developing with Ogre2 branches (2.1, 2.2 and beyond)
User avatar
lunkhound
Gremlin
Posts: 169
Joined: Sun Apr 29, 2012 1:03 am
Location: Santa Monica, California

Re: OgreAnimation library!

Post by lunkhound » Fri Dec 27, 2013 1:17 am

dark_sylinc wrote:
lunkhound wrote: 1. The ability to update animations and update bone transforms separately from rendering the scene
I'm not sure 100% what you mean by that.
Basically can I do the following:

Code: Select all

  each frame:
    apply_animations_and_update_transforms_on_all_bones();
    do_stuff_to_modify_bone_transforms_selectively();
    render_scene();
Or something close to that?
0 x

User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 4066
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 228
Contact:

Re: OgreAnimation library!

Post by dark_sylinc » Fri Dec 27, 2013 3:26 pm

lunkhound wrote: Basically can I do the following:

Code: Select all

  each frame:
    apply_animations_and_update_transforms_on_all_bones();
    do_stuff_to_modify_bone_transforms_selectively();
    render_scene();
Or something close to that?
More or less that's the idea I have in mind, actually more like:

Code: Select all

  each frame:
    apply_animations_and_update_transforms_on_all_bones_phase01(); //Local-Bone to Object space
    do_stuff_to_modify_bone_transforms_selectively(); //Modify object space
    apply_animations_and_update_transforms_on_all_bones_phase02(); //Object space to World-Bone
    render_scene();
Keep in mind that the animation update and "do_stuff_to_modify_bone_transforms_selectively" will happen in multiple threads.
0 x

User avatar
lunkhound
Gremlin
Posts: 169
Joined: Sun Apr 29, 2012 1:03 am
Location: Santa Monica, California

Re: OgreAnimation library!

Post by lunkhound » Fri Dec 27, 2013 6:35 pm

dark_sylinc wrote:
lunkhound wrote: Basically can I do the following:

Code: Select all

  each frame:
    apply_animations_and_update_transforms_on_all_bones();
    do_stuff_to_modify_bone_transforms_selectively();
    render_scene();
Or something close to that?
More or less that's the idea I have in mind, actually more like:

Code: Select all

  each frame:
    apply_animations_and_update_transforms_on_all_bones_phase01(); //Local-Bone to Object space
    do_stuff_to_modify_bone_transforms_selectively(); //Modify object space
    apply_animations_and_update_transforms_on_all_bones_phase02(); //Object space to World-Bone
    render_scene();
Keep in mind that the animation update and "do_stuff_to_modify_bone_transforms_selectively" will happen in multiple threads.
Hmmm. So 'do_stuff_to_modify_bone_transfroms_selectively' can't be done in the main thread? I was hoping to do something like the following in that function:

Code: Select all

for each object:
   copy bone transforms onto physics constraints or rigid bodies
global_physics_tick();  // this obviously needs to be done from the main thread
for each object:
   extract rigid body transforms and put them back onto bones
The way I'm doing this in 1.x is for each Entity, I call "setSkipAnimationStateUpdate( true )" to prevent Ogre from applying animations during the sceneMgr->_renderScene() call. Then I manually apply animations for each entity, read back the bone transforms, feed them into physics, run physics, read the results out of physics and stick them back onto the bones, and finally I call _renderScene().
I don't really need to do this on all of my objects, because this is pretty expensive. I was hoping that with 2.0 and the new animation system I would be able to avoid looping over the Entities and manually applying the animations (with entity->getSkeleton()->setAnimationState( *entity->getAllAnimationStates() )) like I do now.
0 x

Post Reply