Bug (and proposed fix): EffectLayer with meshes using their own materials ignores transparency

  1. Add two meshes to a scene, add both to the glow layer, set both to use their own material (referenceMeshToUseItsOwnMaterial).
  2. Make the meshes partially transparent.
  3. Move the camera so it is looking through transparent parts of one mesh to see the other.
  4. The far-away mesh will lose its glow effect when seen through the transparent parts of the close mesh.

Demo: https://playground.babylonjs.com/#SRZRWV#1139
(Move the camera so that you are looking at parts of one glowing ball through the transparent parts of another ball. Observe that the parts of the far-away ball seen through the close-up ball do not glow.)

I think I have found the bug:

renderingMesh.render(subMesh, hardwareInstancedRendering, replacementMesh || undefined);

should be

renderingMesh.render(subMesh, enableAlphaMode, replacementMesh || undefined);

Happy to run the tests and open a PR with this suggested fix.

1 Like

Since it was just a one-liner I’ve tried a PR with the fix:

1 Like

Thanks a lot for the fix… and I d blame copy paste :wink:

No problem! Thanks for the super-speedy response.

1 Like