How To Apply Skinning

Started by
10 comments, last by Buckeye 10 years ago

The mesh does have a parent frame (when exported as a .x file that is), but it is a simple rotation to get it from Blender to DirectX's coordinate system, which I already account for.

The root frame again does have a transformation matrix, when exported as a .x, but it again looks like a rotation, and if I use that instead of the identity matrix with the Calc functions, it just rotates the bone affected vertices and makes it even more wrong!

I use exactly the same shader calls the only difference being:


xBones[i] = _boneArray[i]->finalMatrix; //Bind pose

//vs

xBones[i] = _boneArray[i]->keyFrames[frameNo]; //"Animated" pose

I have also decided to attach a picture showing what exactly is wrong with the model, on the left is Blender at ~frame 0 and 90, compared to in my app on the right. It appears that the forehead's movement in my app has been rotated 90 degrees downwards so it is going into the Monkey's face, rather than forward and out. This makes me think it is something to do with the rotation keys I'm exporting, or maybe the order I'm using to create the initial bone space matrices per frame; is Scale * Rotation * Translation correct?

http://imgur.com/Fz9Ma1Z

Thanks again for any insight you can give smile.png

Advertisement

The mesh does have a parent frame (when exported as a .x file that is), but it is a simple rotation to get it from Blender to DirectX's coordinate system, which I already account for.

The root frame again does have a transformation matrix, when exported as a .x, but it again looks like a rotation, and if I use that instead of the identity matrix with the Calc functions, it just rotates the bone affected vertices and makes it even more wrong!

What reference frame (axes) system are you using in your app? Right-handed or left-handed? Which axes is "up" in your system? How do you create your view and projection matrices?

If you're using a left-handed reference frame, the root frame transformation from the x-file is more than "a simple rotation," it's a transformation between two different reference frames. It's likely a scale and rotation. It would be suspicious for that frame transformation to be applied to a mesh in a frame hierarchy. Normally, DirectX exporters in Blender have exported a root frame with the right- to left-handed transformation (Blender to DirectX), and everything (including the frame containing the mesh) as children to that root frame. In a couple exporters I've used, the transformation is a rotation about axis ( 0, 1, 1 ) followed by a scale of ( 1, 1, -1).

What version of Blender are you using and what DirectX exporter are you using in your comparisons?

Also,


I'm pretty sure there is a keyframe matrix for each bone

If you're having trouble rendering correctly, you should know what data you have. Those are things you have to check in your debugging efforts. If you have garbage coming in, you'll have garbage going out.

Please don't PM me with questions. Post them in the forums for everyone's benefit, and I can embarrass myself publicly.

You don't forget how to play when you grow old; you grow old when you forget how to play.

This topic is closed to new replies.

Advertisement