float depthBlur(sampler2D sampTex, const int blurRad, float depthData, sampler2D depthTexSmp)
{
    float result = 0.0;
    float totalWeights = 0.0;

    float lindepth = lind(depthData);

    for(int x = -blurRad; x <= blurRad; x++)
    {
        for(int y = -blurRad; y <= blurRad; y++)
        {
            float weight = exp(-abs(lindepth - lind(shortTexFetch(depthTexSmp, ivec2(gl_FragCoord).xy + ivec2(x,y)).r)));
            result += shortTexFetch(sampTex, ivec2(gl_FragCoord).xy + ivec2(x,y)).r * weight;

            totalWeights += weight;
        }
    }

    return result / max(totalWeights, 1e-5);
}