# Help need with NME material

**URL:** <https://forum.babylonjs.com/t/help-need-with-nme-material/47225>\
**Category:** Questions\
**Created:** [January 15, 2024, 1:11pm UTC](https://forum.babylonjs.com/t/help-need-with-nme-material/47225 "2024-01-15T13:11:15Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Biscuit](https://avatars.discourse-cdn.com/v4/letter/b/f17d59/32.png) [@Biscuit](https://forum.babylonjs.com/u/Biscuit)\
**Post date:** [January 15, 2024, 1:11pm UTC](https://forum.babylonjs.com/t/help-need-with-nme-material/47225/1 "2024-01-15T13:11:15Z")

</div>

Hey, we made a material with the help of the NME.([material](https://nme.babylonjs.com/#TXHNNA#28))  
I saved it as json, uploaded to server, and from there I’m trying to get it like this

```auto
 async loadNodeMaterial(name: string, url: string, scene: Scene) {
    return await NodeMaterial.ParseFromFileAsync(name, url, scene).then((material) => {
      console.log(material);
    });
  }

```

but I have this error in console

```auto
Build of NodeMaterial failed:
input transform from block WorldPos[TransformBlock] is not connected and is not optional.
input rgba from block FragmentOutput[FragmentOutputBlock] is not connected and is not optional.

```

Any help is welcome. THanks

---

<div class="post-metadata">

**Author:** ![labris](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/labris/32/12576_2.png) [@labris](https://forum.babylonjs.com/u/labris)\
**Post date:** [January 15, 2024, 1:45pm UTC](https://forum.babylonjs.com/t/help-need-with-nme-material/47225/2 "2024-01-15T13:45:08Z")

</div>

The similar code works here - [Babylon.js Playground](https://playground.babylonjs.com/#APVSUF)  
Did you try to load any another Node material json?

---

<div class="post-metadata">

**Author:** ![Biscuit](https://avatars.discourse-cdn.com/v4/letter/b/f17d59/32.png) [@Biscuit](https://forum.babylonjs.com/u/Biscuit)\
**Post date:** [January 15, 2024, 1:58pm UTC](https://forum.babylonjs.com/t/help-need-with-nme-material/47225/3 "2024-01-15T13:58:21Z")

</div>

Yep, all good here, I saved it as json and load in pg and all good. I have no ideea

---

<div class="post-metadata">

**Author:** ![labris](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/labris/32/12576_2.png) [@labris](https://forum.babylonjs.com/u/labris)\
**Post date:** [January 15, 2024, 2:26pm UTC](https://forum.babylonjs.com/t/help-need-with-nme-material/47225/4 "2024-01-15T14:26:45Z")

</div>

Probably you’ll need to remake your function.  
I am not sure if you need to use `then` when using `await`.

---

<div class="post-metadata">

**Author:** ![Biscuit](https://avatars.discourse-cdn.com/v4/letter/b/f17d59/32.png) [@Biscuit](https://forum.babylonjs.com/u/Biscuit)\
**Post date:** [January 15, 2024, 2:34pm UTC](https://forum.babylonjs.com/t/help-need-with-nme-material/47225/5 "2024-01-15T14:34:37Z")

</div>

You are right, I tried few methods, and by mistake I didn’t copy the right code  
So I tried both

```auto
async loadNodeMaterial(name: string, url: string, scene: Scene) {
    const material = await NodeMaterial.ParseFromFileAsync(name, url, scene)
    console.log(material);
}

```

```auto
loadNodeMaterial(name: string, url: string, scene: Scene) {
    return NodeMaterial.ParseFromFileAsync(name, url, scene).then((material) => {
      console.log(material);
    });
  }

```

In both case I got the error, and I didn’t get the console

---

<div class="post-metadata">

**Author:** ![labris](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/labris/32/12576_2.png) [@labris](https://forum.babylonjs.com/u/labris)\
**Post date:** [January 15, 2024, 2:58pm UTC](https://forum.babylonjs.com/t/help-need-with-nme-material/47225/6 "2024-01-15T14:58:53Z")

</div>

It works here - [https://playground.babylonjs.com/#APVSUF#32](https://playground.babylonjs.com/#APVSUF#32)  
I believe the problem is with your json loading.

---

<div class="post-metadata">

**Author:** ![Biscuit](https://avatars.discourse-cdn.com/v4/letter/b/f17d59/32.png) [@Biscuit](https://forum.babylonjs.com/u/Biscuit)\
**Post date:** [January 16, 2024, 7:39am UTC](https://forum.babylonjs.com/t/help-need-with-nme-material/47225/7 "2024-01-16T07:39:04Z")

</div>

Hi,  
I was feeling a bit hopeless, but [this](https://forum.babylonjs.com/t/error-when-switching-to-xr-mode-when-importing-modules-individually/47232) topic gave me an idea, and it seems I’ve identified the issue. It looks like it was a problem only on es6 (this is why in pg all good) and it appears that just importing

```auto
import { NodeMaterial } from "@babylonjs/core/Materials/Node/nodeMaterial";

```

is not enough. I also need to include

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

```

Otherwise, the error persists. I’m not sure whom to ping or contact to resolve the import issue at the package level, or at least to add this to the documentation, perhaps on the ES6 page.  
@RaananW , @carolhmj  
Thanks

---

<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:** [January 16, 2024, 10:45am UTC](https://forum.babylonjs.com/t/help-need-with-nme-material/47225/8 "2024-01-16T10:45:00Z")

</div>

That’s not an issue with the package, this is by design, to provide tree shaking, while still maintain package structure and the engine’s architecture.

It is required to either load the blocks you are using, or all of the blocks if you are unsure. This way the final package size is the smallest possible.  
So what you are doing is right! You could also solve it by importing the NodeMaterial class this way:

```javascript
import { NodeMaterial } from "@babylonjs/core/Materials/Node";

```
