Turbulence

10 / 15
Learn procedural noise building blocks and common stylizations.

FBM has a smooth, gently rolling tonal curve. Turbulence folds that curve into sharp V-shaped valleys — where the noise crossed the midpoint, a dark crease appears instead of a smooth transition:

Let's break down the transform.


What abs(n * 2.0 - 1.0) does

Two steps:

  1. n * 2.0 - 1.0 — remaps [0, 1] to [-1, 1]; noise at 50% becomes 0, at 0% becomes -1, at 100% becomes 1
  2. abs(...) — folds negative values back to positive

The result: the smooth crossing through zero (noise at 50%) becomes a sharp V-shaped valley, and both extremes (0% and 100%) become bright peaks.

Applied on top of FBM, all the gentle midrange transitions turn into sharp dark creases — the kind of pattern you see at the edge of a flame or in the veins of marble.


Turbulence vs ridge

  • Turbulence: abs(n * 2.0 - 1.0) → midrange becomes dark valleys, extremes become bright peaks
  • Ridge: 1.0 - abs(n * 2.0 - 1.0) → midrange becomes bright peaks, extremes become dark valleys

They differ by just a 1.0 - inversion.


Try changing it

ChangeEffect
6.03.0Larger turbulent features, like surging air currents
6.012.0Fine, dense veins — like flickering flame texture
Add n = n * 0.9 + 0.05 before outputLifts the darkest valleys slightly
mix(orange, white, n) around the resultClassic fire or lava look

Exercise

Inside main, apply n = abs(n * 2.0 - 1.0) to the output of fbm(vUv * 6.0) and display the result.

Answer Breakdown

Add one line after float n = fbm(...): n = abs(n * 2.0 - 1.0).

  • n * 2.0 - 1.0 — stretches [0,1] to [-1,1], placing the midpoint at 0
  • abs(...) — folds the negative half back up, creating V-shaped creases at every zero crossing

The starter produces smooth fractal noise. Adding this single line folds the tonal curve so every midrange transition becomes a sharp dark line, producing the turbulent look.

Try changing 2.0 to 3.0 — the V-shaped valleys will narrow and deepen, making the creases even sharper.

GLSL Code Editor

Correct Code Preview

Current Code Preview