# Material plugin with glowlayer

**URL:** <https://forum.babylonjs.com/t/material-plugin-with-glowlayer/36523>\
**Category:** Questions\
**Created:** [December 13, 2022, 11:39am UTC](https://forum.babylonjs.com/t/material-plugin-with-glowlayer/36523 "2022-12-13T11:39:19Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![tanpopo](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/tanpopo/32/32025_2.png) [@tanpopo](https://forum.babylonjs.com/u/tanpopo)\
**Post date:** [December 13, 2022, 11:39am UTC](https://forum.babylonjs.com/t/material-plugin-with-glowlayer/36523/1 "2022-12-13T11:39:19Z")

</div>

PG: [Babylon.js Playground](https://playground.babylonjs.com/#YDNN9K)  
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 🤣, but I relied too much on it.

---

<div class="post-metadata">

**Author:** ![Evgeni\_Popov](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/evgeni_popov/32/4432_2.png) [@Evgeni\_Popov](https://forum.babylonjs.com/u/Evgeni_Popov)\
**Post date:** [December 13, 2022, 11:42am UTC](https://forum.babylonjs.com/t/material-plugin-with-glowlayer/36523/2 "2022-12-13T11:42:20Z")

</div>

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 😉

---

<div class="post-metadata">

**Author:** ![tanpopo](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/tanpopo/32/32025_2.png) [@tanpopo](https://forum.babylonjs.com/u/tanpopo)\
**Post date:** [December 13, 2022, 11:53am UTC](https://forum.babylonjs.com/t/material-plugin-with-glowlayer/36523/3 "2022-12-13T11:53:41Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![Evgeni\_Popov](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/evgeni_popov/32/4432_2.png) [@Evgeni\_Popov](https://forum.babylonjs.com/u/Evgeni_Popov)\
**Post date:** [December 13, 2022, 12:24pm UTC](https://forum.babylonjs.com/t/material-plugin-with-glowlayer/36523/4 "2022-12-13T12:24:21Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![tanpopo](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/tanpopo/32/32025_2.png) [@tanpopo](https://forum.babylonjs.com/u/tanpopo)\
**Post date:** [December 13, 2022, 12:30pm UTC](https://forum.babylonjs.com/t/material-plugin-with-glowlayer/36523/5 "2022-12-13T12:30:17Z")

</div>

Waiting for that!

---

<div class="post-metadata">

**Author:** ![Benjythebee](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/benjythebee/32/13587_2.png) [@Benjythebee](https://forum.babylonjs.com/u/Benjythebee)\
**Post date:** [February 2, 2023, 6:06am UTC](https://forum.babylonjs.com/t/material-plugin-with-glowlayer/36523/6 "2023-02-02T06:06:11Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![tanpopo](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/tanpopo/32/32025_2.png) [@tanpopo](https://forum.babylonjs.com/u/tanpopo)\
**Post date:** [February 3, 2023, 12:56am UTC](https://forum.babylonjs.com/t/material-plugin-with-glowlayer/36523/8 "2023-02-03T00:56:06Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Benjythebee](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/benjythebee/32/13587_2.png) [@Benjythebee](https://forum.babylonjs.com/u/Benjythebee)\
**Post date:** [February 3, 2023, 10:43pm UTC](https://forum.babylonjs.com/t/material-plugin-with-glowlayer/36523/9 "2023-02-03T22:43:13Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![sebavan](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/sebavan/32/57_2.png) [@sebavan](https://forum.babylonjs.com/u/sebavan)\
**Post date:** [February 5, 2023, 5:05pm UTC](https://forum.babylonjs.com/t/material-plugin-with-glowlayer/36523/10 "2023-02-05T17:05:37Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Benjythebee](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/benjythebee/32/13587_2.png) [@Benjythebee](https://forum.babylonjs.com/u/Benjythebee)\
**Post date:** [February 6, 2023, 5:23pm UTC](https://forum.babylonjs.com/t/material-plugin-with-glowlayer/36523/11 "2023-02-06T17:23:05Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![sebavan](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/sebavan/32/57_2.png) [@sebavan](https://forum.babylonjs.com/u/sebavan)\
**Post date:** [February 7, 2023, 2:53pm UTC](https://forum.babylonjs.com/t/material-plugin-with-glowlayer/36523/12 "2023-02-07T14:53:06Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Benjythebee](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/benjythebee/32/13587_2.png) [@Benjythebee](https://forum.babylonjs.com/u/Benjythebee)\
**Post date:** [February 7, 2023, 6:35pm UTC](https://forum.babylonjs.com/t/material-plugin-with-glowlayer/36523/13 "2023-02-07T18:35:22Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![inteja](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/inteja/32/22553_2.png) [@inteja](https://forum.babylonjs.com/u/inteja)\
**Post date:** [February 25, 2023, 10:52pm UTC](https://forum.babylonjs.com/t/material-plugin-with-glowlayer/36523/14 "2023-02-25T22:52:04Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Evgeni\_Popov](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/evgeni_popov/32/4432_2.png) [@Evgeni\_Popov](https://forum.babylonjs.com/u/Evgeni_Popov)\
**Post date:** [February 26, 2023, 12:00pm UTC](https://forum.babylonjs.com/t/material-plugin-with-glowlayer/36523/15 "2023-02-26T12:00:10Z")

</div>

Actually, why `setMaterialForRendering` doesn’t solve the problem?

---

<div class="post-metadata">

**Author:** ![tanpopo](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/tanpopo/32/32025_2.png) [@tanpopo](https://forum.babylonjs.com/u/tanpopo)\
**Post date:** [February 27, 2023, 10:47am UTC](https://forum.babylonjs.com/t/material-plugin-with-glowlayer/36523/16 "2023-02-27T10:47:16Z")

</div>

I use `setMaterialForRendering` with shadermaterial
