Json 3D model only using 1 pixel of a texture

牧云@^-^@ 提交于 2021-01-29 05:10:58

问题


I'm having this weird issue, my 3D object is only taking 1 pixel (bottom left) of my texture, this is how i'm loading the object

  loaderFrame.load('./models/filterFrame/filterFrame.json',(geometry) =>
  {
  const mat = new THREE.MeshBasicMaterial({
    map: new THREE.TextureLoader().load('./models/filterFrame/textura_polar.jpeg'),
    transparent: true,
    morphTargets: true
  });

  mat.transparent = true;
 // mat.morphTargets = true;

  frameMesh = new THREE.Mesh(geometry, mat);

  frameMesh.scale.multiplyScalar(frameOptions.frameScale);

  frameMesh.frustumCulled = false;
  frameMesh.transparent = true;
  frameMesh.renderOrder = 0;
}

);


回答1:


This is because your loaded object doesn't have proper UV mapping. If UVs are nonexistent, or if they're all 0, 0, then it's only going to sample from the bottom-left corner of your texture.

To fix this, open your model in a 3D editor and make sure the UVs are properly positioned across the texture plane. I don't know what your model looks like, but here's a basic example:



来源:https://stackoverflow.com/questions/61783828/json-3d-model-only-using-1-pixel-of-a-texture

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!