#Terrain blending

1 messages · Page 1 of 1 (latest)

static wedge
#

I am trying to have each biome have different noise, and then blend the borders for a somewhat realistic transition, instead of glitched edges.

However, this super jagged terrain appears when I try to do it, there are gaps.

I have a BiomeManager class that handles blending and biome creation.

A biome struct.

A VoxelChunk class which generates each chunk, generates biome noise, sends it to BiomeManager for it to select a biome, mix biome noises for terrain blending and sends the info back to VoxelChunk to generate blocks based on it.

A block struct that is used by VoxelChunk. [not necessary to show here]

A chunkmanager class that kickstarts this whole process (It generates a selected amount of chunks and tells VoxelChunk to fill them with blocks). [not necessary to show here]

Yes, I used ChatGPT because I am unable to create terrain blending myself. It ended up commenting and reorganizing the code so it looks like everything was made with it. However, I do understand almost everything (I just don't understand some stuff in the blending functions). I am unable to fix this issue myself after trying to find tutorials on the internet, and trying to find another approach since yesterday.

The full classes code is sent below. SOLVED! look at comment

#

using UnityEngine;

public class Biome
{
public string name;
public Color color;

// Noise value range [0..1] this biome covers (with overlap for blending)
public float temperature;
public float humidity;
public float continentalness;
public float erosion;

// Terrain generation parameters
public float scale;
public float amplitude;
public int octaves;
public float lacunarity;
public float persistence;
public float maxHeightMultiplier;

public Biome(string name, Color color,
             float temperature, float humidity, float continentalness, float erosion,
             float scale, float amplitude, int octaves, float lacunarity, float persistence, float maxHeightMultiplier)
{
    this.name = name;
    this.color = color;

    this.temperature = temperature;
    this.humidity = humidity;
    this.continentalness = continentalness;
    this.erosion = erosion;

    this.scale = scale;
    this.amplitude = amplitude;
    this.octaves = octaves;
    this.lacunarity = lacunarity;
    this.persistence = persistence;
    this.maxHeightMultiplier = maxHeightMultiplier;
}

}

static wedge
#

If you know a good article or tutorial on how to do this that would also be great

static wedge
#

After 2 days of working (yes i posted this on day 2) i managed to get this to work.
For anyone who struggles with this in the future, make sure your interpolation works by having a blend radius, then detect the 2 closest biomes to the position. Detect which biome has the higher amplitude and then make sure this block is in the blend radius of the 2 chunks. Then, only interpolate on the terrain that is considered a part of the higher biome, all the way to the lower biome.

This is the outcome.