使用纹理UV加载OBJ时出错

时间:2014-10-03 14:41:16

标签: three.js

当我加载OBJ文件并使用带有纹理贴图的材质时,我收到了Three.js v68 的错误,

Error: WebGL: drawElements: bound vertex attribute buffers do not have sufficient size for given indices from the bound element array

网格工作正常,直到我添加纹理贴图。使用以下代码在材质上设置地图:

var imgTexture = THREE.ImageUtils.loadTexture( "assets/tex01.png" );
imgTexture.wrapS = THREE.RepeatWrapping;
imgTexture.wrapT = THREE.RepeatWrapping;
imgTexture.needsUpdate = true;
...
mat.map = imgTexture;
mat.needsUpdate = true;

obj(从3dmax导出)内部有UV数据,并且UV信息被加载到faceVertexUvs属性中。

vt 0.8586 0.4138 0.0000
vt 0.8719 0.3913 0.0000
vt 0.9145 0.2598 0.0000
....

网格加载了THREE.OBJLoader。加载的Object具有面:Array [6812]元素和faceVertexUvs:Array [1] .Array [6812]实际UV值的元素。所以它似乎已经加载了正确的数据。但它在渲染过程中失败了。

0 个答案:

没有答案