Sign in to follow this  
Viper173

Matrix mess

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
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

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