Sign in to follow this  

Correctly drawing normals for debugging

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

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

This topic is 686 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.

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