To render a scene with diffuse image-based lighting, the process is fairly simple. We simply need to read from our diffuse map using the normal vector.
The vertex shader just converts the position and normal to world coordinates and passes them along:
// Input attributes...out vec3 Position; // world coordsout vec3 Normal; // world coords.out vec2 TexCoord;// Matrix uniforms ...void main() { TexCoord = VertexTexCoord; Position = (ModelMatrix * vec4(VertexPosition,1)).xyz; Normal = normalize( ModelMatrix * vec4(VertexNormal,0) ).xyz; gl_Position = MVP * vec4(VertexPosition,1.0);}
The fragment shader then uses the diffuse convolution map to determine the value of the integral, multiplies it by a color taken from a texture map, ...