Fluid shader tutorial, fractal noise

Arctangent noiseIf you recall that fluid dynamics shader I posted last week, I’ve written an article about how to write one. Check it out!

Currently I’m working on an article about using fractal noise to pick things like terrain types for procedural world generation. It turns out that getting uniformly-distributed fractal noise is a bit tricky. Usually when you add multiple independent noise sources together as you do in fractal noise synthesis, you get values that are Gaussian-distributed (in fractal noise you can get other things because of the fractal nature). If you’re using those noise values to pick from a weighted list, the weights will get all messed up because of the shape of the noise distribution. The trick is to use a continuous function to map the Gaussian-distributed noise to a uniformly-distributed range.

In practice this is tricky to do without creating undesirable shapes in the noise – for example, if you use modulo to wrap the noise to the [0,1] interval you get high-frequency bands. The solution I’ve found so far is to use two noise samples and use the arctangent to generate an angle using those samples. This will still have certain unpleasant features – ‘vortices’ where both noise functions approach zero – but they are greatly reduced compared to the modulo approach (see the picture on this post).

Leave a comment