searching for GLSL documentation

Is there any good GLSL documentation to learn about shader spaces (model, world, normal, tangent), vectors (belonging to each space), and how to use matrices to move between diferent spaces?
The formal documentation lists names of vectors and matrices but it is not possible to guess in wich space are defined each one, so is very dufficult to use them without mixing different spaces.

Thanxs a lot,
SL

hah --how Ironic… I was going to make a post this morning asking exactly the same question…

I’ve been working on a new ocean shader with waves that fade out towards the ocean wih floating objects… got the floating working but the waves and movement from GLSL appear to be working locally and not globally…they also appear to be applied using the objects pivot point as the center…so if you scale the object or move it off it’s center pivot it the effect respectively… I need to make them work globally for the effects I want… I’m not even sure that is possible…

I would change the name of your thread to include some of your questions about matrixes and co-oridinate spaces…

This is quite a complex area, if you’ve done anything with plain OpenGL it’ll help. I would suggest looking at the OpenGL red book for an overview of the pipeline, that’ll help understand which matrices are involved etc (http://www.glprogramming.com/red/). It only covers OpenGL 1.1 (no shaders) but the info’s still useful.

Basically, your model data (gl_Vertex, gl_Normal etc.) are in local object space. Lights are in view space. The gl_ModelViewMatrix gets you from model to view space (the inverse matrix goes the other way). So to get the light vector in view space you do something like:

vec4 vVtx = gl_ModelViewMatrix * gl_Vertex; //<- transform vertex to view space
vec4 vLight = gl_LightSource[0].position - vVtx; //<- vector from vertex to light

Note that’s off the top of my head so might be syntatically wrong. Hope that’s a useful starting point.

Piran