Horde3D

Next-Generation Graphics Engine
It is currently 25.11.2024, 21:33

All times are UTC + 1 hour




Post new topic Reply to topic  [ 9 posts ] 
Author Message
PostPosted: 22.07.2008, 20:12 
Offline

Joined: 10.04.2008, 09:13
Posts: 86
Is it possible to override a joint transformation while the model is animating?
I would like to set a joint transformation matrix "on top" of the running animation.

I've also noticed in the engine code that setting the weight to 0 still means the animation stage
is fully applied with a weight of 0.0001, this seems a lot of overhead when there are a lot animation stages present.


Top
 Profile  
Reply with quote  
PostPosted: 22.07.2008, 22:31 
Offline
Engine Developer

Joined: 10.09.2006, 15:52
Posts: 1217
You can read and write the joint-node transformation after you have applied your animations.

Concerning the weight issue: we will have to check if this can be optimized without negative effects but probably that should work.


Top
 Profile  
Reply with quote  
PostPosted: 01.08.2008, 09:11 
Offline

Joined: 10.04.2008, 09:13
Posts: 86
I can't seem to get it to work. For example in the knight demo I tried to make the knight look to the right while animating:


Code:
   if( !_freeze )
   {
      _animTime += 1.0f / _curFPS;

      // Do animation blending
      Horde3D::setModelAnimParams( _knight, 0, _animTime * 24.0f, _weight );
      Horde3D::setModelAnimParams( _knight, 1, _animTime * 24.0f, 1.0f - _weight );

      // Animate particle systems (several emitters in a group node)
      unsigned int cnt = cnt = Horde3D::findNodes( _particleSys, "", SceneNodeTypes::Emitter );
      for( unsigned int i = 0; i < cnt; ++i )
         Horde3D::advanceEmitterTime( Horde3D::getNodeFindResult( i ), 1.0f / _curFPS );

      if(Horde3D::findNodes( _knight, "Bip01_Head", SceneNodeTypes::Joint )) {
         NodeHandle spine = Horde3D::getNodeFindResult( 0 );
         float tx,ty,tz,rx,ry,rz,sx,sy,sz;
         Horde3D::getNodeTransform(spine,&tx,&ty,&tz,&rx,&ry,&rz,&sx,&sy,&sz);
         rx=-45;
         Horde3D::setNodeTransform(spine,tx,ty,tz,rx,ry,rz,sx,sy,sz);
      }
   }


This doesn't do anything to the knight's head, except when I comment out the two Horde3D::setModelAnimParams lines. Looking at the engine code for setModelAnimParams, it doesn't apply the animations yet. How can I write the joint-node transformation after I've applied the animations, but before rendering?


Top
 Profile  
Reply with quote  
PostPosted: 01.08.2008, 10:17 
Offline
Tool Developer

Joined: 13.11.2007, 11:07
Posts: 1150
Location: Germany
Haven't checked the source code, but maybe the animation transformation is applied after an update of the scene graph. Since there is no seperate update() method in Horde3D (I requested something like that some time ago, but 'marciano' saw no need for this at that time), you can try a workaround. Just request the absolute transformation matrix or the bounding box of the node. This should result in an update of the scene nodes marked dirty.
Not sure if that will solve the problem, but in general it is definitely possible to assign a transformation after the animation.


Top
 Profile  
Reply with quote  
PostPosted: 01.08.2008, 10:39 
Offline

Joined: 10.04.2008, 09:13
Posts: 86
Thanks that works! I'm also for an update() function, so postprocessing is possible. This update call
could set an internal flag and if not set the engine calls update() itself for backwards compatibility.


Top
 Profile  
Reply with quote  
PostPosted: 01.08.2008, 22:00 
Offline
Engine Developer

Joined: 10.09.2006, 15:52
Posts: 1217
Volker wrote:
Haven't checked the source code, but maybe the animation transformation is applied after an update of the scene graph. Since there is no seperate update() method in Horde3D (I requested something like that some time ago, but 'marciano' saw no need for this at that time), you can try a workaround. Just request the absolute transformation matrix or the bounding box of the node. This should result in an update of the scene nodes marked dirty.
Not sure if that will solve the problem, but in general it is definitely possible to assign a transformation after the animation.

An update function should not be required since it should be called implicitely by all relevant scene graph functions automatically. Obviously this is not the case for getNodeTransform which is a bug.


Top
 Profile  
Reply with quote  
PostPosted: 01.08.2008, 22:20 
Offline
Tool Developer

Joined: 13.11.2007, 11:07
Posts: 1150
Location: Germany
not necessarily, since the relativ matrix returned by getNodeTransform normally is not affected by the scene graph. It contains always the last transformation set, the only exception is when you set an animation. In this case the animation won't be set immediately and thus calls to setTransformation will be overwritten by the next update call.


Top
 Profile  
Reply with quote  
PostPosted: 14.09.2008, 22:59 
Offline
Engine Developer

Joined: 10.09.2006, 15:52
Posts: 1217
Ok, Volker has integrated a patch for this issue.


Top
 Profile  
Reply with quote  
PostPosted: 15.09.2008, 09:14 
Offline

Joined: 10.04.2008, 09:13
Posts: 86
Thanks, that's great! I also like that other fix about the "Optimized animation blending to ignore stages with a weight of 0" very much ;)


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 9 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 16 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group