Texturing is getting applied when we have used direct output to fragment output but when added pbrmetallicroughness error occurs in run time …
Link for material nodes
error:
Uncaught TypeError: Cannot read property ‘getInputByName’ of undefined
at NodeMaterial._restoreConnections (nodeMaterial.js:1028)
at NodeMaterial._restoreConnections (nodeMaterial.js:1033)
at NodeMaterial.loadFromSerialization (nodeMaterial.js:1068)
at XMLHttpRequest.eval (nodeMaterial.js:1145)
Yes but when i try to change texture dynamically using babylon js code getting the above error with br materials here is the code for that
NodeMaterial.ParseFromSnippetAsync("JDC8BL", scene).then(nodeMaterial => {
console.log('dddd');
let maskedblocks = nodeMaterial.getTextureBlocks();
for(var i=0;i<maskedblocks.length-1;i++)
{
if(maskedblocks[i].name="BookMatchUV1")
{
maskedblocks[i].texture =new Texture(Globals.CurrentTexture.hdimageurl,scene);
}
else if (maskedblocks[i].name ="BookMatchUV2")
{
maskedblocks[i].texture =new Texture(Globals.CurrentTexture.hdimageurl,scene);
}
}
Globals.PickedMesh.material=nodeMaterial;
});
You should use “==” and not “=” when testing maskedblocks[i].name
.