Jump to content
  • Advertisement
Sign in to follow this  
GeneralQuery

Light transformations

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

When lighting in object space, I transform the world space light position into object space by multiplying by the object's inverse world matrix. However, I read that when lighting in view space, you should transform the world space light position by only the rotational part of the view matrix. Why is this?

Share this post


Link to post
Share on other sites
Advertisement
Where did you hear that? Unless there is a special context behind that statement, I don't think it makes any sense to leave out the translation component (or scaling for that matter) when you are moving a position from world space to object space...

Share this post


Link to post
Share on other sites
Typically the only time you want to ignore the translation component of a matrix is when applying it to a direction vector, such as a normal. For positions you usually apply the translation. For a light position transformed by a view matrix, you definitely want to apply the translation.

Share this post


Link to post
Share on other sites
Ah yes, that makes perfect sense. I did wonder why that would be the case, in my head it did not fit with my understanding of transformations into different spaces. Thanks for clearing that up, guys.

Share this post


Link to post
Share on other sites
If it's a directional light (like the sun), you could just do a rotate-only instead of a full translate/rotate. This would save you from having to renormalize the light vector.

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!