Sign in to follow this  
EnochDagor

OpenGL DirectX version of gl_NormalMatrix

Recommended Posts

Quote:
Original post by Evil Steve
What does gl_NormalMatrix do?

gl_NormalMatrix is the upper-left 3x3 part of the ModelViewProjection matrix (i.e. the rotational-component of the model-space to view-space transform). So multiplying a normal by gl_NormalMatrix transforms the normal into screen space.

Share this post


Link to post
Share on other sites
Quote:
Original post by EnochDagor
What are the other parts to be set to? 0 or 1?


It is a 3x3 matrix, so there are no other parts. If you want to do the same with a 4x4 matrix (which is more expensive to multiply), I believe you can do it by setting the remaining row and column to match the identity matrix:

N N N 0
N N N 0
N N N 0
0 0 0 1


Edit: actually, I am not all that sure about this, it would be great if someone could confirm.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this