My First Noise Equation - PolyhedralDev/Terra Wiki

Biome Noise Equation

At the heart of Terra's terrain generation is the noise-equation key found in all biome configs. Here's an example:

noise-equation: "((-(y / 62)^2) + 1) + ((noise2(x, z)+0.5) / 3)"  

This page is a tutorial, which will demonstrate how to create an equation to produce your desired type of terrain.

Oh no, math! What does it mean?

The principle behind the noise equation is very simple. The equation takes in 3 variables, x, y and z, and converts them into an output. When Terra is generating the chunk base (Base generation is the first phase of terrain generation, where the shape of the terrain is defined), the current coordinates are fed into this equation. If the result is positive, the location is solid. If the result is negative, the location is air.


Let's start with a very simple noise equation:

noise-equation: "(-y/64)+1"

This is simply a linear equation, with no noise involved. The result this gives is incredibly boring, a perfectly flat world: Flat World Notice that ground level is at Y=64, since when a value lower than 64 is passed into the equation for Y, the result is positive, causing all blocks at Y=63 and lower to be solid. If you graph the equation, you can clearly see the relationship: Graph

This is boring. How can we make actual terrain?

With noise, of course!
Terra contains 2 custom functions you can include in your equations, noise2(x, z) and noise3(x, y, z). These functions exist to, as their names suggest, provide noise to use in your terrain. They provide noise from a Simplex Octave generator, seeded with the world seed, with octaves and frequencies defined in Terra's world config. Below is an example of Simplex Noise. As you can see, the noise creates a gradient.
Simplex Noise
This is useful in terrain generation, as it allows variation to be added to terrain. Let's start with a simple 2D Simplex height map!

noise-equation: "(-y/64)+1 + noise2(x, z)"

This equation adds the 2D Simplex noise fetched from the X and Z coordinates to the linear equation we defined previously. Now, our world looks like this:
Noise Terrain

Hold on, what exactly is happening there?

Basically, since we are adding the result of the Simplex Noise (Which ranges from -1.0 to 1.0 and follows a Gaussian Distribution) to the original equation, we are "offsetting" the base height (Y=63) of the terrain by whatever the result of the Simplex operation is. This creates nice hills/mountains in our terrain, and grants us many configuration possibilities!

Too hilly. How can we get flatter terrain?

Divide the noise result by a number, of course! Here's a new equation, which divides the noise value by 2:

noise-equation: "(-y/64)+1 + noise2(x, z)/2"

And here's what the terrain looks like now: Noise Terrain

Improving the base equation

I have found that for most cases, a linear base equation is not ideal. For a majority of my biomes, I use a quadratic equation as a base. Specifically, I use:

noise-equation: "-((y / 64)^2) + 1"
Noise Terrain The above equation gives a similar result to the linear equation, except it "drops off" faster at higher Y-values. Here's the terrain generated from the equation:
noise-equation: "-((y / 64)^2) + 1 + noise2(x, z) / 2"
Noise Terrain

Add some flora and trees, and we now have a pretty nice Plains biome!

noise-equation: "-((y / 64)^2) + 1 + noise2(x, z) / 2"
id: "PLAINS"

  - GRASSY: 255
vanilla: PLAINS

erodible: true

  chance: 60
  attempts: 1
      weight: 160
        min: 62
        max: 84
      weight: 100
        min: 62
        max: 84
      weight: 8
        min: 62
        max: 84

  density: 20
      weight: 1
        min: 58
        max: 72
Noise Terrain

If you want to go to the next level, please take a look at Multi-layered-Noise-Equations

⚠️ ** Fallback** ⚠️