Jump to content
  • Advertisement
Sign in to follow this  
Viper173

Matrix mess

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

I've problems with calculating distances and normals in my vertex shader. What I want is the global space coord. of my objects. I pass the global light position to the shader, and do gltranslating before passing the modelviewproj matrix to the shader when I draw objects. I thought mul(ModelViewProj, IN.position) would give me the global position of my object in the shader, but it doesn't. not even when I take the ModelView matrix. How do I get those coordinates? LIGHT OBJECT Obj Coordinates global light pos glTranslate ->Shader -> Shader global coord. global coord.? ...so that I can do calculations with the light pos and the obj pos.

Share this post


Link to post
Share on other sites
Advertisement
ahhh, I got it. I just pass another parameter to the shader
to pass any transformations I did before.
That way I get the global space position of my object.

But isn't there a way to do that with the given matrices?

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!