Procedural Terrain: terrain features, water erosion, tree generation

For the final project of a computer graphics class, I created a framework for generating procedural terrain. The basic idea is to create a fully featured and realistic terrain automatically, with the option of user interaction at every step.

The framework follows the following steps:

  1. Create an initial island shape
  2. (optionally) edit the terrain using feature curves to add hills, mountains, cliffs, riverbeds,…
  3. simulate water erosion to increase the realism
  4. assign biomes and plant trees and grass

This video shows the final output on a small scale

The project is open-source, hosted on https://github.com/shamanDevel/ProceduralTerrain.
You can use the code for free (as long as you respect the Apache licence).
For all implementation details, the third-party libraries that I’ve used and the paper that I’ve implemented, I refer to the Paper that I’ve written about it.

The four processing steps are shown in detail in the following four movies:
Step 1: from an initial island shape in 2d to the first terrain heightmap:


Step 2: adding features (hills, mountains, cliffs, …) by specifying feature curves:

Step 3: simulating water erosion, this creates riverbeds and adds small details and roughness to the terrain

Step 4: assign biomes, add grass (the forester still works) and trees (impostors)

This is a work in progress, use with care. However, I don’t know how much time I will spend on this project in the future (course is over).
Todo list:

  • Tree impostors are not correctly generated from the high-poly models, the transition is still visible
  • improve paging of trees, I often run out of memory when there are too many high-poly trees in the scene
  • support more grass variation and better close-up rendering
  • draw rivers and lakes, I already get all the flow data from the erosion simulation
  • port the feature solver and erosion solver to the gpu, the cpu implementations do not run in realtime

Greetings,
ShamanDevel

20 Likes

Do you have any improvements in terrain generation algorithm over original from http://www-cs-students.stanford.edu/~amitp/game-programming/polygon-map-generation/ or it’s just pure port to java with better visuals and utility (JME render, trees, grass, water, manual editing)?

P.S. don’t get me wrong - It’s a lot of work and great visual result.

Yes, the first step is mostly a port of this terrain generation algorithm plus 3d heightmap generation.

But for the second step, I implemented this paper:


with the addition of limiting the smoothing influence so that I can directly apply the terrain feature curves to existing terrain.

The third step is a cpu implementation of
http://www-evasion.imag.fr/Publications/2007/MDH07/FastErosion_PG07.pdf
with the improvement of non-uniform temperature and a different erosion computation.

Vegetation: The grass is based on the forester (with some modification, it still works under jME3.1), for the trees I wrote an adapter from http://arbaro.sourceforge.net/ to jME and I create impostors for distance rendering.

2 Likes

Very impressive work.
Congratulations.

Hello
congratulations
very well
i try the Framework
but i do not find how to save the file when the 4 steps are done …!
sorry for my english

Good point. If I recall correctly, I implemented the save-function only after step 1 to 3. This was to save time during development because the later stages often crashed and I didn’t want to go through the whole pipeline everytime I change something. Hence, no, there is no possibility to save after the last stage.

hello
great thanks for your quickly answer
excuse for question again:
i understood that the files are saved under a “saves” repository
i created this repository and they saved automatically !
but with file extension “.save” not “. j3md”
how these files could be insert in a jme3 projetct ?
greetings

https://jmonkeyengine.github.io/wiki/jme3/advanced/material_definitions.html#toolbar

I haven’t looked at this project but you most likely also want to learn,
https://jmonkeyengine.github.io/wiki/jme3/advanced/save_and_load.html#custom_savable_class

These .save files are written with the ObjectOutputStream, contain some data like elevation and moisture for the next stage, but were never intended to be used outside of this project.
If you want to use the final generated island, I think it is best if you modify the code on your own so that the scene is saved to an .j3d .

thanks to both
very usefull stuff
a little heavy job for me, but why not
i will learn

I haven’t seen this format, or at least I can’t find it for jme.
https://jmonkeyengine.github.io/wiki/jme3/intermediate/file_types.html#toolbar

Typo? or what is it?

Typo. It’s j3o

1 Like