0
\$\begingroup\$

I've created this terrain based on a Voronoi noise function:Voronoi terrain

This is how it looks without the elevation: Voronoi terrain 2D

I want to assign biomes to the polygons following certain rules and use the slope on the polygons to create the smooth transition between biomes. So in conclusion I need to identify the areas and its neighbors. For the moment I am only able to iterate through every vertex in the plane and get his position. Do you have any idea on how to store the areas with its neighbors to create the biomes map for my world?

\$\endgroup\$
6
  • \$\begingroup\$ You probably don't want to use the Voronoi noise for elevation. As you can see, it doesn't make anything that looks like a landform. \$\endgroup\$
    – DMGregory
    Commented Jan 7, 2022 at 0:56
  • \$\begingroup\$ No, I didn't explain myself well, I wanted to use the Voronoi noise for the biomes not the elevation \$\endgroup\$
    – alon
    Commented Jan 7, 2022 at 0:58
  • \$\begingroup\$ You should make it clear what the output of the noise function is. Because the concept of vertices in your heightmap is different to the vertices of a Voronoi diagram \$\endgroup\$
    – Jay
    Commented Jan 7, 2022 at 1:12
  • \$\begingroup\$ Both of them are the output of the noise is just that I've applied elevation to the first one to let you know that it is possible to calculate the weight of the biomes with the slope that is created \$\endgroup\$
    – alon
    Commented Jan 7, 2022 at 1:14
  • \$\begingroup\$ Do you get any edges connecting the vertices in the Voronoi graph? \$\endgroup\$
    – Jay
    Commented Jan 7, 2022 at 1:48

1 Answer 1

2
\$\begingroup\$

The dual graph of a Voronoi diagram is a Delaunay Triangulation:

Voronoi-Delaunay Duality

(The corners of the Voronoi polygons are the circumcenters of Delaunay triangles, and the seed points of the Voronoi diagram are the vertices of Delaunay triangles. Corresponding edges of the two diagrams are perpendicular)

This relationship is so key that many libraries/algorithms for generating Voronoi diagrams will also provide you with corresponding Delaunay triangles if you ask, making this a convenient starting point.

One simple way to assign weights to your biomes is to use these triangles, because they have consistent topology: every triangle connects exactly three biomes.

For each point you want to generate, determine which Delaunay triangle it sits within. That determines which three neighbouring Voronoi cells you need to blend.

Generate your biome-specific data using the rules for each of these three Voronoi cells respectively.

Next, find the barycentric coordinates of the point you're generating within the triangle. This is a set of three numbers - one for each vertex. When your point is exactly at one of the vertices, that vertex's weight is 1.0. When your point is on the opposite edge from a vertex, that vertex's weight is 0.0.

So you can use these directly as blend weights for the three biome outputs, and get C0 continuity along the edges of the triangles.

You can still have first derivative discontinuity, however - if that's noticeable for your particular biomes and terrain resolution/rendering, then you may need to use a more complicated blending function.

\$\endgroup\$
6
  • \$\begingroup\$ Thanks for the help, It is useful for the blending between biomes but I don't understand how with this I will be able to assign a biome to each cell and identify each cell's boundings and neighbors. \$\endgroup\$
    – alon
    Commented Jan 7, 2022 at 13:48
  • \$\begingroup\$ You can assign biomes arbitrarily. Say with a random value for each seed point, or with a separate moisture/temperature map as discussed in your previous question and the answers of mine we reviewed. The cell's neighbours for the purposes of blending are exactly those cells connected by the Delaunay triangulation. The bounds get more fuzzy thanks to the blending, so I don't think that's something you need to worry about. \$\endgroup\$
    – DMGregory
    Commented Jan 7, 2022 at 13:58
  • \$\begingroup\$ Yeah, but how do I know which cell/biome each point belongs to? Do I have to calculate for each vertex the biome based on the climate simulation? \$\endgroup\$
    – alon
    Commented Jan 7, 2022 at 14:29
  • \$\begingroup\$ You check which triangle it falls inside, and then blend the three biome cells connected by that triangle. Or am I misunderstanding your question? \$\endgroup\$
    – DMGregory
    Commented Jan 7, 2022 at 14:33
  • \$\begingroup\$ No, you understood my question. That was all I needed \$\endgroup\$
    – alon
    Commented Jan 7, 2022 at 14:37

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .