Material plugin with glowlayer

PG: Babylon.js Playground
Glowlayer is using its own shader to create the glowmap so it can’t catch the shader code from material plugins. I dig into the source code but find it hard to solve the problem with some clean hack.
It seems that material plugin is not desined for the situation :rofl:, but I relied too much on it.

Indeed, it’s not possible to use material plugins for the reason you stated.

Reworking the effect layer code is something we discussed in the team, so maybe all is not lost for you :wink:


Material plugin is really a strong function so I can’t stop using it since update to 5.0, I will create shaderMaterials for generating the glow map to keep using plugins, hope it can be used anywhere as will one day.
And is reworking the effect layer in schedule now?

There is no timeline at this time as there may be some show stopper. We still need to do some research on this.

Waiting for that!

Hey @tanpopo I’m having the same problem; If you solved this yourself do you mind sharing your hack :sweat_smile: ?

Only a few meshes with material plugin in my project will glow, so I use setMaterialForRendering and some shaderMaterials to solve the problem, not sure if it works for you.

I ended up copy pasting GlowLayer.ts into CustomGlowLayer.ts and replaced all emissiveTexture and emissiveColor references to the specific texture I wanted to glow

why not using customEmissiveTextureSelector and customEmissiveColorSelector from the glow layer if it is to have only one color and texture ?

I needed two different glow layers; one of a specific color & strength on the emissiveTexture and another on a second specific texture;

It should still be ok I guess as you can differentiate per mesh and such in the callback ?

Yeah that should be fine, however I had a single mesh :sweat_smile:

Are you willing to share your glow shader solution @tanpopo ?

Actually, why setMaterialForRendering doesn’t solve the problem?

1 Like

I use setMaterialForRendering with shadermaterial

1 Like