Getting base pose

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
JunkerKun
Posts: 97
Joined: Mon Jan 28, 2013 12:52 am

Getting base pose

Post by JunkerKun »

Hello, it's me again.

Is there any way to get the binding pose of a skeleton in quaternions?
mongoose7
Posts: 1227
Joined: Wed Apr 06, 2011 12:13 pm

Re: Getting base pose

Post by mongoose7 »

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.
JunkerKun
Posts: 97
Joined: Mon Jan 28, 2013 12:52 am

Re: Getting base pose

Post by JunkerKun »

The binding pose. You know, the basic pose the skeleton is being in while not animated.
mongoose7
Posts: 1227
Joined: Wed Apr 06, 2011 12:13 pm

Re: Getting base pose

Post by mongoose7 »

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?
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Getting base pose

Post by CuteAlien »

mongoose7 wrote:Try not animating it when you load it into Irrlicht.
I think that's exactly what he is asking about. How to do that.

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
mongoose7
Posts: 1227
Joined: Wed Apr 06, 2011 12:13 pm

Re: Getting base pose

Post by mongoose7 »

Surely you have to set the range and speed for the mesh to animate? I would have thought just loading it not animate it.
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Getting base pose

Post by CuteAlien »

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
mongoose7
Posts: 1227
Joined: Wed Apr 06, 2011 12:13 pm

Re: Getting base pose

Post by mongoose7 »

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.
JunkerKun
Posts: 97
Joined: Mon Jan 28, 2013 12:52 am

Re: Getting base pose

Post by JunkerKun »

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.
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Getting base pose

Post by CuteAlien »

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
wing64
Competition winner
Posts: 242
Joined: Wed Jul 23, 2008 2:35 am
Location: Thailand
Contact:

Re: Getting base pose

Post by wing64 »

At SJoint structure focus on LocalMatrix or GlobalMatrix.
JunkerKun
Posts: 97
Joined: Mon Jan 28, 2013 12:52 am

Re: Getting base pose

Post by JunkerKun »

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.
Post Reply