Terrain

Hi,



I have created terrain generation functionality (part of a game project I am working with).



Here is something that has been implemented:

  • Diamond Square height map generator (http://en.wikipedia.org/wiki/Diamond-square_algorithm)
  • Generating heightmap with: mountains, flat terrain, water. At generation time user can give percentages of how much of mountains,flat terrain and water exists in the terrain.
  • Generating textures for the terrain according to height map. For example, according height values apply following materials: snow, rock, grass, sand and finally material which is sea floor.



    See a screenshot of generated terrain in jme3: http://users.utu.fi/sampie/jme/diamondterrain.png



    If this is something that is interesting (?) I can contribute the code for JME3 project.
4 Likes

The code is available at: http://users.utu.fi/sampie/jme/DiamondTerrain.zip



Just drop in jme3 libs and run DiamondTerrain.java. It takes couple seconds to generate the terrain.

How does it compare with the existing JME3 terrain system? What does it offer over and above?

Nice

It uses the jme terrain system. it’s a system for generating heightmaps, and also splat-maps that textures the terrain depending on elevation.



nice job.

@sampie said:
If this is something that is interesting (?) I can contribute the code for JME3 project.

It could be made a plugin for the SDK to generate terrain with a wizard maybe?

Looks nice Sampie.

A plugin to the sdk would be wonderful. An enhancement too: textures based on slope (ie. no grass on steep slopes).

@Sploreg said:
Looks nice Sampie.
A plugin to the sdk would be wonderful. An enhancement too: textures based on slope (ie. no grass on steep slopes).

thats what i was thinking as well, i really like how he did it with out any shader :P

Good work! The automatic splatmap generation is a feature jME3 currently lacks :slight_smile:

Is it just elevation or is it slope too?

Unfortunately the implementation does not include slope based texturing, only heightmap values are used as a such.



There seems to be a bug in splat texture generator. Fixed package can be found from: http://users.utu.fi/sampie/jme/DiamondTerrain-2.zip



I also tweaked texture fallout values to get a slightly new look for following close-up screenshots. :slight_smile:

http://users.utu.fi/sampie/jme/diamondterrain-2.png

http://users.utu.fi/sampie/jme/diamondterrain-3.png

http://users.utu.fi/sampie/jme/diamondterrain-4.png