====== The design/inflate algorithm ====== ===== Introduction ===== The design/inflate algorithm begins with a low-resolution [[l3dt:reference:maps:dm|design map]] in which the basic shape of the final heightfield is laid out, including land altitudes, the position of volcanos, etcetera((The design map is itself generated by a pseudo-fractal algorithm, the details of which are unimportant.)). This map is called a //design map// because it allows the user to design the heightfield prior to calculation ([[#demonstration|see demonstration]], below). To generate the heightfield, the design map is '[[l3dt:algorithms:hf:inflate|inflated]]' using a diamond-square fractal algorithm. Heightfield overlays are applied at each stage of the inflation process, including [[l3dt:algorithms:hf:peakrough|peak roughening]], [[l3dt:algorithms:hf:erosion|erosion]], [[l3dt:algorithms:hf:terrace|cliffs & terraces]], and various 'special' terrain types like [[l3dt:algorithms:hf:mountain|mountain peaks]], [[l3dt:algorithms:hf:plateau|plateaux]], [[l3dt:algorithms:hf:volcano|volcanos]], etc. Smooth effects such as peak overlays are done earlier, at low map resolution. Highly detailed overlays such as terraces, volcanos, etc are done later, at high map resolution. Most of the overlay operations, therefore, work on the heightfield when the map area is only 1/4th, 1/16th, 1/64th (etc) of the final map size. Diamond-square subdivision is significantly faster per-pixel than most of the overlay routines, so this scheme greatly reduces the total calculation time. The speed bonus for this approach was a bit over 10x between [[l3dt:history:v1.0|L3DT v1.0]] (no inflation) and [[l3dt:history:v1.5|v1.5]] (inflation). ===== Algorithm outline ===== The heightfield is generated from the design map in the following way: - The heightfield is created at the same resolution as the [[l3dt:reference:maps:dm|design map]] and is seeded with the altitude values from that map. - The heightfield is '[[l3dt:algorithms:hf:inflate|inflated]]' by a factor of 8× using a diamond-square routine to fill-in values by fractal interpolation. - [[l3dt:algorithms:hf:peakrough|Smoothed peaks]] are overlaid on the heightfield to make rolling hills. The size / number of peaks is determined by the 'Peak' values in the design map. - The heightfield is inflated 4×. - Low-res 'special' overlays are applied (inc. [[l3dt:algorithms:hf:mountain|mountain peaks]], [[l3dt:algorithms:hf:volcano|volcanos]]). - The heightfield is inflated 2× (for the last time). - High-res 'special' overlays are applied (inc. [[l3dt:algorithms:hf:plateau|plateaux]]). - [[l3dt:algorithms:hf:terrace|Terracing]] is applied. - [[l3dt:algorithms:hf:fileoverlay|File overlays]] are applied. At several stages of this procedure, the heightfield is eroded by the thermal, fluvial and/or channelling [[l3dt:algorithms:hf:erosion|erosion]] routines. The number, type and sequence of erosion passes is still a matter of some volatility within L3DT and thus they were omitted from the above list. The inflation/overlay algorithm was first implemented in mid-2003 (in [[l3dt:history:v1.5|L3DT v1.5]]), but remains a continually mutating and evolving beast. ===== Demonstration ===== Below I present a rather artificial looking design map that I painted to illustrate the operation of the design/inflate algorithm. I have divided this map into 4 quadrants. In the centre of each quadrant I have made small mounds and placed volcanos atop them. The top left quadrant has no roughening, the top right has only //peak//-roughening (green), the bottom left has only //fractal// roughening (red), and the bottom right has both //fractal// and //peak// roughening (red + green = yellow). In the centre of the map I have painted some //cliffs// (blue). The little //Vo 0// tags indicate the position of type-zero volcanos (smallish ones).
| {{l3dt:algorithms:hf:design_inflate:dmdemo.gif}} | ^ A bizarre design map. ^
The heightfield was then generated by the inflation/overlay algorithm. You can see from the light map below the effect of the peak and fractal roughening, as well as the cliffs in the middle.
| {{l3dt:algorithms:hf:design_inflate:lm1.gif}} | ^ The light map. ^
What does it look like in 3D?
| {{l3dt:algorithms:hf:design_inflate:techshot2.jpg}} | ^ Screenshot from //L3DT Viewer//, looking from the west towards the east.
Note terracing at the intersection of the quadrants. ^
Of course, you can use this flexibility to design maps much more interesting than this. Island chains, sea cliffs, mountain ranges (etc, etc) are all a few mouse clicks away thanks to the easy-to-use design interface. Please refer to the [[bundywiki>tutorials:l3dt:fjord|making a fjord]] tutorial for a more elaborate demonstration.