Three.js: How to Repeat a Texture -
with following code, want set rectangle's texture, problem texture image not repeat on whole rectangle:
var pengeometry = new three.cubegeometry(length, 15, 120); var walltexture = new three.imageutils.loadtexture('../../3d/brick2.jpg'); walltexture.wraps = walltexture.wrapt = three.mirroredrepeatwrapping; walltexture.repeat.set(50, 1); var wallmaterial = new three.meshbasicmaterial({ map: walltexture }); var line = new three.mesh(pengeometry, wallmaterial); line.position.x = penarray.lastposition.x + (penarray.currentposition.x - penarray.lastposition.x) / 2; line.position.y = penarray.lastposition.y + (penarray.currentposition.y - penarray.lastposition.y) / 2; line.position.z = penarray.lastposition.z + 60; line.rotation.z = angle; the texture image http://wysnan.com/nightclubbooth/brick1.jpg result http://wysnan.com/nightclubbooth/brick2.jpg
only piece of texture rendered correctly not of rectangle, why? , how render rectangle texture image?
for repeat wrapping, texture's dimensions must power-of-two (pot).
for example ( 512 x 512 ) or ( 512 x 256 ).
three.js r.58
Comments
Post a Comment