# Dealing with normals

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

## Recommended Posts

Hi everyone, I have a set of vertices and normals in my vertex declaration. In the shader, I apply some transformations to the vertices (translation + non-uniform scale). What do I need to do with my normals so they stay correct? I assume all I'd need to do is to apply the scale and normalize them again, is this correct? How would that be done? I was thinking of something like this: normalize(mul((float3x3)world, normal)); Is this correct? The float3x3 is there so I don't take translation into account.

##### Share on other sites
Technically, you should be multiplying your normals by the inverse transpose of the transformations you apply to the vertices. Whatever scale you apply to the model, this applies the inverse scale to the normals. The inverse transpose is the general solution, however you can probably "hack" in a solution that isolates rotation and scaling and does that manually so you don't have the calculate the inverse transpose directly. It's up to you.

##### Share on other sites
I understand what you need inverse matrices for (reversing the transformations), but why is the transposed matrix necessary?

Shouldn't my float3x3 work as well for this particular case where no rotation and shearing is applied?

##### Share on other sites
Quote:
 Original post by FoxHunter2I understand what you need inverse matrices for (reversing the transformations), but why is the transposed matrix necessary?Shouldn't my float3x3 work as well for this particular case where no rotation and shearing is applied?

The reference that S1CA suggests explains everything, but here is the bottom line: the reason you need to compute the inverse transpose is that your transformation includes shearing.

If a transform contains only rotation and translation then the inverse transpose is the same as the original (as far as normals are concerned), so you you don't have to do anything.

If it contains uniform scaling, then you could remove the scaling and use the resulting matrix, or you could use the original and then normalize.

##### Share on other sites
Thanks everyone, I'll take a look at the paper.

1. 1
2. 2
Rutin
25
3. 3
4. 4
5. 5

• 11
• 10
• 13
• 20
• 14
• ### Forum Statistics

• Total Topics
632950
• Total Posts
3009377
• ### Who's Online (See full list)

There are no registered users currently online

×