depthFunction (materials) might need a bit of a cleaning in doc and playground

This is not really a bug but close to it (so I put it here).
This morning I was looking at how to set ‘always’ for depthFunction on a PBR Material. It appeared this solution matched my issue with alpha/depth sorting of two spheres I want to turn into a holographic FX.


  1. First, went to the doc, searched for ‘depthFunction’ and found mostly only results from the API.

  1. Went to the API and found that it is ’ Inherited from BackgroundMaterial.depthFunction

  2. Went to BackgroundMaterial and (first problem) it’s still marked as ‘inherited from BackgroundMaterial’. Which is not logical since I am in class ‘BackgroundMaterial’

  1. It says the value is a number, so I assumed that in order of display, the number should be going from 0(default), incremented by 1 for the other options. So I tried 1, 2, … nothing. I finally found from recording from the PG that the value for always is 519? May be not even constant, I don’t know, but this value worked for me. So, the issue here is that I found no explanation in the doc for this (regarding materials)

  2. From the API, you can open PG examples which can be handy. However in this case of searching ‘depthFunction’, I have been throwed 2968 links which are obviously not something you want. I’m not sure what they are exactly. Didn’t spend more time investigating, I’ll let you do that. But I’m pretty sure we don’t want them here.

cc @RaananW and @PirateJC

1 Like

@mawa thanks for flagging this.

@RaananW - from what I can tell here, it looks like we might need to make some updates/clarifications in the actual API documentation? Thoughts?

I’ll have to check why the inheritance isn’t set correctly. It might be related to the typedoc version we are using but i’ll only know after investigating.

1 Like

Hey @RaananW have you had an opportunity to take a look at this? :slight_smile:

why, yes I did. This requires an update to typedoc, which requires in turn a relatively large change in our documentation architecture (as the two versions are not back-compat).

I have a local branch with the latest typedoc already working, but there are still a few changes that I need to do to get it to work correctly.


Long time, but I finally found the time to do it. typedoc was updated, and it works as expected:

BackgroundMaterial | Babylon.js Documentation (

1 Like

Awesome. Thanks for the effort. It wasn’t urgent or important but it’s always good to see it clean and that even ‘boring’ topics such as this one are also followed and considered. You did great, once more. Have a nice day :sun_with_face: :sunglasses: