hello everyone…
I was trying to use the code generated in nodeMaterial Editor… but save it in an external file.
how should I call this file? and how can I call it in?
don’t know how to proceed on this one.
thanks for your support
hello everyone…
I was trying to use the code generated in nodeMaterial Editor… but save it in an external file.
how should I call this file? and how can I call it in?
don’t know how to proceed on this one.
thanks for your support
const myNodeMaterial = BABYLON.NodeMaterial.Parse(myJson, scene)
or if you store the json as a file: BABYLON,NodeMaterial.ParseFromFileAsync(“”, url… might come handy
thanks a lot for your help!
sorry it took time to get back at you… i was trying to make that work…
Yeah I was trying to save a code in a json as a file, but couldn’'t make it work.
I need it to be externaly in a file… cause I cant use an external link outside from my folders.
I tried saving the data generated by the nodeMaterial editor and saved as a file called “myMaterial.js”
then, inside my code
BABYLON,NodeMaterial.ParseFromFileAsync(“”,“myMaterial.json”, scene).then( (nodeMaterial) => {
var newMaterial= nodeMaterial;
sphere.material = newMaterial;
})
should it be something like this?
BABYLON.NodeMaterial.ParseFromFileAsync('testJson', "https://raw.githubusercontent.com/eldinor/ForBJS/master/hexnm.json", scene).then((nodeMaterial) => {
nodeMaterial.build();
shield3.material = nodeMaterial;
});
Thanks a lot!
Now working like charm!
I wanted to use several materials in a project that will be chosen from variables…
So now I can have the material code in separated files and will have a cleaner code…
Thanks a lot… will be sharing my results soon!