This created geometry creates 129 different textures, cause I have 129x129 planed. But how can I make 1 texture per 129x129 planes.
var geometry = new THREE.Geometry();
width = 129;
height = 129;
for (var y = 0; y < height; y++) {
for (var x = 0; x < width; x++){
var vertex = new THREE.Vector3(x, y, perlinNoise(x,y));
}
}
geometry.vertices.push(vertex);
for (var y = 0; y < height - 1; y ++) {
for (var x = 0; x < width - 1; x ++) {
var a = x + y * width;
var b = (x + 1) + (y * width);
var c = x + ((y + 1) * width);
var d = (x + 1) + ((y + 1) * width);
var face1 = new THREE.Face3(a, b, d);
var face2 = new THREE.Face3(d, a, c);
geometry.faces.push(face1);
geometry.faces.push(face2);
geometry.faceVertexUvs[ 0 ].push([
new THREE.Vector2( 0, 0 ),
new THREE.Vector2( 0, 1 ),
new THREE.Vector2( 1, 0 )
]);
geometry.faceVertexUvs[ 0 ].push([
new THREE.Vector2( 0, 0 ),
new THREE.Vector2( 0, 1 ),
new THREE.Vector2( 1, 0 )
]);
}
}
geometry.uvsNeedUpdate = true;
geometry.computeVertexNormals(true);
geometry.computeFaceNormals();
Double faceVertexUvs create face uv for both triange in a square and so on.