Is depth buffer reversed from z to (1 - z) in unity 5.5?

Hello:
In what’s-new of unity 5.5. I saw:
“Graphics: Improve shadows precision for large game worlds. Use reverse-float depth buffer for improved depth buffer precision on modern GPUs. Particularly improves directional light shadowing for large view distances.”
I have some effect shader that are using depth buffer.
I wonder how the float be reversed.

For example:
In 5.4, I got grab depth like this : float depth = SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, i.uv);
In 5.5, Should I change it to : float depth = 1 - SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, i.uv); ?
Thanks.

I assume that these changes are somehow already incorporated into a macro. Whether that is in SAMPLE_DEPTH_TEXTURE I don’t know. I suggest you search in the built-in shaders for SAMPLE_DEPTH_TEXTURE to see how it is defined. (You can get those at the download archive.)

For more background on what the actual result of it is, you can probably look here:

Yes 1-originalValue will be what you want. There’s a new define for conditionally compiling shaders to do this in a safe way that will work in older versions / super weird hardware…

(including DX9 and older GL)… Metal might be OK but I would go for the define.

SAMPLE_DEPTH_TEXTURE is effectively just a macro for tex2D(_CameraDepthTexture, uv).r, the flip for reversed z is in the LinearEyeDepth and Linear01Depth functions. The real answer to the question is “it depends”. With out any information on how you’re using the raw depth there’s not really a way we can accurately answer the question. However it’s possible you do want to do the one minus, but you should wrap it inside a #ifdef UNITY_REVERSED_Z preprocessor conditional.