Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


How to use this function - D3DXVec3TransformNormal???

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

Hi~Guys~ I have a problem of using the D3DX funtion - D3DXVec3TransformNormal. This funtion could transforms the 3-D vector normal by the given matrix. Because I don''t have enough knowledge of this operation, I don''t know how to set the given matrix. Could anyone tell me the knowledge of this operation or where to find relational information about it??? Thanks!!!

Share this post

Link to post
Share on other sites
Read up on rotation transformation in the sdk, and play with the D3DXMatrix* functions to make matrices.
When you understand the basic transformations, i suggest that you write your own, small matrix math library (for the sake of learning).


Share this post

Link to post
Share on other sites
Yup, I agree with Nik02 - it''s advisable to learn the maths and graphics theory separately to the API.

Normals are different than vertex positions in that they always have their origin at 0,0,0 (i.e. they don''t have a position) and they shouldn''t be scaled or skewed.

For this reason, when transforming normals:

1. You shouldn''t apply any translation.
2. You shouldn''t apply any scales or skews.

If your matrix *doesn''t* have any scales or skews, then you can simply transform the normal by the top left 3x3 portion of the matrix.

If your matrix *does* have any scales or skews then you should use the inverse transpose of the top left 3x3 portion of the matrix (i.e. invert it then transpose it)

For a full mathematical breakdown of why the inverse transpose is used, and other properties of normal transformation, check out Ken Turkowski''s classic "Properties of Surface-Normal Transformations" paper at: http://www.worldserver.com/turk/computergraphics/NormalTransformations.pdf

Simon O''Connor
3D Game Programmer &
Microsoft DirectX MVP

Share this post

Link to post
Share on other sites

  • 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!