It’s probably more correct to say that you want a depth texture in the fragment shader so you can sample the depth of the scene. Unfortunately, this is not supported with the default materials. Ideally, you render the scene and save the depth information into a texture. A second render pass draws the particles and blends them onto the scene. To do this, you need a custom shader material. The following thread is related to this topic and might be helpful:
Related topics
Topic | Replies | Views | Activity | |
---|---|---|---|---|
Use actual depthBuffer as texture in shader | 2 | 2038 | November 25, 2019 | |
Points transparent textures depth artifacts (soft particles) | 28 | 9114 | April 23, 2023 | |
THREE.SpriteMaterial transparency not working on Shader with Depth Texture | 5 | 437 | August 1, 2023 | |
Soft Particles rendering performance | 3 | 1487 | June 29, 2021 | |
ShaderMaterial.depthWrite with THREE.Points and transparency | 3 | 4007 | June 14, 2023 |