Can't get NodeMaterial to work

Hello,
I’m trying to use the nodematerial. So I made my material in the editor:
https://nme.babylonjs.com/#3M9XSH
It works fine in the editor, but the textures dont seem to be embedded.

but when I use the code in BJS (4.1) I get this error:
Uncaught TypeError: BABYLON.PBRMetallicRoughnessBlock is not a constructor

And when I load the Json file like this:
nodeMaterial = new BABYLON.NodeMaterial(“mat”, scene);
nodeMaterial.loadAsync(“assets/node.json”).then(() => {
nodeMaterial.build(true);
})

I get this: Uncaught (in promise) TypeError: Cannot read property ‘getInputByName’ of undefined

How can I get this to work?
Thanks!

PBR is only supported starting with BJS 4.2 :slight_smile: It is a new feature we added for that version

So simply use 4.2 and it should work

That was a very simple and effective solution :slight_smile:
Thank you.

I do have the nodeMaterial on my model now. But the normals are reversed. I tried to reverse the normals of the model. But reflections still work reversed. And the albedoTexture also looks very pale.

Is there a way to fix this?

Can you share your nme?

Ok so the texture data is not available as I guess it was created in your code or inside the Playground right?

Can you store it online so I can see it?

For your example, I think you are seeing a transparency issue. Can you try without wiring the alpha component of the fragment output?

I have removed the opacity texture and the alpha connection.
But unfortunately no result on the normals.

Other links are being removed when I post them.
but material is on #3

https://nme.babylonjs.com/#3M9XSH#3

Unfortunately I cannot see it without a proper repro. Maybe you can repro in the pg?

maybe you can call scene.debugLayer.show() in your example so we can play with the material more easily?

I will have to figure out how to quickly set up this in the pg.
But I did enter the scene.debugLayer.show()

http://flomotion.nl/test4/large725x11x3.html

So I noticed that the orientation of the nodematerial is set to counterclockwise.
If I set this to clockwise it works!
But how can I do this in code?

Sorry for bothering you with all this.
Finally found it:
material.sideOrientation = BABYLON.Material.ClockWiseSideOrientation;

1 Like

Thank you very much for your time!

You found your solution. This is all that matters