For a hands-on demonstration, check out this working example: https://jsfiddle.net/mmalex/pcjbysn1/
https://i.sstatic.net/fXsAs.png
In the BufferGeometry, texture coordinates are stored in the 'uv' attribute, which can be added using BufferGeometry.addAttribute and accessed through geom.attributes.uv.array
.
let uvCoords = [];
let vertexCount = geom.attributes.position.array.length / 3;
// allocate array of UV coordinates (2 floats per each vertex)
uvCoords.length = 2 * vertCount;
if (geom.attributes.uv === undefined) {
geom.addAttribute('uv', new THREE.Float32BufferAttribute(uvCoords, 2));
}
To create projection coordinates for the mesh vertices on a 3D plane that will serve as your UV coordinates.
https://i.sstatic.net/UlbJ6.png
In most cases, you would need to use Plane.projectPoint for each vertex. This method is simple and can be optimized by pre-rotating the mesh so that the vertex x and y components become u and v respectively. You can see this optimization in action in my jsfiddle link.