Does anyone know how to set a property value of a json exported node material in code?
I fetch in the material from file like this:
let checkerMat = await NodeMaterial.ParseFromFileAsync('checker_M', './materials/checker.json', this._scene);
then add an observable callback:
checkerMat.onEffectCreatedObservable.add(data => {
data.effect.setVector2('repeatXY', new Vector2(100, 50));
});
when it gets to the setVector2 it says could not find property repeatXY
i tried u_repeatXY as well (as it described as uniform in the fragment shader) but that didnt help.
I created a playground scene to demonstrate the problem:
After page load, open up the browser javascript console output, you can see the error message:
Uncaught TypeError: Cannot read properties of undefined (reading ‘repeatXY’)
You can see in the console output, that the effect instance exists, and if you check in that you can see that the fragment shader has a uniform vec2 named u_repeatXY.
What am I missing here? How to set these kind of parameters in json parsed NodeMaterials?