我正在使用THREE.js OBJ加载器将模型导入场景.
我知道我可以很好地导入几何体,因为当我为它指定一个MeshNormalMaterial时,它显示出很棒的效果.但是,如果我使用任何需要UV坐标的东西,它会给我错误:
[.WebGLRenderingContext]GL ERROR :GL_INVALID_OPERATION : glDrawElements: attempt to access out of range vertices in attribute 1
Run Code Online (Sandbox Code Playgroud)
我知道这是因为加载的OBJ没有UV坐标,但我想知道是否有任何方法可以生成所需的纹理坐标.我试过了
material.needsUpdate = true;
geometry.uvsNeedUpdate = true;
geometry.buffersNeedUpdate = true;
Run Code Online (Sandbox Code Playgroud)
......但无济于事.
有没有办法使用three.js自动生成UV纹理,还是我必须自己分配坐标?