the variable albedo.rgb is updated with the color of the LightMap but seems never to be used again
By modifying this:
gl_FragColor.rgb = vec3 (0.0);
by
gl_FragColor.rgb = albedo.rgb;
This gives a better result, the lightmap is visible even on a material with a Metalliic factor at 0.
I’m not a specialist shaders, I do not know much, I do not know if this change has repercussions on the behavior of the shader. But the first tests seem good. We should continue to test
And no, gl_FragColor.rgb has to be initialized with 0, because light information will be accumulated in it later. Initializing it with the albedo is wrong.
I’ll look into it.
Another question, I had found that already with the shader Lighting. When a light (spotlight) illuminates a shadow of a lightmap,
in reality, the light should illuminate the area in the shade and the color of the texture should be visible.
This was not the case in the Lighting shader.
In this case (PbrLighting), the spot light illuminates the area in the shade but it is still relatively dark.
Well… technically a light map should be considered as another light source and it’s contribution should be added to the final color.
Only if it’s meant as an ao map it should be multiplied.
It’ son purpose, AO is supposed to darken lighting.
Here you have a lightmap, so don’t use it as an AO map.
Though maybe AO should only apply on indirect lighting…
As for the first video, it’s how it’s supposed to be, it’s not the shadowed area that is darker it’s actually the lighten area that is brighter.