Sign in to follow this  

Curious about calculating normals in an animated mesh...

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

If I understand it correctly, most skeletal animation these days is done with vertex shaders. If that's the case, I wonder how the vertex normals are calculated for lighting purposes. If a vertex normal is typically the average of the face normals surrounding it, how is the vertex shader able modify the positions of the vertices without invalidating the vertex normals? And if it doesn't, how does the vertex shader know how to recalculate the vertex normals if it doesn't have access to information concerning the surrounding faces?

Share this post


Link to post
Share on other sites
I guess I should've learned more about skeletal animation before I asked this question. I know that each bone has a position, and that a full matrix can be calculate for each bone depending on its position relative to other bones in the hierarchy. I'm guessing that what you are suggesting is that I transform the vertex by that matrix, and then transform the normal by the inverse transpose of that matrix?

A lot of questions come to mind. For instance, even if the vertex in question is 100% weighted to a specific bone, isn't it true that a nearby vertex on an adjacent face might be assigned to a different bone, thereby messing up the normal even if I use the inverse transpose as you suggested?

Share this post


Link to post
Share on other sites
Quote:
Original post by CDProp
I'm guessing that what you are suggesting is that I transform the vertex by that matrix, and then transform the normal by the inverse transpose of that matrix?
Yes, that sounds right.

Quote:
Original post by CDProp
For instance, even if the vertex in question is 100% weighted to a specific bone, isn't it true that a nearby vertex on an adjacent face might be assigned to a different bone, thereby messing up the normal even if I use the inverse transpose as you suggested?
Yes, that sounds like a possibility, but I suspect this situation would be an intentional 'crease' where you'd want a sudden change. If you want smooth skinning/normals then you'd have them assigned to the same bone with appropriate weights. Check with a modelling artist if you can [smile]

hth
Jack

Share this post


Link to post
Share on other sites

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