Three.js texture not repeating properly

做~自己de王妃 提交于 2019-12-13 20:35:07

问题


I'm trying to repeat a 16x16 texture on a plane, but when I set the texture to repeat I get the following result:


The texture is shown correctly in the bottom left of the plane, but it looks as though the top and right edges are stretched across the rest of the plane. So far I've been unable to find out why it does this.
This is the code:
function addTerrain(){

            var texture = THREE.ImageUtils.loadTexture( "tex/tex.png" );
            texture.WrapS = texture.WrapT = THREE.RepeatWrapping;
            texture.repeat.set(2,2);

            geometry = new THREE.PlaneGeometry(128, 128);

            material = new THREE.MeshLambertMaterial( { map: texture } );
            terrain = new THREE.Mesh( geometry, material );
            terrain.rotation.set(-90 * (Math.PI / 180),0,0);
            scene.add(terrain);
            camera.lookAt(terrain.position);

            light = new THREE.PointLight();
            light.position.set(0,100,0);
            scene.add(light);

        }

How do I make the texture repeat across the plane properly?

来源:https://stackoverflow.com/questions/15587333/three-js-texture-not-repeating-properly

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!