procedural-noise
Skill0 starsChanged 7 months agoMITView on GitHub
Procedural noise — Perlin, Simplex, Worley, fBm, domain warping, derivatives — for organic randomness in shaders, generative art, terrain, particles, and animation. Language-agnostic algorithmic concepts; use when the user is implementing or tuning noise-based effects in any shader/graphics framework (GLSL, WGSL, TSL, Houdini VEX, p5.js, Substance Designer, etc.). Triggers: "noise", "Perlin", "Simplex", "Worley", "fBm", "fractal noise", "domain warp", "turbulence", "ridged noise", "flow field", "procedural texture", "terrain heightmap", "organic displacement".
In this repository2 other files it gives its agents.
- react-three-fiberSkill
- tslSkill
The file
We split this skill into the rules it gives an agent
1 rule. About 0 are common, 1 is distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 322
Use lower precision where acceptable
≈ “Common” is an estimate: at least 1 in 5 of the 213,895 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Procedural Noise
Smooth, organic randomness for natural-looking variation. Framework-agnostic — pseudocode and concepts that translate to any shader/graphics language.
Contents
- Core philosophy
- Types of noise
- Basic usage by dimension
- Fractal noise (fBm)
- Domain warping
- Noise derivatives
- Ridged noise & turbulence
- Worley / cellular noise
- Common patterns
- Coordinate spaces
- GPU considerations
- Quick reference
Core philosophy
Random = chaotic, jarring, unnatural. Noise = smooth, continuous, organic.
Noise functions return values that change gradually as inputs change. Adjacent inputs produce similar outputs.
Types of noise
| Type | Dimensions | Character | Performance |
| Value noise | 1D–4D | Blocky, visible grid | Fast |
| Perlin noise | 1D–4D | Smooth, classic look | Medium |
| Simplex noise | 1D–4D | Smoother, fewer artifacts | Medium |
| Worley/Cellular | 2D–3D | Cell-like, organic | Slower |
Most graphics frameworks expose at least one of these — common names: noise, snoise, cnoise, perlin, simplex, worley. TSL provides the MaterialX family (mx_noise_float, mx_worley_noise_float, mx_fractal_noise_float, etc.); GLSL projects often pull in IQ's snoise; WGSL and Houdini VEX have their own equivalents. Pick whichever your framework provides.
Basic usage by dimension
1D noise (time-based)
// Smooth animation
value = noise(time × speed)
// Jittery camera, organic pulsing
offset = noise(time) × amplitude2D noise (texture/surface)
// Heightmap, displacement
height = noise(x × scale, y × scale)
// Animated texture (preferred: 3D noise with time as z)
value = noise(x, y, time)3D noise (volumetric)
// Animated surface displacement
displacement = noise(position.x, position.y, time)
// True 3D: clouds, fog, terrain caves
density = noise(x, y, z)Fractal noise (fBm)
Layer multiple octaves to get natural detail at multiple scales. The single most common pattern in procedural noise work.
Algorithm
function fbm(position, octaves, lacunarity, persistence):
total = 0
frequency = 1
amplitude = 1
maxValue = 0 // for normalization
for i in range(octaves):
total += noise(position × frequency) × amplitude
maxValue += amplitude
frequency *= lacunarity // typically 2.0
amplitude *= persistence // typically 0.5
return total / maxValue // normalize to roughly [-1, 1] or [0, 1]Parameters
| Parameter | Typical | Effect |
| octaves | 4–8 | More = more detail, slower |
| lacunarity | 2.0 | Frequency multiplier between octaves |
| persistence | 0.5 | Amplitude decay between octaves |
| initial frequency | varies | Overall scale |
Compact form
function fbm(p):
value = 0
amp = 0.5
freq = 1.0
for 6 octaves:
value += amp × noise(p × freq)
freq *= 2.0
amp *= 0.5
return valueDomain warping
Distort the input coordinates using noise itself — gets you swirling, organic shapes that pure fBm can't.
Basic warp
warped = noise(position + noise(position))Multi-layer warp (Inigo Quilez style)
q = vec2(
fbm(position),
fbm(position + vec2(5.2, 1.3))
)
r = vec2(
fbm(position + 4.0 × q + vec2(1.7, 9.2)),
fbm(position + 4.0 × q + vec2(8.3, 2.8))
)
result = fbm(position + 4.0 × r)Animated warp
q = vec2(
fbm(position + time × 0.1),
fbm(position + vec2(1.0) + time × 0.15)
)
warped = fbm(position + strength × q)Noise derivatives
Get the gradient/slope of noise — needed for normals from heightmaps, flow-field directions, erosion simulation.
Analytical derivatives
Some implementations return the gradient directly:
vec4 result = noiseWithDerivatives(position)
// result.x = noise value
// result.yzw = gradient (∂n/∂x, ∂n/∂y, ∂n/∂z)Cheaper than numerical sampling and exact. Prefer when available.
Numerical derivatives (fallback)
epsilon = 0.001
gradient.x = noise(p + vec3(epsilon, 0, 0)) - noise(p - vec3(epsilon, 0, 0))
gradient.y = noise(p + vec3(0, epsilon, 0)) - noise(p - vec3(0, epsilon, 0))
gradient.z = noise(p + vec3(0, 0, epsilon)) - noise(p - vec3(0, 0, epsilon))
gradient /= (2 × epsilon)Costs 6 noise evaluations per sample.
Normal from heightmap
// 2D heightmap → 3D normal
normal = normalize(vec3(-gradient.x, 1.0, -gradient.y))Ridged noise & turbulence
Ridged
Sharp ridges instead of smooth hills. Good for mountain crests, lightning, marble veins.
function ridgedNoise(position):
n = noise(position)
return 1.0 - abs(n)
function ridgedFbm(position, octaves):
// Same as fBm but use ridgedNoise
// Optionally multiply by previous octave for sharper ridgesTurbulence
Absolute value of noise, always positive. Good for fire, smoke, billowy clouds.
function turbulence(position, octaves):
total = 0
frequency = 1
amplitude = 1
for i in range(octaves):
total += abs(noise(position × frequency)) × amplitude
frequency *= 2
amplitude *= 0.5
return totalWorley / cellular noise
Distance to nearest random feature point. Cell-like patterns, cracked surfaces, organic cell membranes.
function worley(position):
minDist = infinity
for each neighbor cell:
featurePoint = cell + random offset
distance = |position - featurePoint|
minDist = min(minDist, distance)
return minDistVariations
- F1 — distance to nearest point → cell interiors
- F2 — distance to second nearest → cracks
- F2 − F1 — cell edges (the Voronoi look)
Common patterns
Marble / wood grain
value = sin(position.x × frequency + turbulence(position) × amplitude)Clouds
density = fbm(position + time × windSpeed)
density = smoothstep(threshold, threshold + softness, density)Terrain
height = fbm(position.xz × scale)
// Add erosion ridges
height += ridgedFbm(position.xz × 2) × 0.3Flow field
angle = noise(position) × 2π
velocity = vec2(cos(angle), sin(angle))Organic shapes (distorted circle)
angle = atan2(position.y, position.x)
radius = baseRadius + noise(angle × frequency + time) × amplitudeCoordinate spaces
Scale / frequency
// Larger scale = smoother, larger features
noise(position × 0.1)
// Smaller scale = more detail, smaller features
noise(position × 10.0)Offset / seed
// Different "seed" by offsetting into a different region of noise space
noise1 = noise(position)
noise2 = noise(position + vec3(100, 200, 300)) // uncorrelatedSeamless tiling (2D via 4D noise)
u = position.x / width
v = position.y / height
noise(
cos(u × 2π) × scale,
sin(u × 2π) × scale,
cos(v × 2π) × scale,
sin(v × 2π) × scale
)The trick: wrap each axis around a circle in higher dimensions so it returns to the same value at the boundary.
GPU considerations
Performance
- Fewer octaves = faster (4 is often enough)
- Texture-based noise lookup can beat computed noise for static patterns
- Precompute static noise to textures
- Use lower precision where acceptable
Banding prevention
// Add tiny noise to break up visible quantization steps
value += noise(position × 1000) × 0.001Common GPU noise functions
// Most shader environments provide:
noise(vec2) // or noise2D, snoise, cnoise
noise(vec3)
noise(vec4)
// fBm is usually a manual implementation, except where library
// functions like mx_fractal_noise_* exist.Quick reference
| Pattern | Formula |
| Basic noise | noise(p × scale) |
| fBm | Σ amplitude × noise(p × frequency) |
| Ridged | 1 - abs(noise(p)) |
| Turbulence | Σ abs(noise(p)) |
| Domain warp | noise(p + noise(p)) |
| Flow angle | noise(p) × 2π |
| Marble | sin(x + turbulence(p)) |
| Worley F1 | distance to nearest feature point |
| Worley F2−F1 | cell edges (Voronoi look) |
| Parameter | Typical range |
| Octaves | 4–8 |
| Lacunarity | 2.0 |
| Persistence | 0.5 |
| Scale | 0.01–10.0 (context dependent) |
References
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

