How to change primitive node colors, gltf 2.0 vs gltf 1.0

With Cesium <= 1.96 and gltf 1.0, I can change a primitive’s colors like so

var primitive = viewer.scene.primitives._primitives[0]._primitives[0];
var material = primitive.getMaterial(materialName);
material.setValue(‘diffuse’, new Cesium.Cartesian4(1, 0, 0, 1));

But with Cesium 1.99 and gltf 2.0, I haven’t figured out the syntax to do so.

I can change the whole primitive’s color with

primitive.color = Cesium.Color.RED;

But to change a node’s color this doesn’t work


However the node is accessible because this hides it


This also doesn’t work

primitive._loader._gltfJsonLoader._gltf.materials[0].pbrMetallicRoughness.baseColorFactor=[1, 0, 0, 1];

With Cesium 1.99 and gltf 2.0, how can I change a primitive’s nodes’ colors ?

Thank you for your help!

I figured it out!

Choose your primitive containing the node

var primitive = viewer.scene.primitives._primitives[0];

View node names like this


Choose the node to be colored (1st one in this example)

var nodeName = Object.keys(primitive._nodesByName)[0];

Change the node’s color like this!


I got inspired by these posts :
Changing material of single mesh in model
How to color specific part of Model