how to reverse z buffer

how to reverse z buffer,since modern gpu use reverse eg metal,and i have an asset that the shader require depth buffer,so how can i forcefully reverse it on shader.and also,if possible,use the new depth mode on old gpu,instead of just reverting it

1-depth if it’s normalized, assuming you meant depth buffer.

If you’re using any of the built in macros for the depth to convert it into linear 0.0 to 1.0 depth or linear eye depth, those all handle the difference between reversed and non-reversed depth for you.

It’s relatively rare you use the raw depth by itself. Depending on how it’s being used, 1-depth may or may not be enough.

1 Like