Issue with Highlight Layer and Newly Added Meshes

Hello, in the process of using HighlightLayer , I excluded a mesh with addExcludedMesh . While the glowing edges of an obscured mesh are displayed correctly, for new meshes that are highlighted and then obscured, the illumination shifts from the edges to the entire surface area of the mesh.
I’ve managed to replicate this issue in the Playground.:

The highlight layer relies on the stencil buffer, and the order in which the meshes are drawn matters. In your case, the ground must be rendered last. One way would be to set the renderingGroup property of the ground to a value greater than the one used by the other meshes (like 1, as 0 is the default), or to make sure that the material uniqueId property of the sphere is lower than the ground material uniqueId (meshes are sorted by material id before being displayed):

1 Like

Thanks so much for the solution! Really appreciate your help.