Clipping Plane has no effect on a mesh's glow in a Glow Layer (unsure if this by design or this is a bug)

If I clip a mesh whose material has an emissiveColor and the scene has a Glow Layer, the glow around the mesh still shows as if the whole mesh is not clipped. See simple playground:

Based on this issue: Per mesh clipping planes issue, Clipping Planes seem more based on the material vs. the mesh, so I would think that when the material is clipped, the emissiveColor used to render the glow in the Glow Layer would be clipped as well. (I also found out the hard way that if you call freeze() on a material before applying a Clipping Plane, the mesh is NOT clipped - Don’t know if that should be mentioned in the tutorial Docs as well).

If what is happening is “by design” is there a way to clip the glow as well? Am I just missing some config/setting? If this is a bug, can it be fixed?

It is currently not supported but should not be to hard to add (I hope :-)) I ll see if I can do it tonight.

Thanks sebavan!

This is really make or break for the game I am developing, so the sooner the better!

I am making a survival-like game where player has to avoid guards in dark maze like map. The way the guards “see” the player is by shinning their flashlight on them. I was originally using spot lights but ran into issues with number of lights BabylonJs supports simultaneously (each guard needs 1 light and had like 30+ guards). Now my solution is a cone shaped mesh with really low alpha and bright glow (which actually looks better than a spot light due to seeing the hazy glow of the whole cone of “light”, not just where the spot light hits the ground and the walls). Issue I am having and reason why I want to use Clipping Planes is to clip these cones when they hit things like corners or get really close to a wall. I don’t want player to see the cone on the wrong side of the wall and meshes pass right through each other. While the clipping works perfectly without the Glow Layer, the Glow Layer is what really sells that it’s a “light” vs a mesh.

Thanks again!

This will be available after this reaches master: Add support of clipplanes in GlowLayer by sebavan · Pull Request #12925 · BabylonJS/Babylon.js · GitHub

You will need to change your pg slightly to : Babylon.js Playground to ensure the clip planes are also set in the glow layer for the sphere.

1 Like