# Setting the ground level in procedural terrain generation using a gradient function

## Recommended Posts

Hi,

I am trying to create a set of functions (similar to Libnoise, Fastnoise and the Accidental Noise Library) to manipulate noise with the goal of producing terrain.  As recommended by this article (http://accidentalnoise.sourceforge.net/minecraftworlds.html) I am starting out with a 'gradient' function.  The purpose of this function is to establish a ground level.  I've read the articles many times, along with the previous versions and I can't get my head around this function at a conceptual level.

I believe that the gradient function maps input coordinates (in my case x, y, z) to a range that I specify (0 to 1 in the linked article), on a per axis basis and assigns them a value based on where they fall within the range?  Assuming y is my gradient axis, the gradient is from 0 to 1 and the value range is -1 to 1 then any y value above 1 or below 0 is clamped to either 1 or -1.  For a y value between the 0 and 1 the result is lerp(-1, 1, y)?

I did find this question but it didn't clear things up for me (https://gamedev.stackexchange.com/questions/57790/accidental-noise-gradient-function).

Any clarification would be greatly appreciated.  Thanks.

##### Share on other sites

It is not obvious what your question or problem with the gradient distribution is really? You shoudld state the issue more clear to get help. I myself cannot see any questioning. Do you want to get oponing to your distribution system explanation?

##### Share on other sites
12 hours ago, JohnnyCode said:

It is not obvious what your question or problem with the gradient distribution is really? You shoudld state the issue more clear to get help. I myself cannot see any questioning. Do you want to get oponing to your distribution system explanation?

Thanks for your feedback, I was struggling to word the issue.

My problem is that I can't write my own implementation of a gradient function because I don't understand what the function is trying to do.

My question would be: what is the gradient function trying to achieve?

I hope this clarifies things.

## Create an account

Register a new account

• 18
• 27
• 11
• 21
• 16