I am trying to use a custom shader and THREE.ShaderMaterial for a particle system. It is working but I would like to be able to setup a depth test like in the the built in points material shader. I have been searching around and looking from the default shaders but I am a bit stuck on this.
Basically, if the particles go behind another object I need them to be hidden by that object. Could anyone point me in the right direction for this?
THREE.ShaderMaterial is derived from THREE.Material and thus has a depthTest and depthWrite property. Both are set to true by default.
This should happen by default if the object is opaque assuming you are not changing the above properties. Can you please demonstrate with a live example how your use case looks like?
Thanks for the quick reply… I think it may have been to do with the fact that the object wasnt opaque… anyway since posting I have remade the shaders from scratch starting with the points shader and it seems to be working…