{
 "id": "perlin-noise",
 "title": "Perlin Noise (gradient lattice noise)",
 "aliases": [
  "classic Perlin noise",
  "gradient noise"
 ],
 "domain": "procgen",
 "subdomain": "noise functions",
 "stage": "procedural",
 "realtime": "realtime",
 "platforms": [
  "webgl2",
  "webgpu",
  "desktop-gpu",
  "mobile-gpu",
  "cpu",
  "blender",
  "houdini",
  "unity",
  "unreal",
  "godot",
  "python"
 ],
 "year_introduced": 1985,
 "inputs": [],
 "outputs": [
  "texture",
  "heightfield",
  "volume-density"
 ],
 "style": "both",
 "dynamic": "both",
 "summary": "A smooth, band-limited pseudo-random scalar field built by placing random gradient vectors on an integer lattice and blending their dot products. The original building block for procedural textures and terrain.",
 "how_it_works": "Space is divided into unit cells. Each lattice corner gets a pseudo-random gradient vector, chosen by hashing the integer coordinates through a permutation table, so the field is a pure function of position with no stored data. For a sample point you take the offset vector to each corner of its cell, dot it with that corner's gradient, and blend the results with a smooth interpolant. Because every corner contributes exactly zero at its own location, the field passes through zero at lattice points and has a characteristic feature size of about one cell, which makes it band-limited and a good octave for spectral synthesis. Original 1985 noise used a cubic Hermite blend (3t^2-2t^3), which leaves visible second-derivative discontinuities; that flaw is what the 2002 revision fixes. Cost scales as 2^n corners in n dimensions.",
 "when_to_use": "Choose it when you need a cheap, repeatable, seedable smooth field for clouds, marble, bump maps or heightfields, and axis-aligned artifacts are tolerable. Prefer `improved-perlin-noise` for anything you will differentiate or use as a normal map, `simplex-noise` for 4D or higher dimensions or less grid bias, and `worley-noise` when you want cell or crack structures rather than blobs.",
 "cost": {
  "class": "cheap",
  "notes": "A handful of hash lookups and multiplies per octave; qualitative only. Dominated by octave count when summed as fBm."
 },
 "failure_modes": [
  "Axis-aligned grid bias: features and zero-crossings line up with lattice axes, visible as faint squares at low frequency",
  "Cubic Hermite fade gives second-derivative discontinuities, visible as creases in bump-mapped or lit surfaces",
  "Output is zero at every integer lattice point, so unrotated stacked octaves reinforce the same lattice pattern",
  "Range is not exactly [-1,1]; real amplitude is smaller and varies by dimension, which breaks naive thresholding"
 ],
 "sources": [
  {
   "role": "primary",
   "key": "doi:10.1145/325334.325247",
   "type": "paper",
   "title": "An image synthesizer",
   "authors": [
    "Ken Perlin"
   ],
   "year": 1985,
   "venue": "Proceedings of the 12th annual conference on Computer graphics and interactive techniques  - SIGGRAPH '85",
   "url": "https://doi.org/10.1145/325334.325247",
   "ids": {
    "doi": "10.1145/325334.325247"
   },
   "license": null,
   "extra": {
    "csl_type": "proceedings-article"
   },
   "provenance": {
    "title": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1145/325334.325247",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "authors": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1145/325334.325247",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "year": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1145/325334.325247",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "venue": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1145/325334.325247",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "url": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1145/325334.325247",
     "checked_at": "2026-11-29T15:51:27.588Z"
    }
   },
   "status": "verified",
   "checked_at": "2026-11-29T15:51:27.588Z",
   "title_sim": 1,
   "__bib": "perlin1985image"
  },
  {
   "role": "tutorial",
   "key": "url:https://thebookofshaders.com/11",
   "type": "tutorial",
   "title": "The Book of Shaders: Noise",
   "authors": [
    "Patricio Gonzalez Vivo"
   ],
   "year": null,
   "venue": "thebookofshaders.com",
   "url": "https://thebookofshaders.com/11",
   "ids": {},
   "license": null,
   "extra": {
    "http_status": 200,
    "live": true,
    "archive": {
     "url": "http://web.archive.org/web/20261030084057/https://thebookofshaders.com/11/",
     "timestamp": "20261030084057"
    },
    "page_title": "The Book of Shaders",
    "host": "thebookofshaders.com",
    "title_confirmed_by_page": true,
    "title_unconfirmed": false
   },
   "provenance": {
    "title": {
     "authority": "http",
     "endpoint": "GET https://thebookofshaders.com/11 → 200",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "url": {
     "authority": "http",
     "endpoint": "GET https://thebookofshaders.com/11 → 200",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "authors": {
     "authority": "research-draft",
     "endpoint": "title_hint/author_hint, checked against page title where available",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "venue": {
     "authority": "http",
     "endpoint": "GET https://thebookofshaders.com/11 → 200",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "year": {
     "authority": "research-draft",
     "endpoint": "title_hint/author_hint, checked against page title where available",
     "checked_at": "2026-11-29T15:51:27.588Z"
    }
   },
   "status": "verified",
   "checked_at": "2026-11-29T15:51:27.588Z",
   "title_sim": 0.95,
   "__bib": "vivobook"
  },
  {
   "role": "tutorial",
   "key": "url:https://iquilezles.org/articles/gradientnoise",
   "type": "tutorial",
   "title": "Gradient Noise - Derivatives",
   "authors": [
    "Inigo Quilez"
   ],
   "year": null,
   "venue": "iquilezles.org",
   "url": "https://iquilezles.org/articles/gradientnoise",
   "ids": {},
   "license": null,
   "extra": {
    "http_status": 200,
    "live": true,
    "archive": {
     "url": "http://web.archive.org/web/20260501045513/https://iquilezles.org/articles/gradientnoise/",
     "timestamp": "20260501045513"
    },
    "page_title": "Inigo Quilez :: computer graphics, maths, shaders, fractals, demoscene",
    "host": "iquilezles.org",
    "title_confirmed_by_page": false,
    "title_unconfirmed": true
   },
   "provenance": {
    "title": {
     "authority": "research-draft",
     "endpoint": "title_hint/author_hint, checked against page title where available",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "url": {
     "authority": "http",
     "endpoint": "GET https://iquilezles.org/articles/gradientnoise → 200",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "authors": {
     "authority": "research-draft",
     "endpoint": "title_hint/author_hint, checked against page title where available",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "venue": {
     "authority": "http",
     "endpoint": "GET https://iquilezles.org/articles/gradientnoise → 200",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "year": {
     "authority": "research-draft",
     "endpoint": "title_hint/author_hint, checked against page title where available",
     "checked_at": "2026-11-29T15:51:27.588Z"
    }
   },
   "status": "verified",
   "checked_at": "2026-11-29T15:51:27.588Z",
   "title_sim": 0,
   "__bib": "quilezgradient"
  }
 ],
 "presets": [
  {
   "id": "perlin-noise-specimen",
   "title": "Classic Perlin gradient noise with lattice gradients shown, 3 octaves",
   "runtime": "glsl-fragment",
   "params": {
    "SCALE": 5,
    "OCTAVES": 3
   },
   "code": "// Classic 2D Perlin gradient noise: lattice with random unit gradients (white ticks), value mapped to terrain-like colours, 3 octaves.\nconst float SCALE = 5.0;\nconst int OCTAVES = 3;\nvec2 grad(vec2 i) {\n    float a = 6.2831853 * fract(sin(dot(i, vec2(127.1, 311.7))) * 43758.5453);\n    return vec2(cos(a), sin(a));\n}\nfloat noise(vec2 p) {\n    vec2 i = floor(p), f = fract(p), u = f * f * (3.0 - 2.0 * f);\n    return mix(mix(dot(grad(i), f), dot(grad(i + vec2(1, 0)), f - vec2(1, 0)), u.x),\n               mix(dot(grad(i + vec2(0, 1)), f - vec2(0, 1)), dot(grad(i + vec2(1, 1)), f - vec2(1, 1)), u.x), u.y);\n}\nfloat segd(vec2 p, vec2 a, vec2 b) {\n    vec2 pa = p - a, ba = b - a;\n    return length(pa - ba * clamp(dot(pa, ba) / dot(ba, ba), 0.0, 1.0));\n}\nvoid mainImage(out vec4 fragColor, in vec2 fragCoord) {\n    vec2 uv = fragCoord / iResolution.xy;\n    vec2 p = uv * SCALE;\n    float h = 0.0, amp = 0.5, fr = 1.0;\n    for (int o = 0; o < OCTAVES; o++) { h += amp * noise(p * fr); amp *= 0.5; fr *= 2.0; }\n    h = h * 1.6 + 0.5;\n    vec3 col = h < 0.45 ? mix(vec3(0.05, 0.15, 0.4), vec3(0.2, 0.5, 0.7), h / 0.45)\n             : h < 0.75 ? mix(vec3(0.25, 0.5, 0.2), vec3(0.6, 0.55, 0.3), (h - 0.45) / 0.3)\n             : mix(vec3(0.5, 0.45, 0.4), vec3(1.0), clamp((h - 0.75) * 3.0, 0.0, 1.0));\n    col *= 0.85 + 0.15 * sin(h * 60.0);\n    // lattice and first-octave gradients\n    vec2 id = floor(p + 0.5);\n    float g = segd(p, id, id + grad(id) * 0.3);\n    vec2 f = abs(fract(p) - 0.5);\n    col = mix(col, vec3(0.0), smoothstep(0.02, 0.0, min(f.x, f.y) - 0.48) * 0.35);\n    col = mix(col, vec3(1.0), smoothstep(0.02, 0.01, g));\n    col = mix(col, vec3(1.0), smoothstep(0.06, 0.04, length(p - id)));\n    fragColor = vec4(pow(col, vec3(0.8)), 1.0);\n}\n",
   "basis": "original",
   "license_note": "written for this index",
   "execution_fidelity": "faithful-pass",
   "proof": {
    "kind": "rendered",
    "label": "rendered 2026-11-29",
    "ok": true,
    "proof": {
     "ok": true,
     "technique": "perlin-noise",
     "runtime": "glsl-fragment",
     "checked_at": "2026-11-29T15:51:50.471Z",
     "renderer": "Chromium 145.0.7632.6 headless, WebGL2 via ANGLE/SwiftShader, 512×512, iTime=1.5",
     "stats": {
      "mean": 0.341,
      "std": 0.1086,
      "unique_colors": 176
     },
     "image": "/specimens/perlin-noise-specimen.webp",
     "reason": null
    }
   }
  }
 ],
 "related": [
  "improved-perlin-noise",
  "simplex-noise",
  "worley-noise",
  "fractal-brownian-motion"
 ],
 "extends": [],
 "supersedes": [],
 "combines_with": [
  {
   "id": "fractal-brownian-motion",
   "why": "Summing octaves of this noise yields the natural-looking spectrum fBm needs."
  }
 ],
 "provenance": {
  "prose": "original text written for this index (research draft, editorially reviewed)",
  "sources_verified_at": "2026-11-29T15:51:27.588Z",
  "draft": "data/drafts/procgen/perlin-noise.json"
 },
 "solves": [
  "need a cheap smooth random field",
  "procedural clouds, marble or bump maps from noise",
  "random values look harsh and uncorrelated",
  "seedable repeatable noise for heightfields"
 ],
 "authority": "Perlin, 1985",
 "url": "https://texelatlas.vercel.app/t/perlin-noise/",
 "execution_fidelity": "faithful-pass",
 "fidelity_label": "Faithful Pass",
 "benchmark_eligible": true,
 "gpu_weight": {
  "weight_x": 6.76,
  "tier": "moderate",
  "p50_ms": 0.2225,
  "p95_ms": 0.2354,
  "baseline_p50_ms": 0.0329,
  "gpu": "Tesla T4/PCIe/SSE2",
  "resolution": "1920x1080",
  "method": "opengl-timer-query",
  "frames": 40,
  "preset_id": "perlin-noise-specimen",
  "execution_fidelity": "faithful-pass",
  "fidelity_label": "Faithful Pass",
  "benchmark_eligible": true,
  "generated_at": "2026-11-30T21:07:47Z",
  "l4": {
   "weight_x": 6.09,
   "tier": "moderate",
   "p50_ms": 0.0968,
   "p95_ms": 0.0969,
   "speedup_x": 2.3,
   "gpu": "NVIDIA L4/PCIe/SSE2",
   "resolution": "1920x1080",
   "baseline_p50_ms": 0.0159
  },
  "a100": {
   "weight_x": 4.17,
   "tier": "light",
   "p50_ms": 0.1202,
   "p95_ms": 0.1203,
   "speedup_x": 1.85,
   "gpu": "NVIDIA A100-SXM4-40GB/PCIe/SSE2",
   "resolution": "1920x1080",
   "baseline_p50_ms": 0.0288
  }
 }
}