Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create different Biomes #40

Open
IPotatoCouch opened this issue Jul 15, 2020 · 10 comments
Open

Create different Biomes #40

IPotatoCouch opened this issue Jul 15, 2020 · 10 comments
Labels
feature New feature

Comments

@IPotatoCouch
Copy link

IPotatoCouch commented Jul 15, 2020

Different biomes / regions could be nice to have :]

@Eldemarkki Eldemarkki added the feature New feature label Jul 15, 2020
@Eldemarkki
Copy link
Owner

Eldemarkki commented Jul 15, 2020

This solution that I quickly thought up of would only work with 2 biomes, but maybe someone smarter than me knows how to extend it to more than 2. I haven't spent much time on this.

First, create 2 noise functions; 1 for biome A called GetA(x, z), and one for biome B called GetB(x, z). Those functions would generate the height for the biomes. So GetA() could for example be an infinite plains biome, and GetB() and infinite mountains biome.

Then, have a third noise function representing the blend. For any given point (x, z), the height of point (x, z) would be y = Lerp(GetA(x, z), GetB(x, z), GetBlend(x, z)). GetA() and GetB() representing the noise functions of A and B. GetBlend() would tell how much to blend the biomes: 0 would be completely biome A, and 1 would be completely biome B.

I would rather do something like this, than a height-based biome, as height-based gives rings of biomes and I don't really like the look of that

@IPotatoCouch
Copy link
Author

Thanks for the tip! This sounds like a good solution. For multiple biomes I was thinking would it be possible to generate a biomes map, something like this maybe.

BiomesMap

Each biome has its own color, so with a map like this it would be easy to determine where each biome is located. One issue is blending biomes together. Maybe even make biomes bleed into each other, so it would give more realistic results. I'm not smart enough to figure this out tho..

@Eldemarkki
Copy link
Owner

Yeah, the blend is very difficult. I remember once (like maybe a year ago) trying a climate based biome system, where the inputs are 2 noise maps, one for precipitation and one for temperature. Here's picture of what I mean:

In that experiment, I think I could generate the biomes nicely, but blending the heights was the biggest problem which I never managed to solve.

@IPotatoCouch
Copy link
Author

That looks really nice! What if you blend the biomes map like this? Each biome has its own noise so once the map is blended so as the noise maps. Would that be possible?

BiomesBlend
BlendedBiomes

This is a bit ugly example, but does this even make sense? In my head this sounds logical yet I have no idea how to accomplish this.. :D

@IPotatoCouch
Copy link
Author

Biomes map would almost act like a mask for noise maps, if the biomes map is 'blurred' you would get a smooth transition

@Eldemarkki
Copy link
Owner

I think that's a great idea! I'll post something here if I manage to think of some implementation. It's definitely a hard problem.

@IPotatoCouch
Copy link
Author

Awesome thank you! 🙂 Been scratching my head for hours, it's quite a task.. A bit too much for my brain too handle 😄

@Eldemarkki
Copy link
Owner

I looked for the repository about the climate based biomes (like in the diagram in the previous comment) and found it! I made a few changes to fix the blending, and made the repository public. Here it is: https://github.com/Eldemarkki/TerrainBiomeGenerator.

This is what it looks like with blending=0:
kuva

And this is with blending=3:
kuva

It's not perfect, the colours are quite sharp looking at some places, and it is not very realistic as there are multiple places where it goes from desert to tundra, but that can be tweaked quite easily.

And in case it wasn't obvious, that is not using marching cubes.

The blending is done by just taking the average height around the sampling point. The transition from any biome to ocean is not blended, because I don't want the ocean to suddenly go upwards near the transition.

@IPotatoCouch
Copy link
Author

Really nice! This works pretty well! Will you be implementing this approach to Marching-Cubes-Terrain project as well? 🙂

@Eldemarkki
Copy link
Owner

I'm not really sure. If I end up implementing it, it most likely will not be in the main repository, but in the TerrainBiomeGenerator repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature
Projects
None yet
Development

No branches or pull requests

2 participants