{
 "id": "poisson-disk-sampling",
 "title": "Poisson Disk Sampling (Bridson)",
 "aliases": [
  "blue-noise point sampling",
  "dart throwing with grid acceleration"
 ],
 "domain": "procgen",
 "subdomain": "point distributions",
 "stage": "procedural",
 "realtime": "realtime",
 "platforms": [
  "cpu",
  "python",
  "webgl2",
  "unity",
  "unreal",
  "godot",
  "houdini"
 ],
 "year_introduced": 2007,
 "inputs": [],
 "outputs": [
  "point-cloud"
 ],
 "style": "both",
 "dynamic": "static",
 "summary": "Generates random points that are no closer than a minimum radius and fill space evenly, using a background grid and an active list so it runs in linear time in any dimension.",
 "how_it_works": "A background grid with cell size r/sqrt(n) stores at most one sample per cell, so a distance check against neighbours is a constant-time lookup of a small window. Start with one random sample in the active list. Repeatedly pick a random active sample, try up to k (about 30) candidates in the annulus between r and 2r around it, and accept the first candidate that is at least r from all existing samples by checking nearby grid cells; add it to the grid and list. If none of the k candidates works, remove the sample from the active list. When the list empties the domain is filled to near-maximal coverage. Variable-radius versions let r depend on position for density maps, and tileable versions wrap the grid.",
 "when_to_use": "Choose it for evenly spaced scattering: trees, rocks, grass clumps, lights, attractor points and sample patterns, where uniform random clumps look bad. Prefer `ecosystem-plant-distribution` when ecology (species, competition) matters, `voronoi-lloyd-relaxation` when you want even cells and are fine with an iterative relaxation, and `worley-noise` when you want per-pixel feature points without storing any samples.",
 "cost": {
  "class": "cheap",
  "notes": "O(N) in number of points; millions of points feasible on CPU, but not per-pixel on GPU."
 },
 "failure_modes": [
  "Not strictly maximal: the k-candidate limit leaves small holes",
  "Output is stateful and sequential, hard to evaluate per-pixel in a shader without precomputation or tiling",
  "Variable-radius density gradients that change faster than r produce visible banding",
  "Hard boundaries cause edge effects: samples cluster against domain borders unless padded",
  "Tileable versions with naive wrapping show duplicated seam rows"
 ],
 "sources": [
  {
   "role": "primary",
   "key": "doi:10.1145/1278780.1278807",
   "type": "paper",
   "title": "Fast Poisson disk sampling in arbitrary dimensions",
   "authors": [
    "Robert Bridson"
   ],
   "year": 2007,
   "venue": "ACM SIGGRAPH 2007 sketches",
   "url": "https://doi.org/10.1145/1278780.1278807",
   "ids": {
    "doi": "10.1145/1278780.1278807"
   },
   "license": null,
   "extra": {
    "csl_type": "proceedings-article"
   },
   "provenance": {
    "title": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1145/1278780.1278807",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "authors": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1145/1278780.1278807",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "year": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1145/1278780.1278807",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "venue": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1145/1278780.1278807",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "url": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1145/1278780.1278807",
     "checked_at": "2026-11-29T15:51:27.588Z"
    }
   },
   "status": "verified",
   "checked_at": "2026-11-29T15:51:27.588Z",
   "title_sim": 1,
   "__bib": "bridson2007fast"
  },
  {
   "role": "primary",
   "key": "url:https://www.cs.ubc.ca/~rbridson/docs/bridson-siggraph07-poissondisk.pdf",
   "type": "web",
   "title": "Fast Poisson Disk Sampling in Arbitrary Dimensions",
   "authors": [
    "Robert Bridson"
   ],
   "year": null,
   "venue": "cs.ubc.ca",
   "url": "https://www.cs.ubc.ca/~rbridson/docs/bridson-siggraph07-poissondisk.pdf",
   "ids": {},
   "license": null,
   "extra": {
    "http_status": 200,
    "live": true,
    "archive": {
     "url": "http://web.archive.org/web/20261015011403/https://www.cs.ubc.ca/~rbridson/docs/bridson-siggraph07-poissondisk.pdf",
     "timestamp": "20261015011403"
    },
    "page_title": null,
    "host": "cs.ubc.ca",
    "title_confirmed_by_page": false,
    "title_unconfirmed": false
   },
   "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://www.cs.ubc.ca/~rbridson/docs/bridson-siggraph07-poissondisk.pdf → 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://www.cs.ubc.ca/~rbridson/docs/bridson-siggraph07-poissondisk.pdf → 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": null,
   "__bib": "bridsonfast"
  },
  {
   "role": "implementation",
   "key": "gh:kchapelier/poisson-disk-sampling",
   "type": "code",
   "title": "kchapelier/poisson-disk-sampling",
   "description": "Poisson disk sampling in arbitrary dimensions",
   "authors": [
    "kchapelier"
   ],
   "year": 2015,
   "venue": "GitHub",
   "url": "https://github.com/kchapelier/poisson-disk-sampling",
   "ids": {
    "repo": "kchapelier/poisson-disk-sampling"
   },
   "license": "MIT",
   "extra": {
    "stars": 255,
    "stars_checked": "2026-11-29",
    "archived": false,
    "fork": false,
    "pushed_at": "2022-10-10T19:39:25Z",
    "language": "JavaScript",
    "homepage": null,
    "license_name": "MIT License"
   },
   "provenance": {
    "title": {
     "authority": "github",
     "endpoint": "https://api.github.com/repos/kchapelier/poisson-disk-sampling",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "authors": {
     "authority": "github",
     "endpoint": "https://api.github.com/repos/kchapelier/poisson-disk-sampling",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "year": {
     "authority": "github",
     "endpoint": "https://api.github.com/repos/kchapelier/poisson-disk-sampling",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "venue": {
     "authority": "github",
     "endpoint": "https://api.github.com/repos/kchapelier/poisson-disk-sampling",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "url": {
     "authority": "github",
     "endpoint": "https://api.github.com/repos/kchapelier/poisson-disk-sampling",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "license": {
     "authority": "github",
     "endpoint": "https://api.github.com/repos/kchapelier/poisson-disk-sampling",
     "checked_at": "2026-11-29T15:51:27.588Z"
    }
   },
   "status": "verified",
   "checked_at": "2026-11-29T15:51:27.588Z",
   "title_sim": null,
   "__bib": "kchapelier2015kchapelier"
  }
 ],
 "presets": [
  {
   "id": "poisson-disk-sampling-specimen",
   "title": "Poisson disk samples via parallel priority dart throwing, with exclusion discs",
   "runtime": "glsl-fragment",
   "params": {
    "CELL": 0.055,
    "RADIUS": 0.085
   },
   "code": "// Parallel dart-throwing Poisson disk: one random candidate per grid cell, kept only if no nearby candidate has higher priority.\nconst float CELL = 0.055;\nconst float RADIUS = 0.085;     // minimum allowed distance between kept points\nfloat h21(vec2 p) { return fract(sin(dot(p, vec2(127.1, 311.7))) * 43758.5453); }\nvec2 cand(vec2 c) { return (c + 0.15 + 0.7 * vec2(h21(c), h21(c + 17.3))) * CELL; }\nbool kept(vec2 c) {\n    vec2 p = cand(c); float pr = h21(c + 5.1);\n    for (int j = -2; j <= 2; j++) for (int i = -2; i <= 2; i++) {\n        if (i == 0 && j == 0) continue;\n        vec2 o = c + vec2(i, j);\n        if (length(cand(o) - p) < RADIUS && h21(o + 5.1) > pr) return false;\n    }\n    return true;\n}\nvoid mainImage(out vec4 fragColor, in vec2 fragCoord) {\n    vec2 uv = fragCoord / iResolution.xy;\n    vec2 cell = floor(uv / CELL);\n    vec3 col = vec3(0.06, 0.07, 0.1);\n    float dmin = 1e9;\n    for (int j = -2; j <= 2; j++) for (int i = -2; i <= 2; i++) {\n        vec2 c = cell + vec2(i, j);\n        if (kept(c)) {\n            float d = length(uv - cand(c));\n            dmin = min(dmin, d);\n            col += vec3(0.1, 0.2, 0.3) * smoothstep(0.004, 0.0, abs(d - RADIUS * 0.5));\n        }\n    }\n    col = mix(col, vec3(1.0, 0.8, 0.4), smoothstep(0.009, 0.006, dmin));\n    col += vec3(0.04, 0.07, 0.1) * smoothstep(RADIUS * 0.5, 0.0, dmin);\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": "poisson-disk-sampling",
     "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.1409,
      "std": 0.0771,
      "unique_colors": 64
     },
     "image": "/specimens/poisson-disk-sampling-specimen.webp",
     "reason": null
    }
   }
  }
 ],
 "related": [
  "voronoi-lloyd-relaxation",
  "wang-tiles",
  "ecosystem-plant-distribution",
  "space-colonization-trees"
 ],
 "extends": [],
 "supersedes": [],
 "combines_with": [
  {
   "id": "voronoi-lloyd-relaxation",
   "why": "Poisson samples seed the Voronoi diagram that Lloyd relaxation then evens out."
  }
 ],
 "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/poisson-disk-sampling.json"
 },
 "solves": [
  "random scattering clumps and leaves gaps",
  "need evenly spaced trees, rocks or grass clumps",
  "points must keep a minimum distance apart",
  "generate blue-noise sample positions quickly"
 ],
 "authority": "Bridson, 2007",
 "url": "https://texelatlas.vercel.app/t/poisson-disk-sampling/",
 "execution_fidelity": "faithful-pass",
 "fidelity_label": "Faithful Pass",
 "benchmark_eligible": true,
 "gpu_weight": {
  "weight_x": 223.09,
  "tier": "extreme",
  "p50_ms": 7.3398,
  "p95_ms": 7.4215,
  "baseline_p50_ms": 0.0329,
  "gpu": "Tesla T4/PCIe/SSE2",
  "resolution": "1920x1080",
  "method": "opengl-timer-query",
  "frames": 40,
  "preset_id": "poisson-disk-sampling-specimen",
  "execution_fidelity": "faithful-pass",
  "fidelity_label": "Faithful Pass",
  "benchmark_eligible": true,
  "generated_at": "2026-11-30T21:07:47Z",
  "l4": {
   "weight_x": 203.55,
   "tier": "extreme",
   "p50_ms": 3.2364,
   "p95_ms": 3.2769,
   "speedup_x": 2.27,
   "gpu": "NVIDIA L4/PCIe/SSE2",
   "resolution": "1920x1080",
   "baseline_p50_ms": 0.0159
  },
  "a100": {
   "weight_x": 138.15,
   "tier": "extreme",
   "p50_ms": 3.9788,
   "p95_ms": 4.0088,
   "speedup_x": 1.84,
   "gpu": "NVIDIA A100-SXM4-40GB/PCIe/SSE2",
   "resolution": "1920x1080",
   "baseline_p50_ms": 0.0288
  }
 }
}