GlowLayer effect occlusion problem

I want to use GlowLayer effect for a few meshes in my project. However, the glow effect is not blocked by other meshes.
When I turn on the GlowLayer effect on the DefaultRenderingPipeline, everything seems just fine. But I have emissive materials which don’t want to be glowed.
Is there a problem with my settings?

By the way, the material for glow effect is just a StandardMaterial with emissive color. Nothing else.

cc @Evgeni_Popov

Try to call glowLayer.addExcludedMesh for the meshes that should be occluders, or glowLayer.addIncludedOnlyMesh only for the meshes that should glow if the former does not work.

Thank you for your reply!

I’ve tried both glowLayer.addExcludedMesh and glowLayer.addIncludedOnlyMesh. The occlusion problem was still there.

Then I looked up into the GlowLayer source code. It was as below.

     * Determine if a given mesh will be used in the glow layer
     * @param mesh The mesh to test
     * @returns true if the mesh will be highlighted by the current glow layer
    public hasMesh(mesh: AbstractMesh): boolean {
        if (!super.hasMesh(mesh)) {
            return false;

        // Included Mesh
        if (this._includedOnlyMeshes.length) {
            return this._includedOnlyMeshes.indexOf(mesh.uniqueId) !== -1;

        // Excluded Mesh
        if (this._excludedMeshes.length) {
            return this._excludedMeshes.indexOf(mesh.uniqueId) === -1;

        return true;

So glowLayer.addExcludedMesh and glowLayer.addIncludedOnlyMesh works in the same way. If I choose some certain meshes to return ‘true’ for the ‘hasMesh’ function. And the rest meshes will return ‘false’ which the GlowLayer will do nothing about these meshes. And the occlusion problem will be caused from here, right?

It seems the only way to deal with the occlusion problem is returning ‘true’ for all meshes. But this is not what I want. Do you have any other idea?

Can you setup a small repro in the Playground so that we can see if/how we could fix the problem?

What i did in this case was to specify customEmissiveColorSelector and customEmissiveTextureSelector for the GlowLayer instance. For every mesh which should not glow you need to return black as the emissive color. For the others you return the emissive color of the material.


You Are Great!!!