Nme bug about screen depth

Babylon.js Playground (babylonjs.com)

I’ trying to make the mesh into gray and keep the background colorful

I use depth to do this

My programer friend said that it seems there is a bug about sampleing. I dont know.


and he made this


Babylon.js Playground (babylonjs.com)

I’m sorry, but it’s not clear to me what is the bug here. What is the result you expect on your playground?

It looks like adding the below code from the second playground is needed for the SceneDepth block to work properly. Then it looks the same as the NME preview.

let sceneDepth = nodeMaterial.getBlockByName("SceneDepth")
sceneDepth._samplerName = "depthSampler"

oooh thanks for the explanation! @sebavan @Deltakosh any of you have an idea of what might be causing this?

Instead of hard-setting a value here:

we should generate a temporary name in the _buildBlock function (I can’t do a PR right now).

No worries I can take a look :smiley:

Would something like this suffice? Generate sampler name in buildBlock by carolhmj · Pull Request #12913 · BabylonJS/Babylon.js (github.com)