export default /* glsl */ ` #ifdef SOFT_PARTICLES /* #ifdef LOGDEPTH float distSample = linearize_depth_log(sampleDepth, near, far); #else float distSample = ortho ? linearize_depth_ortho(sampleDepth, near, far) : linearize_depth(sampleDepth, near, far); #endif */ vec2 p2 = projPosition.xy / projPosition.w; p2 = 0.5 * p2 + 0.5; float readDepth = texture2D(depthTexture, p2.xy).r; float viewDepth = linearize_depth(readDepth); float softParticlesFade = saturate(SOFT_INV_FADE_DISTANCE * ((viewDepth - SOFT_NEAR_FADE) - linearDepth)); gl_FragColor *= softParticlesFade; //gl_FragColor = vec4(softParticlesFade , 0, 0, 1); #endif `;