Converting PBRMaterial to NodeMaterial

Is there a way to cast a PBRMaterial as a NodeMaterial intuitively in code? I noticed that PBRBaseMaterial and NodeMaterial are both children of PushMaterial. I haven’t been able to find any way to convert a NodeMaterial to a PBRMaterial though. I tried casting: ( as NodeMaterial), but the material remains a PBRMaterial (which makes sense). Am I stuck just moving over all the applicable property values to a new NodeMaterial? Thanks!

Hey! you cannot cast them as they are totally not compatible.

You can still recreate the PBR Material with Nodematerial: Node Material | Babylon.js Documentation (babylonjs.com)

2 Likes