Skip to content
Discussion options

You must be logged in to vote

You use that to define the material you are trying to change.
const mat1 = modelViewer.model.getMaterialByName('name');

Than you need to create textures from the images you wish to use.
const createTextures = async () => {
texture1 = await modelViewer.createTexture("assets/mat1_Base_Color2.jpg");
texture2 = await modelViewer.createTexture("assets/mat2_Base_Color1.jpg");
}

Than you need to apply those textures to the material.
mat1.pbrMetallicRoughness.baseColorTexture.setTexture(texture1);

Or change the baseColor of the material.
mat1.pbrMetallicRoughness.setBaseColorFactor([0.5,0.065,0.043,1]);

And so on. Hope this helps you a little.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@phatpixels
Comment options

Answer selected by phatpixels
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants