How do I set a GLTF model's material to be a NodeMaterial?

I am loading a GLTF model, then setting it’s material to a NodeMaterial, but it doesn’t seem to apply to the model.

The NodeMaterial is created using https://nme.babylonjs.com/ and exported as a json, then loaded in Babylon using NodeMaterial's loadAsync function.

None of the properties I change from code seem to affect the GLTF model’s materials.

Using the Babylon debugLayer.show() GUI, I am able to change the properties of the model’s materials, but noticed the material’s class is “PBRMaterial” instead of the material I set it to in code (a material that extends “NodeMaterial”).

My end goal is to apply a vertex shader to the loaded GLTF models to bend the road (this is an infinite runner).

Thank you!

Check https://www.babylonjs-playground.com/#SYQW69#29 , lines 60 - 63. This is where the (very simple) NodeMaterial is applied to the meshes loaded

2 Likes