Getting base pose
Getting base pose
Hello, it's me again.
Is there any way to get the binding pose of a skeleton in quaternions?
Is there any way to get the binding pose of a skeleton in quaternions?
Re: Getting base pose
The what? Are you talking about some game engine? Anyway, given a matrix, you can get the quaternion and given Euler angles you can get a matrix. Just look in the documentation.
Re: Getting base pose
The binding pose. You know, the basic pose the skeleton is being in while not animated.
Re: Getting base pose
Try not animating it when you load it into Irrlicht. But you know there are no transformations? The skeleton *is* the skeleton. If you want to apply a keyframe then that is not the base pose. So the answer to your question is, the quaternions for all the joints in the "binding" pose are the identity. Maybe you want to get the skeleton?
Re: Getting base pose
I think that's exactly what he is asking about. How to do that.mongoose7 wrote:Try not animating it when you load it into Irrlicht.
I'm not really familiar with the animation system, but looking at the code the getMesh is not automatically animating when JointMode is EJUOR_CONTROL. Try calling setJointMode with that - with some luck you'll get the base pose then.
Do that directly after loading or at least before first drawAll call of the scenemanager (it might also work later on - I'm just not sure about it without reading deeper into the code now).
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Re: Getting base pose
Surely you have to set the range and speed for the mesh to animate? I would have thought just loading it not animate it.
Re: Getting base pose
Those values are all set by default. So when you call getMesh() just like that you get the mesh for the current animation step. No need to do anything to get your animated mesh animating as that's the default.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Re: Getting base pose
Then write the mesh to an OBJ file. The mesh writer reads LocalBuffers, which is where the base pose is stored, I believe.
But the OP wanted the 'binding' pose in quaternions, to which I say again, there are no transformations in the base pose and each of the quaternions is equal to the identity quaternion.
But if he wants the orientations of the bones, then one needs to go through the joint hierarchy and work out the position of each joint relative to its parent. You can then get the rotation from that, assuming I guess that the initial state of any bone is pointing directly up. There is a rotate-from-to function in Irrlicht which would do the trick.
But the OP wanted the 'binding' pose in quaternions, to which I say again, there are no transformations in the base pose and each of the quaternions is equal to the identity quaternion.
But if he wants the orientations of the bones, then one needs to go through the joint hierarchy and work out the position of each joint relative to its parent. You can then get the rotation from that, assuming I guess that the initial state of any bone is pointing directly up. There is a rotate-from-to function in Irrlicht which would do the trick.
Re: Getting base pose
I was thinking there is an easier and more sophisticate way to get quaternions from the binding pose except for getting degrees from already animated model and convert them. Oh well, I guess there is no other way.
Thanks.
Thanks.
Re: Getting base pose
Sorry, that's going too deep for me without learning more about how the animation system works. But check what http://irrlicht.sourceforge.net/docu/cl ... _mesh.html offers - that's the ISkinnedMesh. And I think you can get the base pose like I described above. I see no quaternions right now - I guess it works with matrices.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Re: Getting base pose
At SJoint structure focus on LocalMatrix or GlobalMatrix.
Re: Getting base pose
Well... I made it by getting SKey rotation of the first frame. The problem is... the W coordinate was inverted by some reason. So I had to get the rotation of the bone first, then convert it to quaternion, then get W value and if it's not equal, inverse the value in the frame. Or rather in frameS since I need to get all of them. That did the trick.