Procedural mesh generation. UVs

Hello everybody, I’m working on a game with the procedurally generated areas, everything is done except uv-mapping. I’ve looked in script reference about mesh.uv but there was no explanation how to really use it. Also I’m not very familiar with modeling. So I’m asking for some more explanation and maybe code snippets.

Thank you in advance,
sangi93

try this :

Yeah, thats a very open ended question. You can generate a mesh, but with no understanding of what UV’s are it will be pretty hard.

UV’s are 2d points on a texture that tell where each triangle gets its texture face from. Most of the time they tile, so if you had a triangle that went off the edge of the texture, it would pick up from the other side.

Procedurally generating meshes is great, but you need to develop how that mesh is “unwrapped” onto your texture. If you have simple shapes like spheres, planes (terrain), cubes and such then it is an easy task, if not it will involve a lot more work and calculation.

There is some detail about mesh generation on this manual page. Note that the link to the example code on the page is currently wrong so you should use this link instead.

There is also a more sophisticated example of mesh generation in this thread.