# Using Material Blocks in Fragment Shaders

**URL:** <https://forum.babylonjs.com/t/using-material-blocks-in-fragment-shaders/38679>\
**Category:** Questions\
**Created:** [March 2, 2023, 2:17pm UTC](https://forum.babylonjs.com/t/using-material-blocks-in-fragment-shaders/38679 "2023-03-02T14:17:45Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![rdurnin](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/rdurnin/32/11381_2.png) [@rdurnin](https://forum.babylonjs.com/u/rdurnin)\
**Post date:** [March 2, 2023, 2:17pm UTC](https://forum.babylonjs.com/t/using-material-blocks-in-fragment-shaders/38679/1 "2023-03-02T14:17:45Z")

</div>

Hello, and I have found some useful shader code mixed in with the block declarations which I would like to use. It looks like some of the shader block code can be directly included:

```auto
#include<pbrBlockSheen>

```

Is there a way to similarly include the code found in voronoiNoiseBlock.ts?

Thanks,  
r

---

<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:** [March 2, 2023, 2:28pm UTC](https://forum.babylonjs.com/t/using-material-blocks-in-fragment-shaders/38679/2 "2023-03-02T14:28:17Z")

</div>

I’m not sure I understand your question, if you want to reuse the shader code found in the `voronoiNoiseBlock.ts` file you can copy/paste it into your own shader?

If you want this code to be made available to your shader using a `#include<voronoiNoise>` statement, you can assign the code in `BABYLON.ShaderStore.IncludesShadersStore["voronoiNoise"]`.

---

<div class="post-metadata">

**Author:** ![rdurnin](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/rdurnin/32/11381_2.png) [@rdurnin](https://forum.babylonjs.com/u/rdurnin)\
**Post date:** [March 2, 2023, 2:37pm UTC](https://forum.babylonjs.com/t/using-material-blocks-in-fragment-shaders/38679/3 "2023-03-02T14:37:34Z")

</div>

Thanks, and that was what I meant. Is there a listing of all the includes which are available to glsl?

The directory that is mentioned in the docs contains only an implementation for perlin.  
([link](https://doc.babylonjs.com/features/featuresDeepDive/materials/shaders/shaderCodeInBjs#shader-includes))

r

---

<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:** [March 2, 2023, 2:55pm UTC](https://forum.babylonjs.com/t/using-material-blocks-in-fragment-shaders/38679/4 "2023-03-02T14:55:45Z")

</div>

Yes, the directory mentioned in the doc is the right one: [Babylon.js/packages/dev/core/src/Shaders/ShadersInclude at master · BabylonJS/Babylon.js · GitHub](https://github.com/BabylonJS/Babylon.js/tree/master/packages/dev/core/src/Shaders/ShadersInclude).

We do not have an implementation of Voronoi here. The code in `Shaders/` and `ShadersInclude/` is code used internally by Babylon.js and not general code that could be used by users, although they can still use it of course! But we cannot guarantee that we will not change the structure of the files / that we will not change the code in a breakable way (these files are not covered by Babylon’s “no breakable change” policy).
