PBR Node Material Vertex Inputs

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?



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

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


(and thanks)

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

Here is a working playground: Babylon.js Playground (babylonjs-playground.com)

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?

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

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) which do not use any mesh attributes (uv, position, normal), but the shader fails to compile when using any of those connections (example).

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.


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

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,

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.

1 Like

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.


Thanks @Evgeni_Popov @RaananW

1 Like

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.


Does your material work in the Playground?

If you have no error it should work.

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


1 Like