# How to make noise-generated terrain more square?

I use a perlin noise generator to create a map. All works fine and dandy. It uses the following formula:

• Generate perlin noise
• Posterize the height values to be an integer between 0 and 5.

What I get works well. Just, the terrain is TOO organic for my purposes. Is there a way to make it a little more square and chunky?

• I guess you could just use a bigger grid, but i have the feeling thats not what your are asking. Could you provide an example of the effect you are trying to achieve? – Niels Jun 6 '17 at 11:40
• hmmm, that could work but it would end up with just very large organic terrain, right? – Bryant Jackson Jun 7 '17 at 12:49
• I'm editing the title; it previously suggested that making the perlin noise itself more square would be the suitable solution -- instead you want more square terrain, which can involve postprocessing or a different noise function entirely. – doppelgreener Jun 7 '17 at 16:54

Try using nearest neighbor scaling.

Here's my reference 100x100 noise texture & the same noise texture after posterizing to 4 levels:

Now here's the same noise, starting at lower 10x10 resolution.

Next, scale the texture up using nearest neighbor & then posterize to 4 levels.

The key here is to use the blockiness of nearest neighbor to your advantage. If you have access to your noise generator source, you might be able to use it directly. If not, you can easily add it as a post process. Since nearest neighbor is not very expensive & you're starting with a much smaller texture from your noise generator, the overall cost of handling it in post should be reasonable.

If you really want the terrain to look blocky you can use value noise which is blockier than perlin noise

(image source — attributed to Inigo Quilez)

• What kind of noise is this? – Bryant Jackson Jun 8 '17 at 21:47
• Bryant Jackson its a older noise tipe then the perlin noise,is explained in this site: thebookofshaders.com/11 – Jão Jun 8 '17 at 22:08
• @Bryant Jackson is a older noise than the perlin noise,the noise is explained here link – Jão Jun 8 '17 at 22:11

Here's what you do:

1. Take standard output from a Perlin Noise function, this should be a float in the range (0-1)1
2. Multiply by 5. This will range from (0-5)
3. Round to nearest integer

All those values that were slightly in between your integer values will get clamped to one or the other, resulting in squared off results

If you want it to be blocky on the other two directions (the X and Y screenspace, rather than just height value) you need to use a scalar there as well, and one that's designed to perform no interpolation between values.

Something like this should work:

int getHeight(int x, int y) {
float p1 = perlinNoise(x<<2, y<<2) * 5;
int p2 = Mathf.RoundToInt(p1);
return p2;
}


Technically Mathf.RoundToInt is a Unity specific, but the function is named with the desired intent. Convert to your language as needed.

By dividing x and y by 4 (bitwise) it means that x, x+1, x+2, and x+3 all return the same perlin noise value, making the result blocky in screenspace (not just height). Blocks will be 4x4 pixels. Increase the bitwise operator or use integer division for larger blocks.

1Inclusive or exclusive doesn't really matter. Perlin Noise tends to never actually hit the upper and lower bounds, although technically possible. Heavily dependent on the implementation (GIMP's Perlin Noise has an effective actual range of [0.2-0.8], for example).

The best way would be to mess with the perlin layers, and the actual functions that generate the layers. But there's an easier way:

Draw the squares and chunks you want, then overlay the perlin noise on top of them.