FluidSimHeightMap

Hi guys. I’ve ported another terrain generation variant to jME. This time it’s Terrain Generation Using Fluid Simulation from a GameDev.net article.

For more information on how the algorithm works and what the respective parameters do I recommend having a look at it.



It seems to be rather tweakable and has nice results. The only downside I see is the hightmap data on the edges. You will either get a a steep wall or slope depending on the minInitialHeight and maxInitialHeight parameters. However I’m sure one could simply cut off the heightmap values on the sides if there is any need for it (since a skybox might always cover it).



Feel free to throw it into the CVS if you want.



TestFluidSimHeightmap.java


package jmetest.terrain;

import javax.swing.ImageIcon;

import jmetest.terrain.TestTerrain;

import com.jme.app.SimpleGame;
import com.jme.image.Texture;
import com.jme.input.NodeHandler;
import com.jme.light.DirectionalLight;
import com.jme.math.Vector3f;
import com.jme.renderer.ColorRGBA;
import com.jme.scene.CameraNode;
import com.jme.scene.state.CullState;
import com.jme.scene.state.TextureState;
import com.jme.util.TextureManager;
import com.jmex.terrain.TerrainPage;
import com.jmex.terrain.util.ProceduralTextureGenerator;

/**
 * <code>TestFluidSimHeightmap</code> demonstrates the usage of
 * <code>FluidSimHeightMap</code>.
 *
 * @author Frederik B

Too bad about those edges. Must be so the fluid doesn't leak out?  :stuck_out_tongue:



But it looks so damned cool I added it anyway :slight_smile: