Tileable Heightmap

Hi there,



I’ve made a simple subdivide and displace heightmap class with seamless edges.

I’m using it in a wrap around terrain: http://www.outshine.de/



  • size: the size must be 2^n + 1

  • roughness: how chaotic to make the terrain.

  • seed: for random number generator. same seed same map.




import java.util.Random;
import java.util.logging.Level;

import com.jme.math.FastMath;
import com.jme.system.JmeException;
import com.jme.util.LoggingSystem;
import com.jmex.terrain.util.AbstractHeightMap;

/**
 * <code>SubdivideDisplaceHeightMap</code> creates a tileable heightmap based on the
 * Subdivide and Displace algorithm.
 *
 * size must be n^2 + 1
 *
 * @author J