Add BlockValue to existing nodematerial?

Hi there,
i have a nodematerial here, wich is already build. is it possible to change blockvalues in that material without rebuilding it?

so for example if i want to change the texture value in the block “BaseTexture” how would i do that?

this would be my material:

    const baseMapMaterial : NodeMaterial = existingMaterial

and these are the blocks i want to change for example:

            { name: 'BaseTexture', value: tex },
              name: 'BWMode',
              value: 1,
            { name: 'BWLightenFactor', value: 10.0 },
            { name: 'Reflection color', value: new Color3(0.1, 0.1, 0.1) },
            { name: 'Roughness', value: 1.0 },
            { name: 'Metallic', value: 0.0 },

can i do that or do i have a problem understanding NodeMaterials

Cheers and thanks a lot!

Yes, you can do that :smiley: For a texture, for example, you just need to change the texture attribute on the block. And you can get the block of an existing material by using getBlockByName: Substitute Values in NodeMaterial | Babylon.js Playground (


Absolutely amazing!! Thanks a lot!
now nodematerials start to make sense for me. before that i tried to rebuild the whole material every time wich is way to slow in my case.

this is how i do that now:

      const textureBlock = baseMapMaterial
        .find((b) => === 'BaseTexture')
      if (textureBlock !== undefined) {
        textureBlock.texture = tex