#### Archived

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.

## 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 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).

-Nik

##### 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

1. 1
2. 2
3. 3
Rutin
18
4. 4
JoeJ
14
5. 5

• 14
• 10
• 23
• 9
• 32
• ### Forum Statistics

• Total Topics
632631
• Total Posts
3007528
• ### Who's Online (See full list)

There are no registered users currently online

×