# Learning more about Babylon material plugins

**URL:** <https://forum.babylonjs.com/t/learning-more-about-babylon-material-plugins/31420>\
**Category:** Questions\
**Created:** [June 16, 2022, 8:46am UTC](https://forum.babylonjs.com/t/learning-more-about-babylon-material-plugins/31420 "2022-06-16T08:46:54Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![sairens](https://avatars.discourse-cdn.com/v4/letter/s/b782af/32.png) [@sairens](https://forum.babylonjs.com/u/sairens)\
**Post date:** [June 16, 2022, 8:46am UTC](https://forum.babylonjs.com/t/learning-more-about-babylon-material-plugins/31420/1 "2022-06-16T08:46:54Z")

</div>

I was recently exposed to the material plugins feature that came with Babylon 5.0, and have read through the documentation here [Material Plugins | Babylon.js Documentation](https://doc.babylonjs.com/divingDeeper/materials/using/materialPlugins)

When attempting to add invalid shader code, the entire shader GLSL source is outputted to the browser console, so I’ve been able to get a hold of it that way and have a look at it. I’ve got a couple of questions;

- is there a better way to get the shader code for a Material?

- is there any specific documentation on the process by which this shader code is generated, and how existing Babylon shaders work internally? or will this just require having a look through the Babylon documentation and the source code to piece it all together?

---

<div class="post-metadata">

**Author:** ![Cedric](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/cedric/32/2742_2.png) [@Cedric](https://forum.babylonjs.com/u/Cedric)\
**Post date:** [June 16, 2022, 11:26am UTC](https://forum.babylonjs.com/t/learning-more-about-babylon-material-plugins/31420/2 "2022-06-16T11:26:29Z")

</div>

AFAIK, there is no other way to see, quickly, the code generated. Maybe I’m wrong. ping @sebavan

> is there any specific documentation on the process by which this shader code is generated

Do you have something specific in mind?

---

<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:** [June 16, 2022, 1:56pm UTC](https://forum.babylonjs.com/t/learning-more-about-babylon-material-plugins/31420/3 "2022-06-16T13:56:02Z")

</div>

You can use Spector.js to see the generated code (this is usually how I do it).

MaterialPlugins is an extremely advanced way of customizing materials requiring some knowledge about the framework in any mid/complex scenarios.

The code will definitely be the best way to check what is happening in this case.

---

<div class="post-metadata">

**Author:** ![Blake](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/blake/32/21509_2.png) [@Blake](https://forum.babylonjs.com/u/Blake)\
**Post date:** [June 16, 2022, 4:49pm UTC](https://forum.babylonjs.com/t/learning-more-about-babylon-material-plugins/31420/4 "2022-06-16T16:49:36Z")

</div>

You can also use material.onCompiled to log the shader code after it’s compiled like on line 28.

> **[Babylon.js Playground](https://playground.babylonjs.com/#22HT5Z%2322)**
>
> Babylon.js playground is a live editor for Babylon.js WebGL 3D scenes
