`material.needDepthPass = true` hides the `edgesRenderer` edges behind it

PG:

If I enable material.needDepthPass = true on the sphere’s material.

It hides the edges made by the edges renderer behind it.

Maybe bug? idk

How do I get it to show tho

got it,

by setting depthFunction to ALWAYS

essentially this,
ground.edgesRenderer.lineShader.depthFunction = BABYLON.Constants.ALWAYS;

I have no clue what this does, but it works ig

Beware if there is more stuff going on: https://playground.babylonjs.com/#SXS73H#3 :open_mouth:

1 Like

frick! xD

1 Like

Is it possible that the edge shader does not handle transparency at all? Because whatever props related to alpha I have changed, there is no interaction with the line.

I did want to look it up but I could not find any shader with “*edge*” here :confused:

1 Like

it couldn’t be anything related to the material,
edges renderer uses a ShaderMaterial and this PG

confirms shader material behaves properly : O

but you’re right maybe it just doesn’t care about transparency lol

The problem is that needDepthPass = true first renders the object to the depth buffer, so the lines of the edge renderer won’t be drawn because they are drawn last, after all objects of the scene.

You can try to set renderingGroupId = 1 for the objects with needDepthPass = true:

1 Like

got it! tysm : D

I’m curious tho why edges renderer lines, which are meshes w/ shader material, behave differently than a mesh w/ shader material.

is the “render last” thing an extra optimization that’s added on top?

It’s because they are rendered after everything else.

I think so, that way fewer lines will be drawn if some objects hide them, but it can lead to problems like in your PG. Maybe we should consider making the edge renderer render the lines at other places in the rendering pipeline…

1 Like

I see, I get it now, thank you!