How to replace a Texture Png of 3d object using Script?

  const comp = node.addComponent(ModelComponent);
                comp.mesh = meshSphere;
                const m = new Material();
                m.initialize({
                    effectName: 'builtin-standard',
                });
                m.setProperty('roughness', math.clamp(j / cols, 0.05, 1));
                m.setProperty('metallic', i / rows);
                m.setProperty('albedo', albedo);
                comp.material = m; models.push(comp);

This seems to be a way , but it is not clear how to Set Albedomap .

just the same as you did to set the numbers.

// where tex is a Texture2D object.
m.setProperty('albedoMap', tex); 

if you don’t know the exactly name of a property, just refer to the effect file used by the material.
lookup the properties in the CCEffect section.

1 Like

USE_ALBEDO_MAP also needs to be enabled

1 Like

Documentation should be clearer , it is spread in manny places .

Thanks

1 Like

that’s really the point.