Is it possible to override initial model materials correctly?

Hello,

I’m trying to change initial materials of an imported glTF model by assigning different MeshStandard materials in three.js (colour, metalness, roughness). Since I get weird results I would like to clarify if it’s possible to override initial model materials correctly at all? Everything works fine with meshes created in three.js, but as for imported ones it seems that initial materials get messed with MeshStandard materials I apply.

Hi,

As far as I know imported models materials can be changed.

If you share your code perhaps someone will spot a mistake.

What do you mean with “weird result”? Please be more concrete and explain what’s going wrong.

Alright, here’s a piece of code responsible for applying material properties to meshes:

switch(shader)
            {
                case DEMO.MATERIALS.GLOSSY:
                    mat.roughness = 0.2;
                    mat.metalness = 0.0;
                    break;
                case DEMO.MATERIALS.MIRROR:
                    mat.roughness = 0.0;
                    mat.metalness = 1.0;
                    mat.color = new  THREE.Color( 0xB8B8B8 );                        
                    break;
                case DEMO.MATERIALS.GLASS:
                    mat.opacity = 0.5;
                    mat.transparent = true;
                    break;
                case DEMO.MATERIALS.CHROME:
                    mat.roughness = 0.15;
                    mat.metalness = 1.0;
                    mat.color =  new  THREE.Color( 0xB8B8B8 );               
                    mat.emissive =  new  THREE.Color( 0x9d9595 );          
                    break;
            }

An imported glTF model before applying material properties:
image
An imported glTF model after applying MIRROR (from the code snipped above) for table top:
image

MIRROR should have colour B8B8B8, not white.

Does it make any difference if you assign the color like so:

mat.color.set( 0xB8B8B8 );