Reset the material to its default value

Hi Shapepsark Team!

Looking forward to your help!
For example:
I changed the color of this “Floor-1” material and it worked
var img = “” ;
var texture = viewer.createTextureFromHtmlImage(img);
var material = viewer.findMaterial(“Floor-1”);
material.baseColorTexture = texture;
viewer.requestFrame();

But I want to reset the “Floor-1” material color to default without having to reload the page?

Thanks

You can save the original texture before you alter the material, for example:

var originalTexture = material.baseColorTexture;

and restore it later:

material.baseColorTexture = originalTexture;

Hi Wojtek !
Thank you for your reply.

1 Like