Jump to content
  • Advertisement
Sign in to follow this  
zqueezy

Normal Transformation

This topic is 3941 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

hey folks, well I hope this is my last question for my current project... In my Bone-Mesh-AnimationProgram I have Bones which got vertices assigned. I did the Transformation of the mesh-vertices correct but the normals are freaky. I used: vert_new = pBone->Mtx_final*CurrentVertex*pBone->fWeight + ... I tried using the same Matrix (final) for the normals which didn't work. I read something about the inverse transposed which didn't work either, so here's my first question: Can the weighting system be applied to the normals (like above)??? Or: how do I have to transform the normals? thanx guys

Share this post


Link to post
Share on other sites
Advertisement
Are you using using non-uniform scaling? If you are, then you must use the inverse transpose of your matrix to get the correct normal.

Share this post


Link to post
Share on other sites
Hi,

Be aware that your matrix holds a lot of transformations:
- rotation
rrr0
rrr0
rrr0
0001
- scaling
s000
0s00
00s0
0001
- translation
1000
0100
0010
ttt1

For normals, you only need to rotate them. Getting rid of rtanslation is simple. Scaling is much harder (unless you already know wat are your scaling factors on each axis). This is why you use the inverse transpose matrix to remove the effect of scaling.

Regarding your weighted mesh: when the normals are computed per vertices, you need to apply the weight on your normal transformation and you must normalize your normals later: the sum of all weighted rotated normals on one vertex is not a normalized vector.

Hope that helps.
Ghostly yours,
Red.

Share this post


Link to post
Share on other sites
thanx everybody

yes I had to use the same final-matrix from the bone and erase the translation part (zero-out).
The renormalized normals didn't give a better result than without renormalizing... so I leave it with that.

thanx again folks

Share this post


Link to post
Share on other sites
1) be careful to differentiate transforming a position and transforming a vector. Only use the 4x4 for positions. Only use the 3x3 (no translate, no perspective) on vectors. However normals are SPECIAL vectors. You must use the inverse transpose if your matrix has non-uniform scale in it. In which case be careful how you compute your inverse. You must do the FULL matrix inverse and not use the shortcut of using the transpose as the inverse. The transpose is the inverse only for orthogonal matrices which you do not have (otherwise you will not have to do all these extra work).

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!