# PBR Node Material Vertex Inputs

**URL:** <https://forum.babylonjs.com/t/pbr-node-material-vertex-inputs/21698>\
**Category:** Questions\
**Created:** [June 15, 2021, 6:36pm UTC](https://forum.babylonjs.com/t/pbr-node-material-vertex-inputs/21698 "2021-06-15T18:36:18Z")\
**Posts on this page:** 15\
**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:** [June 15, 2021, 6:36pm UTC](https://forum.babylonjs.com/t/pbr-node-material-vertex-inputs/21698/1 "2021-06-15T18:36:19Z")

</div>

Hello, and I am using the Node Material with ES 6 tree shaking.

When I attempt to load the material, it fails to build and reports errors about any input or output connections:

Uncaught (in promise) Build of NodeMaterial failed:  
input left from block Displace[MultiplyBlock] is not connected and is not optional.  
input left from block Multiply[MultiplyBlock] is not connected and is not optional.  
input rgba from block FragmentOutput[FragmentOutputBlock] is not connected and is not optional.

It looks as if the mesh information is missing from the NodeMaterialBuildStateSharedData.

Can I attach my mesh manually to the node material? or do I need to load a helper function to properly resolve the scene meshes for the nm?

Robert

---

<div class="post-metadata">

**Author:** ![Deltakosh](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/deltakosh/32/26635_2.png) [@Deltakosh](https://forum.babylonjs.com/u/Deltakosh)\
**Post date:** [June 15, 2021, 8:15pm UTC](https://forum.babylonjs.com/t/pbr-node-material-vertex-inputs/21698/2 "2021-06-15T20:15:10Z")

</div>

Hey!

This means that some blocks which needs to be connected are actually not connected. Can you share your NME? or even better a playground with your node material

---

<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:** [June 15, 2021, 8:35pm UTC](https://forum.babylonjs.com/t/pbr-node-material-vertex-inputs/21698/3 "2021-06-15T20:35:03Z")

</div>

Hey, and the material loads correctly in playground, but here it is for you to look at:

[https://nodematerial-editor.babylonjs.com/#XJ40D9#48](https://nodematerial-editor.babylonjs.com/#XJ40D9#48)

(and thanks)

---

<div class="post-metadata">

**Author:** ![Deltakosh](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/deltakosh/32/26635_2.png) [@Deltakosh](https://forum.babylonjs.com/u/Deltakosh)\
**Post date:** [June 15, 2021, 9:10pm UTC](https://forum.babylonjs.com/t/pbr-node-material-vertex-inputs/21698/4 "2021-06-15T21:10:05Z")

</div>

ok so what is the issue in your code? are you using the same version and all?

---

<div class="post-metadata">

**Author:** ![Deltakosh](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/deltakosh/32/26635_2.png) [@Deltakosh](https://forum.babylonjs.com/u/Deltakosh)\
**Post date:** [June 15, 2021, 9:11pm UTC](https://forum.babylonjs.com/t/pbr-node-material-vertex-inputs/21698/5 "2021-06-15T21:11:21Z")

</div>

Here is a working playground: [Babylon.js Playground (babylonjs-playground.com)](https://www.babylonjs-playground.com/#XC9NH0)

---

<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:** [June 15, 2021, 9:43pm UTC](https://forum.babylonjs.com/t/pbr-node-material-vertex-inputs/21698/6 "2021-06-15T21:43:32Z")

</div>

Hey @Deltakosh , and that is what I have done in my own code:

NodeMaterial.ParseFromSnippetAsync(“XJ40D9#52”, scene).then(material =\> {  
mesh.material = material;  
});

The error only appears when I use an input variable from the mesh (mesh.uv) or the PBRMetallicRoughness (likely because it also uses mesh attributes). Is it possible that it is being stripped out?

Or can I attach the mesh data manually?

---

<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:** [June 16, 2021, 8:31am UTC](https://forum.babylonjs.com/t/pbr-node-material-vertex-inputs/21698/7 "2021-06-16T08:31:19Z")

</div>

Can you provide a PG that fails, as I’m not sure to understand what you mean when you say:

> [@rdurnin](#):
>
> The error only appears when I use an input variable from the mesh (mesh.uv) or the PBRMetallicRoughness (likely because it also uses mesh attributes)

---

<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:** [June 16, 2021, 1:52pm UTC](https://forum.babylonjs.com/t/pbr-node-material-vertex-inputs/21698/8 "2021-06-16T13:52:37Z")

</div>

Hey @Evgeni_Popov , and I will try to put something together this morning, but have been finding the issue outside of playground (using TS and tree shaking).

What I meant in the statement above, is that I have been able to use basic materials ([example](https://nme.babylonjs.com/#BYNH4E#8)) which do not use any mesh attributes (uv, position, normal), but the shader fails to compile when using any of those connections ([example](https://nme.babylonjs.com/#BYNH4E#9)).

It looks like the NodeMaterialBlock is not being connected to my mesh correctly, and I will walk through the calls and see where it is failing. Another thread mentioned changes to the PBRMetallicRoughness in NodeMaterial recently, and I was hoping to hear that the fix was simpler.

Thanks,  
Robert

---

<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:** [June 16, 2021, 8:41pm UTC](https://forum.babylonjs.com/t/pbr-node-material-vertex-inputs/21698/9 "2021-06-16T20:41:26Z")

</div>

Hey @Evgeni_Popov , and here is a link to a project which shows the issue I am having:

> **[rdurnin/DebugBabylonScene](https://github.com/rdurnin/DebugBabylonScene)**
>
> Empty project for sharing debug scenes. Contribute to rdurnin/DebugBabylonScene development by creating an account on GitHub.

I wasn’t able to reproduce the problem in playground, but it is clear in the simple scene I have shared. The scene is wrapped in some webpack and ES 6 code, and will load content which shows issue on start.

Let me know if I need to provide anything else, and thanks again,  
Robert

---

<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:** [June 17, 2021, 11:36am UTC](https://forum.babylonjs.com/t/pbr-node-material-vertex-inputs/21698/10 "2021-06-17T11:36:43Z")

</div>

Your material is using a `ColorMergerBlock` that is not automatically imported, so it seems you need to do it yourself in your code with `import "@babylonjs/core/Materials/Node/Blocks/colorMergerBlock";`.

That seems a bit tedious as you would need to do that for all blocks that you use and that are not imported yet by some other code, but unfortunately I don’t know anything about es6 imports and usage. Maybe @RaananW will know more about that.

---

<div class="post-metadata">

**Author:** ![RaananW](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/raananw/32/28955_2.png) [@RaananW](https://forum.babylonjs.com/u/RaananW)\
**Post date:** [June 17, 2021, 12:43pm UTC](https://forum.babylonjs.com/t/pbr-node-material-vertex-inputs/21698/11 "2021-06-17T12:43:29Z")

</div>

To load all blocks (and lose a bit of tree-shaking abilities) use:

`import "@babylonjs/core/Materials/Node/Blocks"`

This will import the code for all available blocks.

---

<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:** [June 17, 2021, 5:25pm UTC](https://forum.babylonjs.com/t/pbr-node-material-vertex-inputs/21698/12 "2021-06-17T17:25:30Z")

</div>

Thanks @Evgeni_Popov @RaananW

---

<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:** [June 22, 2021, 7:58am UTC](https://forum.babylonjs.com/t/pbr-node-material-vertex-inputs/21698/13 "2021-06-22T07:58:47Z")

</div>

Do I need to import something additional to use Worley Noise? I am not getting any complaining in the console, but no effect from the node is being seen when I try to use it.

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:** [June 22, 2021, 8:36am UTC](https://forum.babylonjs.com/t/pbr-node-material-vertex-inputs/21698/14 "2021-06-22T08:36:36Z")

</div>

Does your material work in the Playground?

If you have no error it should work.

---

<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:** [June 22, 2021, 7:10pm UTC](https://forum.babylonjs.com/t/pbr-node-material-vertex-inputs/21698/15 "2021-06-22T19:10:15Z")

</div>

Hey, and this had a lot to do with scaling issues between the nme and scene implementation. It is working as expected.

r
