needDepthPrePass vs renderOutline

repro: Babylon.js Playground

renderOutline doesn’t work when needDepthPrePass = true; What do I need to turn on to get both to work correctly ?

well pumping values into the material depthFunction works. eg: myMaterial.depthFunction = 0x0207; but I have no idea what its doing ? Seems like when the depthFunction is Always/Greater/Greater or equal/not equal, the outline render works. I presume its setting for depth sorting ?

This needs a doc. :frowning:

Changing the depthFunction value may work in the demo scene but it will break depending on how the objects are sorted/the rendering order.

Unfortunately, needDepthPrePass=true and the outline renderer are incompatible, I don’t see a clean way to fix it as they interfere with each other…

A somewhat more dirty way to do it would be to clone the object, mark this clone as needDepthPrePass=true and set material.disableColorWrite:

2 Likes

I see, so they are mutually exclusive. Got it, thanks!