Thanks! About the “visible” line, it’s deliberate (that was to show the difference beetween no fog/fog effect)(if you don’t want to have it, you just have to replace:
if (z < 10.0)
{
gl_FragColor = finalColor;
}
else
{
gl_FragColor = mix(color, finalColor, fogFactor);
}
(in the 3 shaders)(z is the distance beetween camera and pixel)
I don’t try to understand maths equations (sometimes but that’s often too complicate and it’s been a long time since I finished school). Just apply it. It’s more a copy/paste work. But each day, I understand one more thing
What I believe I’m surprised about is that the background isn’t affected by the fog… It would add a lot of realism to have that too. And maybe you should try a “blueish” color rather than white (kind of like as in your reference on ozone3d)?
Something strange, though: the parts of leaves that are in front of the ground appear green, but others (in front of the sky) are totally grey, with an abrupt transition…
Yes I don’t know how to fix that… EDIT: No alpha problem when I apply the fog directly on the “sun skybox”… Or if the “sun skybox” is semi transparent and the “fog skybox” is larger than the “sun skybox”.