General > Terragen Discussion

Fractal procedural erosion shader public beta

(1/35) > >>

I am pleased to present the beta version of fractal procedural erosion shader for Terragen. It is developed using Terragen SDK.

At the present it works on Windows only, no OS X version yet.

And yes, it’s free.

Shader process it’s input and outputs eroded landscape. But may be it is better to interpret it as eroded landscape synthesizer which is basing on uneroded input landscape.

Achieving good-looking results highly depends on how the unprocessed terrain was designed. Original landscape doesn't need to have many small-sized details, they can sometimes confuse the algorithm. Moreother, usually small details are shaved off completely and algorithm generates its own details. So you can generate original landscape using lesser number of octaves, also it is faster.

Currently shader doesn't process truly infinite area, as one can expect from procedural algorithm. Actually it handles the square area of size approx. (1000 * Erosion scale)^2 (1000 km * 1000 km for default settings) centered at (0, 0). The support of much bigger sizes is planned in the future.

Shader uses extensive RAM caching during its work, and can hog up to several gigabytes. You can control the amount of RAM which shader can use, but actually the more RAM you have, the faster plugin works, especially during the animation rendering.

To evaluate a single point algorithm has to evaluate context area around: to sample original area and to build drainage network; it results in a noticeable delay before actual render or even just preview starts updating. But all data is being cached, so evaluating of a point next to first takes much less time. The less distance between points, the less new data has to be evaluated. So after initial delay rendering is speeding up. And if you render the animation, subsequent frames are rendered faster than the first. But if the erosion cache grows too large (bigger than limit) it is being flushed, and shader has to rebuild some data again.

To install just extract the dkerosion.tgp into "Plugins" subfolder in your main Terragen folder. There are two builds, 32 and 64 bit, you need to install just one of course. Then you can find the erosion shader in the Displacement Shader section of shaders.

Terragen 3.3 or higher required.

Some images:

By Ulco Glimmerveen (Dune):

By Martin Huisman (Tangled-Universe):

Version 0.4.0 beta. (148.4 kB - downloaded 874 times.)


Parameters guide:

Scale tab:

Scale (in meters). Sets the size of biggest erosion features, this is the average distance between biggest ridges. In overall, the more the scale, the more eroded is the terrain. For big mountain ranges you can try the values of 2k or higher.
Scale = 400

Scale = 1000

Scale = 2000

Large-scale attenuation. Attenuates the first and slightly the second octaves, working somewhat similar to Feature scale parameter in Power. Can be useful to making largest valleys less prominent.
Large-scale attenuation = 0.0

Large-scale attenuation = 0.7

Octaves - sets the number of Fractal octaves.

Dynamically reduce the number of octaves - allows algorithm to calculate less octaves if higher octaves are too small and invisible – for example, at distant view. Greatly speeds up the rendering.
Technically this parameter is needed if you want to stack multiple erosion plugins serially. In this case you need to set it off for all instances except last.

Non-rendering octaves. This is abridgement of "Non-rendering context octaves". The number of octaves used for populations.
As was written, usually it is beter to enable "Dynamically reduce number of octaves" option for better performance. In this case distant area will be evaluated using lesser number of octaves, so actual number of rendered octaves depends on the camera position. This will work wrong if populations used, so Erosion shader ignore this option and "Octaves" parameter and will use "Non-rendering octaves instead. Using usual "Octaves" parameter can be very slow process, imagine populating area of 10x10 km using Scale = 1000 m and 16 octaves - it forces the shader to evaluate the whole square of 10x10 km with 3 cm resolution. So I recommend to set "Non-rendering octaves" to a values lesser than "Octaves". You can try various values and find a good compromise between populating process speed and populating accuracy.

Parameters tab:

Hardness and Rock removal: affect the profile of gullies. Hardness controls the slopes of gully (and partly depth), and Rock removal controls overall erosion effect, changing depth and width of gullies.
Hardness = 0.3, Rock removal = 1.0

Hardness = 0.8

Rock removal = 0.4

Illustration of effect of these parameters on gully profile:

Deposition amount controls the sedimentation. Can be set to the values higher than 1.0. Rivers example from the first post used Deposition amount set to 1.5
Deposition amount = 0.5

Deposition amount = 0.8

Deposition floor creates global layer of sediment which covers all places with altitude lower than Deposition floor value.

Smooth ridges. Generates rounded ridges instead sharp, but its effect reduced by further generating of higher octaves.

Limited gullies length - limits the length of gullies so they won't form long structures

Gullies sharpening – sets the amount of sharpening the gullies at beginning.

Smooth surface – smoothes surface, can be useful if it is need to generate a limited octaves picture.

Maps tab.

Erosion shader can generate not only displacement, but also color 2D-images, which can be used for masking other shaders. These images called maps.

To use maps, you need to turn on “Enable maps” parameter. Basically that’s all – you can link Erosion shader to Mask input of other shader. Default map to output is Deposition map.

In this example I want to shade deposition layer, so I added Surface layer and linked Erosion shader to Surface layer’s Mask input.

You can see that deposition map has smooth cloudy edges, it is rarely useful (but can display thickness of deposited sediment), so I added Colour adjust shader and set White point to 0.01 – it is enough for sharp edges.

Also I want to add a second map to display erosive flows. Erosion shader able to output up to three maps in the same time, it uses color coding for that. Using “Red”, “Green” and “Blue” parameters you can select desired map, and it will be output using that color component.

To extract needed map from complex output you need to use “Red to scalar”, “Green to scalar” or “Blue to scalar” functions in the “Function->Convert” section of shaders.

So I used Green and Blue components for Deposition Map and Flow Map A.

There are two flow maps in the shader – A and B. You can use first map for shading, and second to generate displacement based on flows – it is useful for creating river channels (you need to link this map into Displacement Function input of a shader which generates disoplacement, for example, Displacement shader or Surface shader, and set Displacement amplitude to negative value). Flow map B has important hardcoded property for rivers: lesser flows are scaled to have lesser depth. Flow map A use equal intensity for all flows.

You can limit the number of octaves for both flow maps (usually it is enough 1…3 octaves for rivers) using map octaves parameters, and set smoothing for flow maps using smoothing parameters (useful for smoother river channels).

Mask tab.

Erosion shader can be masked by other shaders, it can be useful for limiting the erosion effect.

There are usual Mask by shader and Invert mask parameters, and also three masking modes.

This is original terrain and also fully processed by erosion:

Masked terrain with all modes off:

Limit erosion to mask. This mode tries to keep erosion inside mask without sharp transitions at the edges of mask even if mask is just black and white colors. Erosion effect can go out of mask a little.

Mask as blend - common blending mode, multiplies erosion effect by mask (attenuating displacement by grey colors).

Mask as rock removal - mode which keeps the slopes, often looks more natural than Mask as blend mode.

You can combine the modes.


Great. Thanks a lot for developing this shader!

Wow this is fantastic!!!
Thank so much ;)

j meyer:
Thank you very much! Especially for sharing it for free with the community.
Much appreciated!


[0] Message Index

[#] Next page

Go to full version