setDepthWrite blocks depth clearing between rendering groups

Hello!

I’ve found a potential bug with engine.setDepthWrite and onBeforeRenderingGroupObservable.

In the following PG setting engine.setDepthWrite(false) in onBeforeRenderingGroupObservable has the same effect as scene.setRenderingAutoClearDepthStencil(1, false) and I don’t understand why so I guess it’s a bug, or is there something that I’ve missed?

Please see comments in PG.

Thanks!

In WebGL, the depth write state also influences the depth buffer clearing: if the state is false, the depth won’t be cleared because it won’t be written (because depth write is disabled).

1 Like

Ah ok, then it does make sense, thanks for the clarification! :slight_smile: