After further investigation I realized that I did not fix anything with the new Blender export options, I just rotated the issue 90 degrees.
And I think I found something! Here is a barrel illuminated by a red point light with blue specular highlights that is positioned at the camera (like a head mounted light):
Looks OK to me. Highlights seem to be in the correct places and diffuse illumination seems to taper off as it should. The cap of the barrel gets very little light. As we get closer, the cap starts receiving as much light as the sides:
And the second problem case:
The barrel near the boulder is has roughly an uniform light intensity. Neither the sides or the cap do flare up with bright light while the rest remains black. And as we move closer, but on a diagonal path:
Again, seems correct-ish. And finally:
Here the cap of the barrel is almost perpendicular to the light rays so it is darker.
The point light system is of course not meant to only serve as mobile light source and you can also pin it down to a specific position. Here is a shot with the light pinned down somewhere to the left of the camera at a fair distance:
And now let's see the whole illumination scheme in action:
Terrain is not illuminated in that shot by the point light, but otherwise we have the standard directional light that represents the sun, spherical harmonics and a point light. The point lights are meant as an added highlight so they don't do advanced stuff (like another spherical harmonics application). And the shot is very bright, but this is normal. The point lights are meant to illuminate dark scenes. Interiors and caves. Turning on a powerful light in full sunny conditions is not the way you are supposed to explore the world.
And finally a shot with tons of barrels:
I'll consider this issue fixed for now, but my overall confidence in the shaders is very low right now. The original shaders that I've been using were done in a straightforward way, implementing the equations from the Blinn-Phong model and still they did not work correctly. Now I am using similar but different equations that seemed correct to me. They may not be. I will be keeping a very close eye on everything the engine renders for the next two weeks to make sure that at least all major inconsistencies and eye-sores are dealt with.
Meanwhile, I need to add point light support to the terrain and figure out exactly how many point lights I can fit into the shader in a single pass.
A long time ago, when I was far less experienced I tried deferred rendering. I worked fine but I was unable to fine tune it for my needs. Before this point light fiasco, I though about giving it another go. But right now I think this would be a mistake because...