What formula correlates the camera's view distance to a particular fog density?

I imagine these are the same as the old fixed function OpenGL pipeline, which I believe are as follows:

Linear: f = inverse_lerp(fog_start_distance, fog_end_distance, distance) Exp: f = exp(-fog_density * distance) Exp2: f = exp(-(fog_density * distance) ^ 2) f = clamp(f, 0.0, 1.0) C = f * Cr + (1.0 - f) * Cf where: f is fog factor C is resulting fragment color Cr is original fragment color Cf is fog color