2
\$\begingroup\$

I am trying to generate a random low poly terrain for a 3D demo. I am using Perlin noise to generate the heights and then generate the 3D mesh, but the terrain generated is too sharp and unrealistic. It ends up looking like this:

enter image description here

But I'd like it to look more like this:

enter image description here

How can I smooth out my terrain so it looks more like the second image?

\$\endgroup\$
  • \$\begingroup\$ Please be more specific. What exactly is "unrealistic" about the generated terrain? The ideal terrain generation algorithm depends on your requirements. \$\endgroup\$ – Philipp Oct 3 '16 at 21:00
  • \$\begingroup\$ It is too "sharp". Something like this: i.ytimg.com/vi/4olmeStiBsE/maxresdefault.jpg . I am looking for something like this: d1bb209af3y0vl.cloudfront.net/assets/proteus/social/… \$\endgroup\$ – user3313574 Oct 3 '16 at 21:05
  • \$\begingroup\$ Are you sure it's the 3d mesh which is wrong and not the way it is rendered? You might want to post a comparison screenshot of a more "conventional" looking game. \$\endgroup\$ – Philipp Oct 3 '16 at 21:08
6
\$\begingroup\$

Issue: The scale of the terrain in the sample image seems to be much larger. A hill is represented by at least 10x10 vertices while your mountain is represented by at most 5x5 vertices.

Solution 1: Increase the sample density of your noise. This is effectively equivalent to having more vertices and thus have more detail to your terrain

Solution 2: Increase your noise scale. This is effectively equivalent to smoothing your values. This means that you won't have tall mountains or steep cliffs.

\$\endgroup\$
2
\$\begingroup\$

Without knowing the specifics of your algorithm here are a couple things you can try:

If you want a simple method that keeps the same highs and lows; but has a greater amount of points fall in the middle range you can simply generate your terrain off two samples of noise instead of one, and average the results (or sum them and use 2 * maxval as your max instead of maxval). This will lead to still having the occasional sharp peak/valley where the noise lines up but cause a smoother terrain overall.

If you want to have what you have now but with specific shapes to your peeks and valleys you can play around with a graphing calculator to find a curve that you like for the spread of results you can get. For example if you are using values between 0 and 1 for your height values then applying a function like (tanh(x)-1)/2 to the points will smooth off your extremes while giving a closeish to linear range around the middle band. Make sure if you chose this route to play with the values. doing things like halving or doubling x going in will effect the overall steepness of your terrain without impacting the max or min height and other changes will have other potentially useful effects.

As a side note, some of the apperance of sharpness come from your textures. If the style is not desired, addressing it could help. If you cannot afford an approach such as multisampling (blending between two textures based on height) I would make transition textures for small bands between the high contrast steps to avoid the hard zigzag lines.

\$\endgroup\$
0
\$\begingroup\$

Another way to do this is to generate your terrain as a height map and then low-pass filter it. Applying a gaussian or even box blur to it will give you more gentle transitions between peaks and valleys.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.