Generating a procedural terrain

This recipe deals with the procedural generation of a terrain. Although never good enough for a final product because you will want to fine tune the heightmap to your specifications, these generated terrains are a great starting point for anyone new to creating levels or for anyone who needs to set up a test level with the Sandbox. Different heightmap seeds and a couple of tweaks to the height of the level and you can generate basic mountain ranges or islands quickly that are instantly ready to use.

Getting ready

Have My_Level open inside of Sandbox.

How to do it...

Up at the top-middle of the Sandbox main toolbar, you will find a menu selection called Terrain. From there you should see a list of options, but for now you will want to click on Edit Terrain. This opens the Terrain Editor window.

The Terrain Editor window has a multitude of options that can be used to manipulate the heightmap in your level. But first we want to set up a basic generated heightmap for us to build a simple map with.

Before we generate anything, we should first set the maximum height of the map to something more manageable. Follow these steps:

  1. Click Modify.
  2. Then click Set Max Height.
  3. Set your Max Terrain Height to 256 (these units are in meters).

Now, we may be able to generate the terrain:

  1. Click Tools.
  2. Then click Generate Terrain.
  3. Modify the Variation (Random Base) to the value of 15.
  4. Click OK.

After generating, you should be able to see a heightmap similar to the following screenshot:

How to do it...

Note

This is a good time to generate surface texture (File | Generate surface texture | OK), which allows you to see the heightmap with a basic texture in the Perspective View.

How it works...

The Maximum Height value is important as it governs the maximum height at which you can raise your terrain to. This does not mean that it is the maximum height of your level entirely, as you are still able to place objects well above this value. It is also important to note that if you import a grey scale heightmap into CryENGINE then this value will be used as the upper extreme of the heightmap (255,255,255 white) and the lower extreme will always be at 0 (0,0,0 black). Therefore the heightmap will be generated within 0 m height and the maximum height.

Problems such as the following are a common occurrence:

  • Tall spikes are everywhere on the map or there are massive mountains and steep slopes:
    • Solution: Reduce the Maximum Height to a value that is more suited to the mountains and slopes you want
  • The map is very flat and has no hills or anything from my heightmap:
    • Solution: Increase the Maximum Height to a value that is suitable for making the hills you want

There's more...

Here are some other settings you might choose to use while generating the terrain.

Terrain generation settings

The following are the settings to generate a procedural terrain:

  • Feature Size: This value handles the general height manipulations within the seed and the size of each mound within the seed. As the size of the feature depends greatly on rounded numbers it is easy to end up with a perfectly rounded island, therefore it is best to leave this value at 7.0.
  • Bumpiness / Noise (Fade): Basically, this is a noise filter for the level. The greater the value, the more noise will appear on the heightmap.
  • Detail (Passes): This value controls how detailed the slopes will become. By default, this value is very high to see the individual bumps on the slopes to give a better impression of a rougher surface. Reducing this value will decrease the amount of detail/roughness in the slopes seen.
  • Variation: This controls the seed number used in the overall generation of the Terrain Heightmap. There are a total of 33 seeds ranging from 0 32 to choose from as a starting base for a basic heightmap.
  • Blurring (Blur Passes): This is a Blur filter. The higher the amount, the smoother the slopes will be on your heightmap.
  • Set Water Level: From the Terrain Editor window, you can adjust the water level from Modify | Set Water Level. This value changes the base height of the ocean level (in meters).
  • Make Isle: This tool allows you to take the heightmap from your level and automatically lowers the border areas around the map to create an island. From the Terrain Editor window, select Modify | Make Isle.

See also

  • The Terrain sculpting recipe
  • The Setting up the terrain texture recipe
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
13.58.209.201