Sign in to follow this  

MVP IT

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

hihi! i was wondering when do we need to apply model view projection inverse transpose matrix to the lighting?? vertex lighting?? or fragment lighting?? or both also should need?? thx! Edwinz

Share this post


Link to post
Share on other sites
Vertex lighting is computed using the normal of the vertex, the vertex position, and the light position (and in some cases, camera position). This is usally computed after applying the world tranform to the mesh, but before applying the view and projection transforms. You can also multiply the light position by the inverse of the world transform matrix, compute the vertex colors, then apply all the transforms (world, view, projection) together to the mesh. Just make sure there are no problems if you use scalling (as this causes either the normals to change lengths, or attenuation/intensity to increase or decrease, depending on the approach).

As for fragment lighting, I don't know.

Share this post


Link to post
Share on other sites
As for fragment lighting, you use a TBN matrix to transform the light vector into tangent space, and perform the N.L calculations there.

As for your question, what do you mean by "apply <matrix> to the lighting?".

Share this post


Link to post
Share on other sites

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