Im doing the learnopengl.com tutorials for lights and have some problems figuring out how to get the position of the light from the lightcomp into my code.
Im passing the normals in worldspace from the vertex shader to the fragment shader for making the calculation in the fragment shader:
- Code: Select all
// Normals
vec3 worldSpaceNorm = normalize(TDDeformNorm(N));
oVert.worldSpaceNorm.xyz = worldSpaceNorm;
// fragment position
oVert.worldSpacePos.xyz = worldSpacePos.xyz;
I then passing the lightposition as an uniform into the shader but how can I pass in the position of the light from the light comp?
I have been reading this:
https://docs.derivative.ca/Write_a_GLSL ... c_Uniforms
but cannot get it right
thanks