Three.js纹理看起来从右侧剪裁

时间:2013-01-30 03:50:45

标签: three.js textures mesh

我在另一个网格顶部有一个网格(顶部网格区域很暗)

enter image description here

如果我像这样添加纹理图像;

var logoTexture = THREE.ImageUtils.loadTexture( logoPath );
mesh.material = new THREE.MeshBasicMaterial( { map:logoTexture } );

图像看起来已损坏(从右侧裁剪)

enter image description here

原始图片看起来像;

enter image description here

我不知道造成这个问题的原因是什么,图片也是512x512像素。

1 个答案:

答案 0 :(得分:2)

可能您的纹理宽高比与几何图形不匹配。你可以调整你的几何尺寸和/或玩纹理定位和拉伸,如下所示:

var map = logoTexture;

map.wrapS = THREE.RepeatWrapping;
map.wrapT = THREE.RepeatWrapping;

map.offset.x = 0; // adjust as needed to move horizontally
map.offset.y = 0; // adjust as needed to move vertically

map.repeat.x = 1; // adjust as needed to stretch horizontally
map.repeat.y = 1; // adjust as needed to stretch vertically