How to set backUvs and frontUVs for imported mesh?

Hello!
So i have a problem in topic - i have a simle shirt model, and have two different texture for front and inside. For me is important that these textures must be separated, each is diffuse png, because the front texture is showing to user for redacting by the fabricjs.

How can i set a texture for front side and another texture for inside side, if the model is simple mesh but the texture is two different png image?

i tied

      chest = result.meshes[0];
      back = result.meshes[1];
      result.meshes[0].overrideMaterialSideOrientation = 2;
      result.meshes[1].overrideMaterialSideOrientation = 2;
      result.meshes[0].sideOrientation = BABYLON.Mesh.DOUBLESIDE;
      result.meshes[1].sideOrientation = BABYLON.Mesh.DOUBLESIDE;

      let a = new BABYLON.Vector4(0,0, 1, 1);
      let b =  new BABYLON.Vector4(0,0, 1, 1);

      result.meshes[1].frontUVs = new BABYLON.Vector4(0,0, 1, 1);
      result.meshes[1].backUVs =  new BABYLON.Vector4(0,0, 1, 1);

      result.meshes[0].frontUVs = a;
      result.meshes[0].backUVs = b;

then something here maybe

      const pbr = new BABYLON.PBRMetallicRoughnessMaterial('pbr', this.scene);
      const pbr1 = new BABYLON.PBRMetallicRoughnessMaterial('pbr', this.scene);
      pbr.backFaceCulling = false;
      this.scene.meshes[0].material = pbr;
      this.scene.meshes[0].material = pbr;
      // this.scene.meshes[1].material = pbr;
      pbr.baseTexture = new BABYLON.Texture('/3d-item/shirt/front/diffuse.png', this.scene);

I think you should split your mesh into two meshes, that way you can apply a different material on both meshes.

Thanks for answer, we do that right now, but its was be an ideal if there is an opportunity to use one mesh with 2 different texture

Maybe if you can setup a repro in the Playground with your mesh we can see if there is another solution.

2 Likes