I'm trying to fake cheap-ass ground fog. I made my own version, but it has problems, which I don't understand.
Since math and physical activity are things I'll get to - eventually; I might as well ask for some help.
This is my own version:
float foglen = max(0.0, fogTopY - point.y) / max(0.1, pointDir.y);
The double max() was a signal to me that things were not done correctly.
pointDir is the direction vector from camera to a point in world.
point is the points world coordinates.
fogTopY is the top of the fog plane, and point.y is the bottom of the fog plane. (when travelling)
Both planes' normals can be assumed to be vec3(0, 1, 0)
I'm already using math-fu to smooth the top and bottom of the fog.
Still, my equation does work, but I'm wondering if there's anything wrong with it.