Json 3D 模型仅使用纹理的 1 个像素 [英] Json 3D model only using 1 pixel of a texture

查看:40
本文介绍了Json 3D 模型仅使用纹理的 1 个像素的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到了这个奇怪的问题,我的 3D 对象只占用了纹理的 1 个像素(左下角),这就是我加载对象的方式

 loaderFrame.load('./models/filterFrame/filterFrame.json',(geometry) =>{const mat = new THREE.MeshBasicMaterial({地图:新的 THREE.TextureLoader().load('./models/filterFrame/textura_polar.jpeg'),透明:真实,变形目标:真});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;}

);

解决方案

这是因为您加载的对象没有正确的

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;
}

);

解决方案

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:

这篇关于Json 3D 模型仅使用纹理的 1 个像素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆