Horde3D http://www.horde3d.org/forums/ |
|
override animation joint transformation http://www.horde3d.org/forums/viewtopic.php?f=2&t=443 |
Page 1 of 1 |
Author: | jimbo [ 22.07.2008, 20:12 ] |
Post subject: | override animation joint transformation |
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. |
Author: | marciano [ 22.07.2008, 22:31 ] |
Post subject: | Re: override animation joint transformation |
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. |
Author: | jimbo [ 01.08.2008, 09:11 ] |
Post subject: | Re: override animation joint transformation |
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? |
Author: | Volker [ 01.08.2008, 10:17 ] |
Post subject: | Re: override animation joint transformation |
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. |
Author: | jimbo [ 01.08.2008, 10:39 ] |
Post subject: | Re: override animation joint transformation |
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. |
Author: | marciano [ 01.08.2008, 22:00 ] |
Post subject: | Re: override animation joint transformation |
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. |
Author: | Volker [ 01.08.2008, 22:20 ] |
Post subject: | Re: override animation joint transformation |
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. |
Author: | marciano [ 14.09.2008, 22:59 ] |
Post subject: | Re: override animation joint transformation |
Ok, Volker has integrated a patch for this issue. |
Author: | jimbo [ 15.09.2008, 09:14 ] |
Post subject: | Re: override animation joint transformation |
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 ![]() |
Page 1 of 1 | All times are UTC + 1 hour |
Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |