Awesome! Combined with the example in the docs:
vec4 invcamx = INV_CAMERA_MATRIX.x;
vec4 invcamy = INV_CAMERA_MATRIX.y;
vec4 invcamz = INV_CAMERA_MATRIX.z;
vec4 invcamw = INV_CAMERA_MATRIX.w;
mat3 invcam = mat3(invcamx.xyz, invcamy.xyz, invcamz.xyz);
vec3 world_normal = NORMAL * invcam;
vec3 world_pos = (VERTEX - invcamw.xyz) * invcam;
And the knowledge that setting the NORMAL
variable carries to the Lighting shader helped to make a shader that casts light on top of the model regardless of the orientation of the camera:
Fragment:
NORMAL = world_normal;
and the Lighting shader:
LIGHT = vec3(dot(NORMAL, vec3(0,1,0)));