Am working on a 2D procedural terrain generator. It works by computing seamless chunks and a window which extracts the currently required area (a principle inspired by Minecraft, but not quite, since my chunks are each at least as large as the window).

However now I want to implement what would be the biomes in minecraft -> ways to influence chunks that are generated in a particular, non-rectangular region.

Chunks are generated from a bunch of fully interpolateable settings values (for example "cave_density") but not immediately randomized as I want to control through entirely separated code, what region belongs to what biome.

I imagine to have functions like AddBiomePolygon(SettingsData settings, vector polygon); Now when I request a chunk that lies within the polygon that was given there, I want to retrieve purely the SettingsData given by prepared_settings_id. If I have two such polygons next to each other and request a chunk from between them, I shall retrieve an accordingly interpolated setting. If the requested chunk is not between two polygons but out in the open, it should chose accordingly to what SettingsData are the closest and interpolate.

Am imagining something a little bit like this where the colors are each referring to a biome setting: enter image description here

Surely I can achieve this with graphical manipulation, mainly by blurring, but that appears very inefficient to me and I have to setup the whole system to handle a moving window across a grid of biomes. Would rather like a system that retrieves said polygons and can compute the settings for a particular chunk directly, without having to compute all chunks settings in an area.

Does anyone know common concepts for this or has an idea?

  • \$\begingroup\$ This looks like a Delaunay triangulation problem: convert your biome corners to a triangle mesh (which you can store and look up into as a BSP), then compute blending factors within each triangle using barycentric coordinates. \$\endgroup\$ – DMGregory Dec 6 '19 at 19:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.