Disabling depth test stops working

I have a debug node (Line mesh) which I disable/enable by setting cullHint to Never or Always. Material has additionalRenderState.depthTest set to false, as I want it to always stay on the top.
It works fine at start, if it is not culled. When I set cull to Always and then back to Never, depth test is not disabled anymore - lines are being obscured by scene geometry. Setting depthTest again on material to false doesn’t help.
Setting cull to Always and Never in lines next to each other has no bad behaviour - it has to be rendered with Cull Always for at least one frame to get into error state.

Maybe it is something obvious - if not, I can try to cough up some minimal testcase for that.

If it is drawn first then other objects will draw over it, even with depth test false.

Try putting it in the translucent bucket so it is always drawn last.

1 Like

Yes, thanks, it was the problem. Worst thing is that I had to solve same thing year ago in different place and of course forgotten since then…

you can also use a custom geometry comparator, which sets the order in a bucket