Jump to content
  • Advertisement
Sign in to follow this  
AIRmichael

Rotate normals without "reuseing" vertices

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

Advertisement
Could you be a bit more detailed in what you want to do?

Do you want to calculate the Normals of a model, without looking at the individual vertices?

Share this post


Link to post
Share on other sites
I already have the normals of that model.

Now i want to change/rotate the normals as like the model itself has been rotated without having to use all vertex matrix data again to accomplish this.

Share this post


Link to post
Share on other sites
What 3D API are you using? OpenGL, DirectX?

Well, under OpenGL (and I guess DX3D too, why would it be diferent), once you define the model, it's vertices, it's normals, texture coordinates, vertex colors, etc, if you rotate the model, the vertex normals rotate with it, so there is no need to run the normals through a rotation/transformation matrix.

But, if you are coding your own renderer, or using a software based one, then perhaps you do need to pass the normals through the matrix...

Another advice I can give you is that the quality of the responses you get here on the forums is proportional to the way you ask your questions, so please try to explain what you're trying to accomplish in as much detail as possible, if you want better responses...

Share this post


Link to post
Share on other sites
Transforming vectors is different from rotating vertices.
I assume here that you already have a 4x4 transformation matrix (containing the rotation you want). To use that matrix to rotate a (normal-)vector, you'll first have to calculate it's inverse. From the inverse matrix you calculate the transposed matrix. You can rotate vectors by multiplying them with that transposed matrix.

Tom

Share this post


Link to post
Share on other sites
Quote:
Original post by dimebolt
Transforming vectors is different from rotating vertices.
I assume here that you already have a 4x4 transformation matrix (containing the rotation you want). To use that matrix to rotate a (normal-)vector, you'll first have to calculate it's inverse. From the inverse matrix you calculate the transposed matrix. You can rotate vectors by multiplying them with that transposed matrix.

Tom


Agreed. And, if you know you have no scaling you can skip the 'inverse + transpose 3x3' part and directly apply the upper 3x3 rotation matrix of your 4x4 model matrix.

If you have scaling, you can simply scale the upper 3x3 rotation matrix by the inverse scale of your model but this can get (moderatly) nasty if you work in a hierarchy.

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!