0

I'm using THREE.OBJLoader to load my 3D objects in Three.js r100 and, at a certain moment, I need to load some dynamic textures with THREE.TextureLoader(). Then I simply create a new material with THREE.MeshBasicMaterial() and set this to my obj. This is the code:

//this contains the texture loaded
let texture = await new Promise((resolve, rejects) => loadGeneralTexture(resolve, rejects, url));

texture.minFilter = THREE.LinearFilter;
texture.needsUpdate = true;
texture.wrapS = texture.wrapT = THREE.RepeatWrapping;

var material = new THREE.MeshBasicMaterial({
  map: texture
});

//this loop set the new material with Texture
el.traverse(child => {
  if (child instanceof THREE.Mesh) {
    child.material = material;
  }
});

The result is:

But the image loaded is:

I fix this error only with gizmo (3dMax tool) by "rotate" the texture but I can't do the same fix with Threejs.

The same problem with two other 3d objects but this time it's even worse

Edit: obj files are our client'file (so i didn't create It myself), i already checked the various "faces" and they are equal. Can i change uvmapping myself with threejs?

jsBlaster
  • 1
  • 2
  • You have wrong UVs of the right corner in your object. Where did you get it from? Did you create it or took from somebody else? – kolenda Feb 14 '19 at 12:06
  • You can apply "3dsmax-like" UV box mapping, see my answer here: https://stackoverflow.com/questions/20774648/three-js-generate-uv-coordinate/54438304#54438304 – Alex Khoroshylov Feb 14 '19 at 20:13

0 Answers0