{
 "id": "improved-perlin-noise",
 "title": "Improved Perlin Noise",
 "aliases": [
  "Perlin 2002"
 ],
 "domain": "procgen",
 "subdomain": "noise functions",
 "stage": "procedural",
 "realtime": "realtime",
 "platforms": [
  "webgl2",
  "webgpu",
  "desktop-gpu",
  "mobile-gpu",
  "cpu",
  "blender",
  "unity",
  "unreal",
  "godot",
  "python"
 ],
 "year_introduced": 2002,
 "inputs": [],
 "outputs": [
  "texture",
  "heightfield",
  "volume-density"
 ],
 "style": "both",
 "dynamic": "both",
 "summary": "Perlin's revision of gradient noise: a quintic fade curve with continuous second derivative and gradients drawn from the 12 cube-edge directions, removing the creases and directional bias of the 1985 version.",
 "how_it_works": "Structure is the same as classic gradient noise (hash lattice corners, dot offset with gradient, interpolate), with two changes. First, the interpolation weight becomes the quintic 6t^5-15t^4+10t^3, whose first and second derivatives vanish at cell boundaries, so the field is C2 continuous and its analytic derivatives have no seams. Second, instead of random unit vectors the gradient set is limited to the twelve vectors from the cube centre to edge midpoints, selected with a few bit operations from the hash. This avoids long axis-aligned gradients that caused visible streaks and makes the gradient dot product a sum of at most two terms. The reference Java code is a short permutation-table implementation that is trivially ported to shaders, usually replacing the table with an arithmetic hash.",
 "when_to_use": "Choose it as the default gradient noise whenever you light, bump or differentiate the result, or when you need analytic derivatives for erosion-style terrain. Prefer `simplex-noise` when you need 4D or want cheaper high-dimensional evaluation, and `perlin-noise` only when reproducing legacy 1985 output exactly. If you need cell structure rather than smooth blobs use `worley-noise`.",
 "cost": {
  "class": "cheap",
  "notes": "Slightly more arithmetic than the 1985 fade, same lookup count; negligible per-octave cost on GPU."
 },
 "failure_modes": [
  "Still lattice-aligned at low frequency, producing faint grid-oriented banding that fBm with rotated octaves hides but does not remove",
  "Integer-hash quality matters: weak hashes show repeating patterns or correlated rows far from the origin",
  "Float precision loss at large coordinates makes the noise collapse into stripes or blocks",
  "Not tileable without wrapping the lattice hash, a common surprise when baking seamless textures"
 ],
 "sources": [
  {
   "role": "primary",
   "key": "doi:10.1145/566570.566636",
   "type": "paper",
   "title": "Improving noise",
   "authors": [
    "Ken Perlin"
   ],
   "year": 2002,
   "venue": "Proceedings of the 29th annual conference on Computer graphics and interactive techniques",
   "url": "https://doi.org/10.1145/566570.566636",
   "ids": {
    "doi": "10.1145/566570.566636"
   },
   "license": null,
   "extra": {
    "csl_type": "proceedings-article"
   },
   "provenance": {
    "title": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1145/566570.566636",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "authors": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1145/566570.566636",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "year": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1145/566570.566636",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "venue": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1145/566570.566636",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "url": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1145/566570.566636",
     "checked_at": "2026-11-29T15:51:27.588Z"
    }
   },
   "status": "verified",
   "checked_at": "2026-11-29T15:51:27.588Z",
   "title_sim": 1,
   "__bib": "perlin2002improving"
  },
  {
   "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": "improved-perlin-noise-specimen",
   "title": "Lit gradient noise: cubic fade creases (left) vs improved quintic fade (right)",
   "runtime": "glsl-fragment",
   "params": {
    "SCALE": 7
   },
   "code": "// Gradient noise lit as a height field: left uses Perlin's old cubic fade (grid creases visible), right the improved quintic fade.\nconst float SCALE = 7.0;\nvec2 grad(vec2 i) {\n    // 8 edge-ish directions chosen by a lattice hash\n    float h = fract(sin(dot(i, vec2(127.1, 311.7))) * 43758.5453);\n    float a = floor(h * 8.0) * 0.7853982;\n    return vec2(cos(a), sin(a));\n}\nfloat noise(vec2 p, bool quintic) {\n    vec2 i = floor(p), f = fract(p);\n    vec2 u = quintic ? f * f * f * (f * (f * 6.0 - 15.0) + 10.0) : f * f * (3.0 - 2.0 * f);\n    float a = dot(grad(i), f);\n    float b = dot(grad(i + vec2(1, 0)), f - vec2(1, 0));\n    float c = dot(grad(i + vec2(0, 1)), f - vec2(0, 1));\n    float d = dot(grad(i + vec2(1, 1)), f - vec2(1, 1));\n    return mix(mix(a, b, u.x), mix(c, d, u.x), u.y);\n}\nvoid mainImage(out vec4 fragColor, in vec2 fragCoord) {\n    vec2 uv = fragCoord / iResolution.xy;\n    bool q = uv.x > 0.5;\n    vec2 p = uv * SCALE + vec2(iTime * 0.0);\n    float e = 0.01;\n    float h = noise(p, q);\n    float hx = noise(p + vec2(e, 0), q) - noise(p - vec2(e, 0), q);\n    float hy = noise(p + vec2(0, e), q) - noise(p - vec2(0, e), q);\n    vec3 n = normalize(vec3(-hx * 12.0, -hy * 12.0, 1.0));\n    float dif = max(dot(n, normalize(vec3(-0.5, 0.6, 0.7))), 0.0);\n    float spec = pow(max(dot(reflect(-normalize(vec3(-0.5, 0.6, 0.7)), n), vec3(0, 0, 1)), 0.0), 24.0);\n    vec3 col = mix(vec3(0.15, 0.2, 0.35), vec3(0.95, 0.8, 0.6), h * 1.2 + 0.5) * (0.25 + 0.8 * dif) + 0.3 * spec;\n    col = mix(col, vec3(1.0), smoothstep(0.004, 0.0, abs(uv.x - 0.5)));\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": "improved-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.4832,
      "std": 0.1374,
      "unique_colors": 285
     },
     "image": "/specimens/improved-perlin-noise-specimen.webp",
     "reason": null
    }
   }
  }
 ],
 "related": [
  "perlin-noise",
  "simplex-noise",
  "fractal-brownian-motion",
  "domain-warping"
 ],
 "extends": [],
 "supersedes": [
  "perlin-noise"
 ],
 "combines_with": [],
 "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/improved-perlin-noise.json"
 },
 "solves": [
  "noise shows creases or axis-aligned artifacts",
  "need smooth derivatives for lighting or bump",
  "noise gradient has visible discontinuities",
  "want analytic slope for erosion terrain"
 ],
 "authority": "Perlin, 2002",
 "url": "https://texelatlas.vercel.app/t/improved-perlin-noise/",
 "execution_fidelity": "faithful-pass",
 "fidelity_label": "Faithful Pass",
 "benchmark_eligible": true,
 "gpu_weight": {
  "weight_x": 9.17,
  "tier": "moderate",
  "p50_ms": 0.3016,
  "p95_ms": 0.3188,
  "baseline_p50_ms": 0.0329,
  "gpu": "Tesla T4/PCIe/SSE2",
  "resolution": "1920x1080",
  "method": "opengl-timer-query",
  "frames": 40,
  "preset_id": "improved-perlin-noise-specimen",
  "execution_fidelity": "faithful-pass",
  "fidelity_label": "Faithful Pass",
  "benchmark_eligible": true,
  "generated_at": "2026-11-30T21:07:47Z",
  "l4": {
   "weight_x": 8.98,
   "tier": "moderate",
   "p50_ms": 0.1428,
   "p95_ms": 0.1475,
   "speedup_x": 2.11,
   "gpu": "NVIDIA L4/PCIe/SSE2",
   "resolution": "1920x1080",
   "baseline_p50_ms": 0.0159
  },
  "a100": {
   "weight_x": 6.81,
   "tier": "moderate",
   "p50_ms": 0.196,
   "p95_ms": 0.196,
   "speedup_x": 1.54,
   "gpu": "NVIDIA A100-SXM4-40GB/PCIe/SSE2",
   "resolution": "1920x1080",
   "baseline_p50_ms": 0.0288
  }
 }
}