2

I am working on a project revovling around procedural terrain generation. I currenly have 2 seperate parts, one which generates my Voronoi Diagram, while the other deals with the generation of the whole terrain. The terrain is currently generated in chunks, as it is too large to be generated on its own. The polygons, which are generated by my Voronoi Algorithms are close in size to a signle terrain chunk. I want a seperate chunk to be generated for each polygon, as I want the Perlin Noise values to be determined the generated polygons. In the current impementation my Terrain Chunks have a form of a square, hence I can not really stick a polygon in. How would you go about it?

I was initially trying to get my texture into a polygon shape, but it the Textures in unity have width and height, duh, so that did not exactly work out. I also considered seperating each Terrain chunk into a set of polygons with the same properties which would form the square, the this ruins the whole purpose of using Voronoi.

I would be happy to include my code, but I don't think it is partically valuable in this case.

As a note: My Voronoi implementaion returns a list of polygon objects with the respective corner points, edges, centroids, etc.

Thanks in advance :)

vgro
  • 458
  • 4
  • 12

2 Answers2

2

Most of the time when I've seen Voronoi algorithms in terrain generation, they're applied to a texture at runtime. Other types of noise can then be added/multiplied/etc to that texture to create a heightmap for your procedural terrain.

If you have your Voronoi algorithm generating geometry already, one option is to make a shader for your terrain that samples Perlin noise in world space coordinates (this way you wouldn't run into any tiling issues on your polygonal mesh). If the noise was to be used as a heightmap, tesselation can increase your mesh resolution. However, if you haven't used shaders before you might see results faster using the texture approach. And it wouldn't make a lot of sense to do half of the terrain noise in a shader if you're doing the other half in C#.

Since this topic can get pretty broad, I'd highly recommend Sebastian Lague's videos on terrain generation. https://www.youtube.com/watch?v=wbpMiKiSKm8&list=PLFt_AvWsXl0eBW2EiBtl_sxmDtSgZBxB3

Nicholas Bucher
  • 440
  • 2
  • 7
  • 1
    This was very helpful! I think I already went through the whole of Sebastian's series and most other videos, it's absolutely amazing. Would be nice to combine his Landmass Generation with the Procedural Planets. – vgro Mar 29 '19 at 00:52
0

Why would you want to have your terrain tiles polygon shaped? If I understand this correctly, you don't want your terrain tiles to be squares, but polygons generated with a voronoi algorithm. No one does this actually. Terrain tiles are always squares that are created and deleted based on a virtual grid and the player position.

leo rid
  • 118
  • 5
  • Correct me if I'm wrong. So I should overlay my Voronoi over the square parts of the terrain? Each of the squares will have a few polygons within, and different noise parrameters are used to generate different parts of the same square, if the polygon intersection lies within the square? – vgro Mar 27 '19 at 16:09
  • Could you elaborate with pictures maybe? It's hard to get what you try to archive with the voronoi maps, because usually, different layers of perlin noise are totally fine for the terrain heighmap. I don't understand the "regions" that are generated with voronoi. Do you have different climates or biomes or something, and split them with voronoi regions? – leo rid Mar 28 '19 at 01:45