Jump to content
  • Advertisement
Sign in to follow this  
EnochDagor

OpenGL DirectX version of gl_NormalMatrix

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

I was wondering if anyone knows what the equivalent DirectX code is for the OpenGL function gl_NormalMatrix()? Thanks.

Share this post


Link to post
Share on other sites
Advertisement
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
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!