Kayla Posted December 3, 2020 Share Posted December 3, 2020 Hi guys, I am pretty new to babylonjs and javascript. I am currently working on the shirt configurator and I am facing a little issue about the UV. I exported this shirt from Marvelous Designer with unified UV and put it back in blender to export as gltf with textures. When I replaced the texture with javascript, I find out that the diffuse map is not in a right position while others are at the right place. Is there anything I can change or do to fix the problem? I try the u.Offset or v.Offset, it's isn't working. My Code: (I use Babylonjs with jQuery and Fabricjs) canvas 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 command and lines... var texture = new BABYLON.DynamicTexture("texture", canvasSecond, scene, true, 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("shirt", "gltf/", "shirt.gltf", scene, function(MeshOne) { scene.createDefaultCameraOrLight(true, true, true); var mesh = MeshOne[1]; 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.material = material; }); scene.onBeforeRenderObservable.add(() => { texture.update(); }); Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.