dim3 Forum

Full Version: Shaders and Dim3
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4 5
Kurohyou Wrote:
Quote:Can anybody tell me how to get the light position and the vertex position in the same coordinate system?

Hey Cyst, I'm having the same problem at the moment - can't seem to get the light into eyespace to do the rest of the calculation. This gives the effect of the light being bound to the player somewhat, instead of it being static in the scene.

This is of course providing I have transposed the coords of the vertex into the right coord system - so far I have:

position = gl_Vertex * gl_ModelViewProjectionMatrix;
normal = gl_Normal * gl_NormalMatrix;

but getting the light there is still a problem... is this similar to what you're getting?

That's basically the same problem I was having (the lights move when the camera moves), but I was mostly going at it from the other direction -- trying to get the vertex out of eyespace into what the docs call "dim3 space." That lets me do calculations with the player position and the render position as well as the lights, plus it gives me a consistent value for doing procedural textures.

The code I posted above (5/12 5:44) does that -- if you are using a static or chase camera. For some reason the math is totally different for FPP, and I haven't figured it out.

In any event, I'm pretty sure lighting needs to be done before you use the projection matrix. Projection makes points closer to the camera farther apart, so I think it would seriously screw up the lighting.
Pages: 1 2 3 4 5
Reference URL's