In most tutorials I see on how to achieve fog with shaders the fog is exponential and has a minimum / start distance from the camera. Why? Both seem counterintuitive, especially the minimum distance. Is this an artistic / design choice or is this how our eyes see fog in real life?
This is a legacy from fixed pipeline fog equations, where you typically had one of three options available:
- Linear blended between a start distance and an end distance.
- Exponential based on density.
- Exponential-squared based on density.
A sample tutorial making reference to these three equations (you can cross-check with the documentation and determine that they are the same).
Using shaders you are of course not restricted to these equations, and you can adapt them, modify them, or write your own as you see fit. However, tutorial material does tend to either emulate the older equations or take them as a starting point, because they are a familiar reference (and early versions of GLSL even provided access to glFog parameters via built-in uniforms). You see the very same with lighting, where tutorials typically follow the old fixed pipeline lighting models too (and likewise early versions of GLSL provided access to lighting state too).
(Interesting aside: fixed-pipeline fog did not support specifying a start distance with exponential fog which suggests that some tutorial authors may not have paid as close attention to the documentation as they could have).