How about adding the possibility to set the depth function per material?
Currently, if you want to change it, you need to add a callback on
mesh.onBeforeRenderObservable to set the value and on
mesh.onAfterRenderObservable to reset the value to what it was before. Also, it allows to change the value on a per mesh basis and not on a per material basis.
As we already have a
disableDepthWrite property, I think it would make sense to also have a
Regarding implementation, I think it would not be complicated and would be much like
Material._afterBind to set the new value (if it is not some default value saying to keep the current in-effect depth function, to not break existing code) and
Material.unbind to reset the value to what it was before binding the material.
I can do a PR if it’s ok.