What is included?:

What variables are simply included in GLSL? Like the view vector, or do I need to pass that information as a uniform?

You can download the GLSL language document from 3dlabs site. It explains the buit in variables.

There is no built in view vector. If you view vector will change from object to object, then you can use a uniform.

The view vector is either taken as {0, 0, 1}
The eye is infinitly far away at +z.
in this case

   
const vec3 viewVector = vec3(0.0, 0.0, 1.0);

Or from {0, 0, 0} to vertex. The eye is at {0, 0, 0}.

const vec3 eyePos = vec3(0.0, 0.0, 0.0);

void main()
{
  vec3 viewVector = normalize(eyePos- vec3(gl_Vertex));

}

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.