• Advertisement
Sign in to follow this  

Matrix mess

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