[osg-users] basic understanding wrong or my calculation?

Andreas Schreiber ayss at online.de
Sat Apr 18 12:31:52 PDT 2015


Hi,

I am trying to achive a correct light reflection on a water plane.

Before you get bored with my calculations ;), I just want to know if I understood the following correct:

First: 
If I use 
"vec3 viewDirToVertexEC = vec3(gl_ModelViewMatrix * gl_Vertex);"
in the vertex shader, the vector I will get is pointing from camera to vertex! 
Or is it vertex to camera?


Second:
The 
gl_LightSource[2].position.xyz
is this one passed in world coordinate or in eye coordinates.
What I found was eye coordinates, want to get sure.
If its eye coordinates it is the vector from camera to the position of the light, correct?


Third:
To check if two vectors are overlapping I do the dot product of both, but normalize them before. Is the dot product -1 or 1 they overlap correct?

Hope anyone can answer my questions. 
... 

Thank you!

Cheers,
Andreas

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=63467#63467








More information about the osg-users mailing list