To compute the fog color, we should use an equation that allows us to define the way fog density behaves according to the distance between the camera and a given vertex. The aim of this equation is to compute a fog factor that will allow to mix the fragment color with the fog color. Vanda Engine 1 uses exponential method, because of its more realistic fog rendering possibilities.
fogFactor = e^(-(density * z)^2)
z is the distance between the camera and the currently processed vertex.