Order-independent transparency + custom shader + needAlphaBlending = broken shader

You can reuse the existing OIT shader code by using the same #includes than the ones used in the PBR / standard materials. Also, you have to declare the oitDepthSampler and oitFrontColorSampler samplers when you create your material (line 72). To bind the samplers, simply call scene.depthPeelingRenderer.bind(shaderMaterial.getEffect()) (line 80):

3 Likes