View Full Version : Getting Eye direction vector

09-19-2013, 06:16 PM
Hello, I'm trying to draw some water in modern OpenGL (greather than 3.x).
I've got model matrix, view matrix and projection matrix uniforms and my positions' attribute. The problem is: how can I get the eye direction vector?
Thanks in advance.

09-20-2013, 02:49 AM
how can I get the eye direction vector?
The eye position is 0,0,0 in eye space, which is what the model-view matrix transforms to. So after you've transformed the vertex position by the model-view matrix, the eye direction is simply the negation of the transformed vertex position (ignoring the w coordinate, which should be 1; the model-view matrix shouldn't contain any projective transformations).

09-20-2013, 10:05 PM
Thanks. The error was that I've negated the entire output vertex including w coord.