Does anyone know how the "depth pre-pass" option of babylonjs is implemented?

Yes, I implemented it quickly based on your thoughts.

I didn’t expect such a simple method to handle it. I thought it was too complicated at first, and I also studied the weighted average OIT. :sob:

Below is my code:

      let depthMaterial = new MeshStandardMaterial({
        colorWrite: false,
        depthWrite: true,
        transparent: true,
      });
      let _mesh = new Mesh(mesh.geometry, depthMaterial);
      _mesh.renderOrder = -1;
      mesh.add(_mesh);

      material.transparent = true;
      material.opacity = alpha;
1 Like