Hello i’m currently on a procedural world project. I’m following a serie of Sebastian Lague to make this. (Procedural Landmass Generation (E01: Introduction) - YouTube)
I managed to change the scripts to make a more cubic world (like minecraft) but I have problem with the UVs.
I have a Texture2D with all the informations of color for my world like this :

But I can’t apply it correctly on my mesh because of my vertices set up. Here is an example of how I create my mesh :

The numbers are the vertices index. I use a noise map and for each pixel of this map I position 4 vertices with the same height.
I know how to use UVs on a simple “plane” mesh but I have no idea how to setup my UVs with my mesh.
I’m not sure what else we should tell you. Each of your face is a quad made of two triangles. So you just have to “place” your triangles at the right position in texture space. Keep in mind that a single cube which has 6 faces actually needs 24 vertices, not just 8. The reason is that you need to be able to specify seperate UV coordinates for each face and also a seperate normal vector. Your image looks a bit like a hightmap. However games like minecraft do not have a heightmap as the world is a pointcloud / voxel map. So the meshing is quite different from a plain heightmap.
I use less vertices than you say because I use vertices from previous line to connect each line with triangles. For example to connect the first face (vertice 0,1,8,9) to the face juste below (vertice 16,17,24,25) I create 2 triangles with the vertices 8,9,16,17. It give me the “minecraft” aspect without too much vertices and triangles.
Yes I use a procedural generate hightmap with the Unity perlin noise. Instead of placing 1 vertex per pixel on my hightmap, I create a full quad for each pixel and draw triangles to link them after that. It looks like that :

If I understand, for each triangle of my mesh(with his vertices index) I need to specify his position on the texture.
Something like that ?
Uvs[triangleIndex] = new Vector2(hightmapPosition.x / width, hightmapPosition.z / height).
And thank you for your fast answer.