# Assign biomes to areas with a Voronoi noise function

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

This is how it looks without the elevation:

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?

• 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. Commented Jan 7, 2022 at 0:56
• No, I didn't explain myself well, I wanted to use the Voronoi noise for the biomes not the elevation
– alon
Commented Jan 7, 2022 at 0:58
• 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
– Jay
Commented Jan 7, 2022 at 1:12
• 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
– alon
Commented Jan 7, 2022 at 1:14
• Do you get any edges connecting the vertices in the Voronoi graph?
– Jay
Commented Jan 7, 2022 at 1:48

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

(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.

• 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.
– alon
Commented Jan 7, 2022 at 13:48
• 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. Commented Jan 7, 2022 at 13:58
• 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?
– alon
Commented Jan 7, 2022 at 14:29
• You check which triangle it falls inside, and then blend the three biome cells connected by that triangle. Or am I misunderstanding your question? Commented Jan 7, 2022 at 14:33
• No, you understood my question. That was all I needed
– alon
Commented Jan 7, 2022 at 14:37