I’m going through all aspects of my game to make sure they work under DX11 rendering on Unity 4.5.3f3.
One of the last issues remaining is that post effects reading from the depth buffer suffer from huge losses in precision. Here’s a comparison of my faked atmospheric scattering shader on DX9 and DX11.
As you can see I am dealing with huge draw distances, but this hasn’t been a problem on DX9 or OpenGL, just on DX11. Any hints as to what might cause this? I’m out of ideas, myself.
Stripping the shader down until it’s just showing a grayscale gradient based on a depth buffer read still results in the same precision problem:
float depth = Linear01Depth(UNITY_SAMPLE_DEPTH(tex2D(_CameraDepthTexture, i.uv_depth)));
Standard depth based effect such as DepthOfFieldDX11 also show this problem.
For full reference, here’s my shader implementation, which is based on the GlobalFog standard image effect and this article.