useReverseDepthBuffer / ORTHOGRAPHIC_CAMERA lead to Z Order issue

Hello,
I noticed a strange behaviour when I use the useReverseDepthBuffer (as advised Transparent Rendering | Babylon.js Documentation to make my project work on mobile devices) mixed with the camera’s mode is ORTHOGRAPHIC_CAMERA : the object’s z-order is reversed.

Sample Playground

With:

engine.useReverseDepthBuffer = false;

Then, the render is correct

But, with:

engine.useReverseDepthBuffer = true;

Then z-order is reversed

cc @Evgeni_Popov as I am not sure it is supported for ortho projections at the moment ?

It was not supported for orthographic cameras, it will be after this PR is merged:

@etrinh Note however that the reverse depth buffer mode won’t be of any good with WebGL, only with WebGPU. If you want better precision in WebGL you should use logarithmic depth instead.

1 Like

Thank you for the quick and effective fix! :slight_smile: