[SOLVED] Transparent shader write to depth buffer

I’m trying to write a shader which is completely transparent, only effecting the depth buffer. I’ve tried simply making the value of gl_FragColor to have zero alpha, but then it writes 0 to the depth buffer. Interestingly, increasing alpha seems to effect the depth buffer proportionately. I’ve also tried using the default material, setting opacity map to be invisible, and enabling depth write which also does not write to the depth buffer. All implementations have had depth write enabled.
I’ve done a fair bit of googling on this and have not found anything which seems to allude to a solution, does anyone have any ideas?

To reiterate, essentially I want a custom material which is invisible but still has a normal effect on the depth buffer.


you could also maybe try setting these from the script on a material

this.redWrite = false;
this.greenWrite = false;
this.blueWrite = false;
this.alphaWrite = false;
1 Like

And this topic has a similar request: Use occluder model to hide objects

I tried that before but actually got it working by setting alphaWrite to true, writing alpha as 1.0, and setting redWrite, greenWrite, and blueWrite to false. Thanks!