Friday, September 14, 2007

Fractal Terrain Generation (Fault Formation)

Basically, all we do is add a random line to a blank height field, and then we add a random height to one of the sides.


The first step in the fault-formation algorithm.




Examples of heightmaps created after several “fault formation” passes.



Erosion Filter

all we are really doing here is “mixing” a bit of the previous pixel with the current pixel.


ucpBand[j]= fFilter * ucpBand[j-1] + ( 1-fFilter ) * ucpBand[j];


ucpBand[j] : Current pixel height
ucpBand[j-1] : Previous pixel height
fFilter : Filter factor (0.3~0.6)



Heightmaps that were generated using the fault-formation algorithm and the erosion filter.

The top image has a filter value of 0.0f, the middle image has a filter value of 0.2f, and the bottom image has a filter value of 0.4f.



Feature

1 it does not place a restriction on what dimensions must be used for the generated heightmap, whereas midpoint displacement requires that the dimensions be a power of two. (The dimensions must also be equal, so although you can generate a heightmap of 1024 × 1024, you cannot generate a heightmap of 512 × 1024.)

2 works great for a nice little scene composed of some small hills, but what if you want something more chaotic than that, such as a mountain range? Midpoint displacement is the answer

No comments: