Eroding Fractal & Procedural Terrains Using Heightfield Fluids
|Research Project||Greg Turk||Summer 2012-Spring 2013||Java/Processing||No||Github Repo|
This was my first undergraduate research project. Initially based on Ken Musgrave's terrain generation and erosion using a simple first order fluid model, I implemented Square Square subdivision to generate the fractal terrain (Gavin Miller, 1986) and then moved to using a 2nd order "Pipes" model of fluid transport built from the shallow water equations. I also ended up building a bunch of procedurally generated meshes, including infinite winding rivers, meshes with non-erodable "boulders", and full UI control and visualization of all simulation parameters.
I had a few creative solutions to keep the process "water tight/sediment preserving" (no loss/gains in eroded sediment or water transport), which most of the extant literature at the time didn't really seem to care about, and I also had a few creative solutions to get better results, including a method that allowed for lateral erosion (mass wasting) of river banks (dry terrain adjacent to nodes of the fluid heightfield) and having sediment transport happen during the fluid transport stage, speeding up computation.
The UI controls were something I built for this simulation that I have since modified to use in all my Java simulation and graphics projects.
I've always felt that this simulation would make a neat paintbrush-type tool - erode your mesh! Despite that it's based on Height-field fluid, the "terrain" doesn't have to be flat for it to work. I've just not had the time to migrate it to MEL/Maya.
I revisited this project in 2014 and changed it to integrate with Midpoint method instead of Explicit Euler, and I also added an external call to a matlab script I wrote to conduct finite element analysis to determine the strains of the surface due to the forces of the fluids. This revealed another mechanism for determining the amount of terrain to errode.
Below are some videos of the system in action (with links if the videos don't play automatically) :
|Fractal Terrain Subdivision (Square-square algorithm)|
|Erosion on infinite river around non-eroding boulders. I added the boats to show the motion of the fluid - they are rigid bodies with mass and displacement, and so are bouyant. Their motion is governed by the fluid forces around them, while their orientation is determined by the fluid velocity at their location.|
|Erosion over a wall - the red mesh denotes the sediment motion.|
|Erosion (Mass Wasting) of a cliff - again, the red mesh denotes the sediment motion. Note how it seems to lead the fluid motion - this is because the sediment transport capability of the fluid is determined by the fluid velocity. The fastest moving fluid, as can be seen by the velocity arrows, is the fluid in the rising wake of the wave, and so this fluid carries the most sediment.|