Hi guys.
I am new to js and babylonjs and working on shirt configurator. I am facing a little issue on UV as it seems that the UV of diffuse is totally off while other maps are working fine. I export the geometry from Marvelous Designer with unified UV and put it back to the blender to see if the UV is in the right spot. I export the geometry in gltf format and embed with babylonjs. (I also use jQuery and fabricjs in the script)
updated: I sorta figure out where the problem is and I try to use the wAng to rotate UV, and I need to do the filp horizontal to the UV. Is there any command to flip horizontal to the UV(I try to put uScale =-1 but not working)?
My code:
var canvasSecond = document.getElementById(“canvas2”);
canvasSecond.width = 1024;
canvasSecond.height = 1024;
//canvas
var canvasSec = new fabric.Canvas('canvas2');
fabric.Image.fromURL("textures/shirt_diffuse.png", function(img2) {
var img3 = img2.set({ selectable: false });
canvasSec.add(img2).renderAll();
});
.....//after so many lines
var texture = new BABYLON.DynamicTexture("texture", canvasSecond, scene,true,0,0,false);
var nrmtexture = new BABYLON.Texture("textures/shirt_normal.png", scene, true, false);
var spectexture = new BABYLON.Texture("textures/shirt_spec.png", scene, true, false);
BABYLON.SceneLoader.ImportMesh("", "gltf/", "shirt.gltf", scene, function(mesh) {
scene.createDefaultCameraOrLight(true, true, true);
var material = new BABYLON.PBRMaterial("material", scene);
material.albedoTexture = texture;
material.reflectionTexture = new BABYLON.HDRCubeTexture("textures/abandoned_factory_canteen_02_2k.hdr", scene, 218, false, false, false, false);
material.bumpTexture = nrmtexture;
material.specularTexture = spectexture;
material.metallic = 0;
material.roughness = 1;
// standardUV = options.standardUV;
mesh[1].material = material;
});