Jump to content
  • Advertisement
Sign in to follow this  
edwinnie

MVP IT

This topic is 5220 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
Advertisement
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
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!