Variant of estimateFogCoverageFromUV that supports taking a given linear depth
I wrote a proof-of-concept post-processing water shader, but to apply fog to the water surface properly it needs to use the for for a depth value different from the one that the terrain past the water has. OpenMW has enough fog settings that manual fog estimation is nontrivial (hence why this function exists in the first place). I want a built-in fog estimation function that supports this.
Something like this would work:
float estimateFogCoverageFromUVAndDepth(vec2 uv, float depth)
{
#if OMW_RADIAL_FOG
vec3 uvPos = omw_GetWorldPosFromUV(uv);
float dist = length(uvPos - omw.eyePos.xyz);
float dist_a = omw_GetLinearDepth(uv);
dist *= depth / dist_a;
#else
// ... rest of estimateFogCoverageFromUV