Jump to content
  • Advertisement
Sign in to follow this  
Code-R

Skeletal animation : Normals and tangents

This topic is 4852 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

what's the best way to handle normals and tangents in skeletal animation? should I skin the normals in the same way I do with the vertices? will they need to be re-normalized? should I calculate the tangents once and then skin them accordingly or should I skin the normals then calculate tha tangents again using something like NVIDIA's NVMeshMender? I'd appreciate any ideas. TIA

Share this post


Link to post
Share on other sites
Advertisement
If you keep your skeletal matrices as affine transformations ( only rotations and translations ), there is no need to re-normalize the normals and tangents.

If your matrices are 3x4 like this:
R11 R12 R13 T1
R21 R22 R23 T2
R31 R32 R33 T3
You'd only need to multiply normals by the rotational component of the matrices (Those marked with 'R'), and avoid 'T's.

Share this post


Link to post
Share on other sites
Tangents have the same treatement that normals!
Also, on Cg shaders, you can use the type, float3x3, for rotations.

However, I think that you've watched the skinning theory from NVidia:
http://developer.nvidia.com/object/skinning.html

There it does mention to something about provide bone matrix inverses for fast normal and tangets calculations. What do you think?

Share this post


Link to post
Share on other sites
yes, I read it, the thing i I was wondering if there was a way to skip the inversion of the matrix, as it's pretty expensive. will taking the mere 3x3 upper left part do it?

Share this post


Link to post
Share on other sites
There is no need to invert the matricies per frame. In my engine I simply multiply the normals/tangents/bitangents by the upper 3x3 matrix for each bone and it works splendidly.

Where you DO need to invert can depend on your setup. If you're doing things Doom 3 style (seperate vert for each weight) then you don't need it at all, but if you're doing things the way I do, where you start out with a "bind pose" mesh and skeleton, you do need to do some inverting in the pre-processing. You have your pind pose skeleton, and then the skeleton in the pose you wish to achieve, right? Well, in order to get the verts to rotate around the correct pivot point, you would have to basically undo the bind pose transform, then apply the new posed transform. We can simplify that by instead multiplying the inversed bind-pose matrix by the normal posed matrix, and then multiplying the verticies by the result. The nice thing about this is that you only have to invert the bind pose once, since it never changes. A small price in load time to pay for some really nice animation effects.

Share this post


Link to post
Share on other sites
normals should always be transformed by the inverse-transpose of what you multiply the vertices by....

Simply transforming the normals by the rotation part of a transform matrix is wrong.

Share this post


Link to post
Share on other sites
yes, but in the case of an orthogonal matrix the inverse and the transpose matrices are the same, meaning that the inverse transpose matrix of A is A;

you need to be sure that your worldview matrix is orthogonal, then you should be able to use the simplification (the 3x3 matrix).

Share this post


Link to post
Share on other sites
If your matrix is built from translation, rotation, and uniform scales only (ie: scalex==scaley==scalez), you can use the upper 3x3 of the world matrix.

If you have non-uniform scales, shears, or other strange transformations you'll need to use the inverse transpose of the world matrix.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!