← 🎨 Rendering

🎛 Controls

Palette
Preset tabs — switch texture  ·  Scale / Speed / Octaves — tweak shader  ·  Palette — recolour

About Procedural Textures

This simulation renders six classic procedural textures — marble, wood, clouds, fire, Voronoi cells and lava — entirely on the GPU using a single GLSL fragment shader. No image files are loaded; every pixel is computed from coordinate maths. The core primitive is value noise built from a sine-based lattice hash, summed across octaves as fractal Brownian motion (fBm): each octave doubles the frequency and halves the amplitude, producing detail at many scales.

The Scale slider (0.5×–4×) zooms the noise field, Speed (0×–3×) drives the animation clock and Octaves (1–8) sets how many fBm layers are summed, trading detail for speed. Preset tabs swap the shader branch, while Palette chips recolour via luminance to Grayscale or a Heat ramp. These same techniques power film and game art: bark, marble, smoke and lava are typically generated, not photographed.

Frequently Asked Questions

What are procedural textures?

They are textures whose every pixel is computed from a mathematical function rather than read from a stored bitmap. Because the colour is derived from the pixel's coordinates, the result is seamless, tileable and available at any resolution. This demo computes all six textures live in a fragment shader running on your GPU.

What is fBm and why is it used here?

Fractal Brownian motion sums several layers of noise, each at double the frequency and half the amplitude of the last. This gives both broad shapes and fine surface detail, which is why natural-looking clouds, marble and fire emerge. The Octaves slider controls how many layers, from 1 to 8, are added.

What do the Scale, Speed and Octaves sliders do?

Scale (0.5× to 4×) zooms the noise sampling, so low values show large structure and high values reveal fine grain. Speed (0× to 3×) multiplies the animation clock, and dragging it to 0 freezes the texture. Octaves (1 to 8) sets the number of fBm layers, adding richness at the cost of shader work.

How is the underlying noise actually generated?

A hash function scrambles each integer lattice point using fract of sin of a dot product, giving a pseudo-random value per grid corner. Value noise then smoothly interpolates the four surrounding corners with a smoothstep curve, and fBm stacks several scaled copies of this noise to build the final field.

How does the Voronoi preset differ from the others?

The Voronoi mode uses Worley, or cellular, noise instead of value noise. It scatters a seed point in each grid cell and, for every pixel, finds the nearest seed, returning that distance and the seed's hash. Each cell is then coloured from its seed and darkened near the borders, producing the characteristic mosaic of regions.

What do the Palette chips change?

Each texture has its own built-in colour ramp, which the Original chip leaves untouched. Grayscale converts the result to luminance using the standard 0.299, 0.587, 0.114 weights, exposing the raw noise value. Heat takes that same luminance and feeds it through a black-red-orange-yellow fire ramp, recolouring any texture as a thermal map.

Are these textures physically accurate?

No — they are artistic approximations, not physical simulations. Fire and lava do not solve fluid dynamics; they animate fBm fields with masks and sine warps to suggest motion. The aim is convincing, controllable visual detail at real-time speed, which is exactly how procedural textures are used in production rendering.

Why use a fragment shader rather than precomputed images?

Running in the fragment shader means the GPU evaluates the texture independently for every pixel in parallel, so the image is resolution-independent and never shows tiling seams or blurring when zoomed. It also costs almost no memory, since nothing is stored, and the texture can animate continuously by feeding time into the maths.

What does gamma correction do at the end of the shader?

After the colour is computed it is raised to the power 0.4545, which is one over 2.2. This converts the linear-light colour the maths works in into the sRGB space your display expects, so mid-tones look correctly bright rather than too dark. It is a standard final step in shader output.

Where are procedural textures used in the real world?

They are everywhere in 3D films and games: stone, wood, marble, water, clouds, skin and terrain are commonly generated rather than photographed. The same noise functions drive terrain heightmaps, planet surfaces and special effects. Voronoi noise in particular appears in computational geometry, cell biology models and game-world region maps.

Home/ Rendering/ Procedural Textures

What It Demonstrates

Procedural textures generate every pixel algorithmically instead of storing a bitmap. The key building block is fractal Brownian motion (fBm): a sum of noise at progressively doubled frequencies (octaves), each half the amplitude. This creates naturalistic textures with variation at multiple scales — from large cloud formations down to tiny surface roughness. Unlike tiled bitmaps, procedural textures are seamless and available at any resolution.

How to Use

Click a texture preset to switch shader mode. The Scale slider zooms into the noise field — small scale reveals large structure; large scale shows fine detail. Time Speed controls animation rate — drag to 0 to freeze. Grayscale mode reveals the raw noise value before palette mapping. For Voronoi, each coloured region is the territory of a random "seed point" — a concept used in computational geometry, biology and game terrain generation.

Did You Know?

Ken Perlin invented coherent noise in 1983 while working on the film Tron — he later won a Technical Achievement Academy Award for it. Steven Worley invented cellular/Voronoi noise in 1996. Today, virtually every 3D film and video game uses procedural textures: the bark, stone, water and skin you see are mostly mathematical functions, not photographs. Real-time procedural textures became practical with programmable GPU shaders in the early 2000s.