UV mapping to whole geometry not single planes

geometry
#1

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.

#2

You can take a look at the source code of the PlaneGeometry and see how the things work under the hood.

#3

Okay, so basically, i didn’t know how to do the UV-s, then i changed geometry out for bufferGeometry and it worked ok. I guess if you need textures per plane, then use geometry(), and if you need 1 texture to all use bufferGeometry().

#4

Not correct. You can calculate UVs for usual THREE.Geometry() the same way like they do it for THREE.BufferGeometry().