uv-mapping

Correct UV mapping Three.js

只谈情不闲聊 提交于 2019-11-28 13:01:15
I'm trying to map the UV-texture correctly, but failing... I've got the next result in my app: The result isn't that I was awaiting. I want to have the next described view: The source code is here: http://pastebin.com/aDg981Bk You need to look at PlaneGeometry.js and understand how the UVs are set. Then you will be able to figure out how to reset them. This should work -- there are two triangles per "face". for(var i = 0; i < geometry.faces.length / 2; i++) { geometry.faceVertexUvs[ 0 ].push( [ new THREE.Vector2( 0, 0 ), new THREE.Vector2( 0, 1 ), new THREE.Vector2( 1, 0 ), ] ); geometry.faces

Seams on cube edges when using texture atlas with three.js

时光总嘲笑我的痴心妄想 提交于 2019-11-28 11:31:35
问题 I have seams between horizontal faces of the cube when use texture atlas in three.js. This is demo: http://jsfiddle.net/rnix/gtxcj3qh/7/ or http://jsfiddle.net/gtxcj3qh/8/ (from comments) Screenshot of the problem: Here I use repeat and offset: var materials = []; var t = []; var imgData = document.getElementById("texture_atlas").src; for ( var i = 0; i < 6; i ++ ) { t[i] = THREE.ImageUtils.loadTexture( imgData ); //2048x256 t[i].repeat.x = 1 / 8; t[i].offset.x = i / 8; //t[i].magFilter =

THREE.js generate UV coordinate

送分小仙女□ 提交于 2019-11-26 01:45:27
问题 I am working on importing a model into a scene using the THREE.js OBJ loader. I know that I am able to import the geometry fine, because when I assign a MeshNormalMaterial to it, it shows up great. However, if I use anything that requires UV coordinates, It gives me the error: [.WebGLRenderingContext]GL ERROR :GL_INVALID_OPERATION : glDrawElements: attempt to access out of range vertices in attribute 1 I know this is because the loaded OBJ has no UV coordinates, but I was wondering if there

THREE.js generate UV coordinate

早过忘川 提交于 2019-11-26 01:33:00
I am working on importing a model into a scene using the THREE.js OBJ loader. I know that I am able to import the geometry fine, because when I assign a MeshNormalMaterial to it, it shows up great. However, if I use anything that requires UV coordinates, It gives me the error: [.WebGLRenderingContext]GL ERROR :GL_INVALID_OPERATION : glDrawElements: attempt to access out of range vertices in attribute 1 I know this is because the loaded OBJ has no UV coordinates, but I was wondering if there was any way to generate the needed texture coordinates. I have tried material.needsUpdate = true;