How to change the base color map of the model

i want to change the base texture of the model by button click and load new base texture map on the model as per asigned to the button
pg https://playground.babylonjs.com/#SI13I2#40

Hi,
This won’t work because it’s all a bit too messy and confused in there (sry :pleading_face:.
Let me try clear things a little: A baseTexture is a property of a ‘PBRMetallicRoughnessMaterial’ and all you have in your project at this time is ‘standardMaterial’. The closest equivalent to a ‘baseTexture’ used in PBR only for a standard material is the ‘diffuseTexture’.

So, you can load whatever number of textures as a texture (for anytype of texture), give it a name and next assign it dynamically or depending on context to your material.
Step 1 - would be create texture:

leathertex = new BABYLON.Texture(“textures/leather.jpg”);

Step2 - assign it to a material:

bagmat.diffuseTexture = leathertex;

i am trying to this tpe of thing but on buton click
pg https://playground.babylonjs.com/#C1QH9J#2
how can i do this with my model and my texture link

Well, in short, you can’t. Not like this PG. Not with your actual mesh. Not with your actual wrapping of textures.
Let me explain: This shoe object is a single mesh using texture wrapping over the entire mesh. It’s one single texture applied to the entire mesh as you can see below

So the first reason why you cannot do this is because your bag is made from multiple meshes and you need these meshes to create your animations. Second reason why it would not work is the class of material used. This shoe example uses a PBR.material and there is no baseTexture nor diffuseTexture in this class of material. It is replaced through the albedoTexture.

The point is that since you have different meshes with different materials you will just need another approach. For a start, you need to create one material for each type (the bag, the structure, the closing part…). Next you will load a number of textures to represent your different leather types. Finally, instead of creating one material for each type, you can update just the texture you need in your material (as per the information I gave you above).

can we do that if we the model and the animation are totally combined and its not in different parts like the models that gets downloaded from mixamo

No. Too many transformation steps. Too much hassle at this time. Although your animation would deserve an upgrade in my opinion. Still, you have metallic and organic (leather) parts in there so keeping with multimesh and multimat sounds like a good option. You might find it confusing at this very moment (I can understand) but in the end, it’s not that hard. The point is I also have my affairs to attend to and it would likely take 30min to an hour to do (starting by cleaning some more parts of the code and understanding what is what in this scenario). I can see if I can find some time to do it in your PG. Else, simply in a separate ‘example’ PG. May be, meanwhile, you can work some other parts of your project.

OK, thanks for the explanatoin and will be watting eagrly for the replyfrom your side.

Hi,
It’s me again.
Here is a new version. Only the meshes selection might just not be correct. To be honest, I don’t know what is supposed to be what. Else, you should have everything in there for changing your material on button click and changing the aspect of buttons on selected button. Hope this helps,