Jump to content
  • Advertisement
Sign in to follow this  
Demx

Correctly drawing normals for debugging

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

Hello,

 

I had to draw the normals of an object for debugging purposes and encountered a problem:

 

I have the calculated the normal lines with the formula, Line = (Vertex_Pos, Vertex_Pos + N)

 

Now, if I scale the object, how can the normals be adapted keeping the length of 1 ? Right now I'm applying to the normals the same model matrix I apply to the object .. the result is if I apply a scale of 2 the normals will also be drawn with twice the length.

 

Thanks.

Edited by Demx

Share this post


Link to post
Share on other sites
Advertisement
Get the scale vector and pre-multiply your normal with its inverse: Line = (Vertex_Pos, Vertex_Pos + N*inverse(scale))

Share this post


Link to post
Share on other sites

Get the scale vector and pre-multiply your normal with its inverse: Line = (Vertex_Pos, Vertex_Pos + N*inverse(scale))

 

Thanks for the reply.

 

So if I wanted to update the normal lines in real time I would have to recalculate all the vertexes each frame ?

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!