{
 "id": "acoustic-raytraced-echolocation-point-cloud",
 "title": "Multi-Bounce Acoustic Ray-Traced Echolocation Point-Cloud Visualization",
 "aliases": [
  "acoustic echolocation rendering",
  "sonar point-cloud visualization",
  "geometrical acoustic ray mapping"
 ],
 "domain": "npr",
 "subdomain": "non-optical visualization",
 "stage": "lighting",
 "realtime": "realtime",
 "platforms": [
  "webgl2",
  "webgpu",
  "desktop-gpu",
  "cpu"
 ],
 "year_introduced": 1968,
 "inputs": [
  "mesh",
  "camera-poses"
 ],
 "outputs": [
  "point-cloud",
  "hdr-image"
 ],
 "style": "stylized",
 "dynamic": "dynamic",
 "summary": "Visualizes otherwise invisible 3D architecture by casting multi-bounce acoustic rays from a sound pulse and depositing time-delayed, decaying luminous points where expanding sound waves strike surfaces.",
 "how_it_works": "Geometrical room acoustics models sound propagation as energetic rays traveling at the finite speed of sound `c` (~343 m/s), reflecting specularly or diffusely off room boundaries while losing energy to distance spreading and surface absorption. Turning this acoustic simulation into an NPR visualization reveals a pitch-black 3D scene exclusively through **delayed echo impressions**.\n\nWhenever a vocal call, clap, or synthetic sonar ping is emitted, thousands of rays are distributed over the sphere (or forward cone) and traced through the scene's BVH for multiple bounces. Each ray hit records its 3D world position, surface normal, accumulated **path travel distance** `d`, bounce order, and remaining acoustic energy—often feeding a matching spatialized audio impulse response at the same time.\n\nInstead of illuminating hits instantaneously, each recorded point stays dormant until simulation time reaches `t_emit + d / c`, so rings of glowing dots sweep physically outward along corridors, turn corners via secondary reflections, and silhouette moving entities as acoustic shadows. After activation, points decay exponentially over a few seconds, leaving a ghostly, transient point cloud that fades back into darkness until the next pulse.",
 "when_to_use": "Choose it for horror, exploration, sensory-substitution, or architectural-acoustics visualizations where space should be revealed dynamically by finite-speed sound waves and multi-bounce reflections rather than direct light.\n\nPrefer [screen-space-edge-outline](screen-space-edge-outline) or [jump-flood-outline](jump-flood-outline) when you want a cheap, instantaneous wireframe/sonar pulse without real multi-bounce occlusion. Prefer [path-tracing](path-tracing) when simulating optical illumination rather than finite-speed acoustic wavefronts.",
 "cost": {
  "class": "medium",
  "notes": "Ray tracing occurs only in bursts on sound emission (a few thousand multi-bounce BVH rays per pulse); per-frame rendering draws a persistent ring buffer of instanced or point-sprite echo dots."
 },
 "failure_modes": [
  "Sparse ray sampling leaves wide gaps on distant walls or large open rooms where angular ray density falls off quadratically",
  "Moving objects cast stale point clouds after stepping away unless dynamic entities are stamped with shorter lifetimes or continuously re-tested",
  "Geometrical ray tracing ignores low-frequency wave diffraction around sharp corners, making acoustic shadows sharper than real sound",
  "Unbounded point buffers can saturate fill rate or memory if pulses fire rapidly without a ring-buffer cap and decay eviction"
 ],
 "sources": [
  {
   "role": "primary",
   "key": "doi:10.1016/0022-460x(68)90198-3",
   "type": "paper",
   "title": "Calculating the acoustical room response by the use of a ray tracing technique",
   "authors": [
    "A. Krokstad",
    "S. Strom",
    "S. Sørsdal"
   ],
   "year": 1968,
   "venue": "Journal of Sound and Vibration",
   "url": "https://doi.org/10.1016/0022-460x(68)90198-3",
   "ids": {
    "doi": "10.1016/0022-460x(68)90198-3"
   },
   "license": null,
   "extra": {
    "csl_type": "journal-article"
   },
   "provenance": {
    "title": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1016/0022-460x(68)90198-3",
     "checked_at": "2026-11-30T17:59:51.239Z"
    },
    "authors": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1016/0022-460x(68)90198-3",
     "checked_at": "2026-11-30T17:59:51.239Z"
    },
    "year": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1016/0022-460x(68)90198-3",
     "checked_at": "2026-11-30T17:59:51.239Z"
    },
    "venue": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1016/0022-460x(68)90198-3",
     "checked_at": "2026-11-30T17:59:51.239Z"
    },
    "url": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1016/0022-460x(68)90198-3",
     "checked_at": "2026-11-30T17:59:51.239Z"
    }
   },
   "status": "verified",
   "checked_at": "2026-11-30T17:59:51.239Z",
   "title_sim": 1,
   "__bib": "krokstad1968calculating"
  },
  {
   "role": "survey",
   "key": "doi:10.1121/1.4926438",
   "type": "paper",
   "title": "Overview of geometrical room acoustic modeling techniques",
   "authors": [
    "Lauri Savioja",
    "U. Peter Svensson"
   ],
   "year": 2015,
   "venue": "The Journal of the Acoustical Society of America",
   "url": "https://doi.org/10.1121/1.4926438",
   "ids": {
    "doi": "10.1121/1.4926438"
   },
   "license": null,
   "extra": {
    "csl_type": "journal-article"
   },
   "provenance": {
    "title": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1121/1.4926438",
     "checked_at": "2026-11-30T17:59:51.239Z"
    },
    "authors": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1121/1.4926438",
     "checked_at": "2026-11-30T17:59:51.239Z"
    },
    "year": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1121/1.4926438",
     "checked_at": "2026-11-30T17:59:51.239Z"
    },
    "venue": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1121/1.4926438",
     "checked_at": "2026-11-30T17:59:51.239Z"
    },
    "url": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1121/1.4926438",
     "checked_at": "2026-11-30T17:59:51.239Z"
    }
   },
   "status": "verified",
   "checked_at": "2026-11-30T17:59:51.239Z",
   "title_sim": 1,
   "__bib": "savioja2015overview"
  },
  {
   "role": "implementation",
   "key": "gh:spite/codevember-2026",
   "type": "code",
   "title": "spite/codevember-2026",
   "description": "",
   "authors": [
    "spite"
   ],
   "year": 2026,
   "venue": "GitHub",
   "url": "https://github.com/spite/codevember-2026",
   "ids": {
    "repo": "spite/codevember-2026"
   },
   "license": "MIT",
   "extra": {
    "stars": 45,
    "stars_checked": "2026-11-30",
    "archived": false,
    "fork": false,
    "pushed_at": "2026-11-30T15:47:17Z",
    "language": "JavaScript",
    "homepage": null,
    "license_name": "MIT License"
   },
   "provenance": {
    "title": {
     "authority": "github",
     "endpoint": "https://api.github.com/repos/spite/codevember-2026",
     "checked_at": "2026-11-30T17:59:51.239Z"
    },
    "authors": {
     "authority": "github",
     "endpoint": "https://api.github.com/repos/spite/codevember-2026",
     "checked_at": "2026-11-30T17:59:51.239Z"
    },
    "year": {
     "authority": "github",
     "endpoint": "https://api.github.com/repos/spite/codevember-2026",
     "checked_at": "2026-11-30T17:59:51.239Z"
    },
    "venue": {
     "authority": "github",
     "endpoint": "https://api.github.com/repos/spite/codevember-2026",
     "checked_at": "2026-11-30T17:59:51.239Z"
    },
    "url": {
     "authority": "github",
     "endpoint": "https://api.github.com/repos/spite/codevember-2026",
     "checked_at": "2026-11-30T17:59:51.239Z"
    },
    "license": {
     "authority": "github",
     "endpoint": "https://api.github.com/repos/spite/codevember-2026",
     "checked_at": "2026-11-30T17:59:51.239Z"
    }
   },
   "status": "verified",
   "checked_at": "2026-11-30T17:59:51.239Z",
   "title_sim": null,
   "__bib": "spite2026spite"
  }
 ],
 "presets": [
  {
   "id": "acoustic-raytraced-echolocation-point-cloud-live",
   "title": "Acoustic Ray-Traced Echolocation Point Cloud — dark vaulted geometry (left) vs multi-bounce time-delayed echo point pulses (right)",
   "runtime": "glsl-fragment",
   "params": {
    "P_PULSE_RATE": 0.75,
    "P_WAVE_WIDTH": 0.55,
    "P_POINT_DENS": 1,
    "P_SPLIT": 0.34
   },
   "basis": "original",
   "license_note": "MIT — written for this index.",
   "code": "const float P_PULSE_RATE = 0.75; // P Acoustic Pulse Rate [0.2, 1.8, 0.05]\nconst float P_WAVE_WIDTH = 0.55; // P Echo Decay Tail [0.2, 1.2, 0.05]\nconst float P_POINT_DENS = 1.00; // P Point Cloud Grid [0.5, 1.8, 0.05]\nconst float P_SPLIT = 0.34; // P Solid / Echolocation [0.0, 1.0, 0.02]\n\nfloat hash31(vec3 p) {\n  p = fract(p * 0.1031);\n  p += dot(p, p.yzx + 33.33);\n  return fract((p.x + p.y) * p.z);\n}\n\nfloat sdBox(vec3 p, vec3 b) {\n  vec3 q = abs(p) - b;\n  return length(max(q, 0.0)) + min(max(q.x, max(q.y, q.z)), 0.0);\n}\n\n// Vaulted architectural corridor with pillars & archway revealed by expanding acoustic pulses\nvec2 mapVault(vec3 p) {\n  // Inverted corridor walls + arched ceiling\n  float dFloor = p.y + 0.62;\n  float dWalls = 1.25 - abs(p.x);\n  float dCeil = 1.05 - length(vec2(p.x * 0.75, p.y - 0.15));\n  float dBack = p.z + 2.45;\n  float dShell = min(min(dFloor, dWalls), min(dCeil, dBack));\n  vec2 res = vec2(dShell, 1.0);\n\n  // Repeating ribbed colonnade piers along the corridor\n  for (int i = 0; i < 3; i++) {\n    float z = -0.35 - float(i) * 0.85;\n    float dL = sdBox(p - vec3(-0.78, -0.05, z), vec3(0.14, 0.58, 0.14));\n    float dR = sdBox(p - vec3(0.78, -0.05, z), vec3(0.14, 0.58, 0.14));\n    float dP = min(dL, dR);\n    if (dP < res.x) res = vec2(dP, 2.0);\n  }\n  // Central floating acoustic sculpture\n  float dSculpt = length(p - vec3(0.0, -0.14, -0.75)) - 0.28;\n  if (dSculpt < res.x) res = vec2(dSculpt, 3.0);\n  return res;\n}\n\nvec3 calcNormal(vec3 p) {\n  vec2 e = vec2(0.003, 0.0);\n  return normalize(vec3(\n    mapVault(p + e.xyy).x - mapVault(p - e.xyy).x,\n    mapVault(p + e.yxy).x - mapVault(p - e.yxy).x,\n    mapVault(p + e.yyx).x - mapVault(p - e.yyx).x\n  ));\n}\n\nvec3 aces(vec3 x) {\n  x = max(x, 0.0);\n  return (x * (2.51 * x + 0.03)) / (x * (2.43 * x + 0.59) + 0.14);\n}\n\nvoid mainImage(out vec4 fragColor, in vec2 fragCoord) {\n  vec2 uv = (fragCoord - 0.5 * iResolution.xy) / iResolution.y;\n  float screenX = fragCoord.x / max(iResolution.x, 1.0);\n  float split = clamp(P_SPLIT, 0.0, 1.0);\n  float rate = clamp(P_PULSE_RATE, 0.15, 2.0);\n  float tail = clamp(P_WAVE_WIDTH, 0.15, 1.4);\n  float pDens = clamp(P_POINT_DENS, 0.4, 2.0);\n\n  vec3 ro = vec3(0.18 * sin(iTime * 0.35), 0.02, 1.38);\n  vec3 rd = normalize(vec3(uv.x, uv.y - 0.02, -1.35));\n  vec3 col = vec3(0.006, 0.009, 0.015);\n\n  float dist = 0.04;\n  vec2 hit = vec2(10.0, 0.0);\n  for (int i = 0; i < 68; i++) {\n    vec2 h = mapVault(ro + rd * dist);\n    if (h.x < 0.0025) { hit = vec2(dist, h.y); break; }\n    dist += h.x;\n    if (dist > 6.5) break;\n  }\n\n  if (hit.y > 0.5) {\n    vec3 p = ro + rd * hit.x;\n    vec3 n = calcNormal(p);\n\n    // Sound pulse originates slightly ahead of listener\n    vec3 pulseOrig = vec3(0.0, -0.05, 0.85);\n    float d1 = length(p - pulseOrig);\n\n    // Second-bounce acoustic path via central sphere / opposite wall reflection!\n    vec3 mirrorOrig = vec3(0.0, -0.14, -0.75);\n    float d2 = length(mirrorOrig - pulseOrig) + length(p - mirrorOrig);\n\n    // Repeating expanding acoustic wave fronts (finite speed of sound c)\n    float wavePhase = fract(iTime * rate * 0.38);\n    float waveDist = wavePhase * 5.2;\n\n    // 1st-bounce direct echo envelope (cyan-white leading edge, rapid decay behind wavefront)\n    float lag1 = waveDist - d1;\n    float env1 = step(0.0, lag1) * exp(-lag1 / max(0.55 * tail, 0.08)) / (0.35 + d1 * 0.55);\n\n    // 2nd-bounce delayed reflection envelope (warm amber secondary echo!)\n    float lag2 = waveDist - d2;\n    float env2 = step(0.0, lag2) * exp(-lag2 / max(0.75 * tail, 0.10)) / (0.55 + d2 * 0.45);\n\n    if (screenX < split) {\n      // Left: Dim ambient solid architecture for spatial reference\n      vec3 lDir = normalize(vec3(0.3, 0.6, 0.8));\n      float ndl = max(dot(n, lDir), 0.0);\n      vec3 baseCol = (hit.y > 2.5) ? vec3(0.34, 0.42, 0.52) : vec3(0.20, 0.24, 0.30);\n      col = baseCol * (0.20 + 0.55 * ndl) * exp(-hit.x * 0.22);\n      // Faint acoustic wave ring sweeping across reference geometry\n      float ring1 = exp(-abs(lag1) * 18.0);\n      col += vec3(0.18, 0.88, 1.0) * ring1 * 0.45;\n    } else {\n      // Right: Pure pitch-black NPR echolocation point-cloud deposited strictly where acoustic rays strike!\n      float gridScale = 14.0 * pDens;\n      vec3 cell = floor(p * gridScale);\n      vec3 local = fract(p * gridScale) - 0.5;\n      // Jittered luminous point inside each 3D surface cell\n      vec3 jit = (vec3(hash31(cell), hash31(cell + 17.3), hash31(cell + 41.9)) - 0.5) * 0.68;\n      float ptDist = length(local - jit);\n      float dotMask = smoothstep(0.24, 0.06, ptDist);\n\n      // Edge-curvature boost deposits denser silhouette highlight points on corners/pillars\n      float edgeBoost = (hit.y > 1.5) ? 1.45 : 1.0;\n      float waveCrest1 = exp(-abs(lag1) * 14.0) * 1.4;\n      float waveCrest2 = exp(-abs(lag2) * 12.0) * 1.1;\n\n      vec3 echo1Col = vec3(0.18, 0.92, 1.0) * (env1 * 1.45 + waveCrest1) * dotMask * edgeBoost;\n      vec3 echo2Col = vec3(1.0, 0.56, 0.18) * (env2 * 1.35 + waveCrest2) * dotMask * edgeBoost;\n      // Subtle floor ripple lines along advancing wavefront\n      float crestRing = exp(-abs(lag1) * 28.0) * 0.22;\n      col += echo1Col + echo2Col + vec3(0.25, 0.82, 0.96) * crestRing;\n    }\n  }\n\n  float sep = smoothstep(0.0035, 0.0008, abs(screenX - split));\n  col = mix(col, vec3(0.95, 0.98, 1.0), sep);\n  fragColor = vec4(pow(clamp(aces(col), 0.0, 1.0), vec3(1.0 / 2.2)), 1.0);\n}",
   "execution_fidelity": "conceptual-diagram",
   "proof": {
    "kind": "rendered",
    "label": "rendered 2026-11-30",
    "ok": true,
    "proof": {
     "ok": true,
     "technique": "acoustic-raytraced-echolocation-point-cloud",
     "runtime": "glsl-fragment",
     "checked_at": "2026-11-30T21:07:05.000Z",
     "renderer": "Headless EGL Tesla T4/PCIe/SSE2, OpenGL 3.30 Core, 512×512, iTime=1.5",
     "stats": {
      "mean": 0.1699,
      "std": 0.1473,
      "min": 0.0732,
      "max": 0.9448
     },
     "image": "/specimens/acoustic-raytraced-echolocation-point-cloud-live.webp",
     "reason": null
    }
   }
  }
 ],
 "related": [
  "three-mesh-bvh",
  "sah-bvh-construction",
  "path-tracing",
  "ntsc-composite-vhs-crt-signal-emulation",
  "atomic-fixed-point-compute-point-rasterization"
 ],
 "extends": [],
 "supersedes": [],
 "combines_with": [
  {
   "id": "three-mesh-bvh",
   "why": "Accelerates multi-bounce acoustic ray-triangle queries per sound pulse at interactive frame rates."
  },
  {
   "id": "ntsc-composite-vhs-crt-signal-emulation",
   "why": "Passes the decaying echolocation point-cloud output through analog tape noise and CRT phosphor glow."
  }
 ],
 "provenance": {
  "prose": "original text written for this index (research draft, editorially reviewed)",
  "sources_verified_at": "2026-11-30T17:59:51.239Z",
  "draft": "data/drafts/npr/acoustic-raytraced-echolocation-point-cloud.json"
 },
 "solves": [
  "visualize hidden dark environments using expanding sonar or echolocation pings",
  "trace multi-bounce sound rays to stamp time-of-flight glowing surface dots",
  "create stylized lidar or bat-sonar scanning effects that reveal rooms over time",
  "decay and animate acoustic hit points according to physical travel distance",
  "render minimalist atmospheric point-cloud navigation in pitch-black levels"
 ],
 "authority": "Krokstad et al., 1968",
 "url": "https://texelatlas.vercel.app/t/acoustic-raytraced-echolocation-point-cloud/",
 "execution_fidelity": "conceptual-diagram",
 "fidelity_label": "Visual Diagram",
 "benchmark_eligible": false,
 "gpu_weight": {
  "weight_x": 25.53,
  "tier": "heavy",
  "p50_ms": 0.8399,
  "p95_ms": 0.85,
  "baseline_p50_ms": 0.0329,
  "gpu": "Tesla T4/PCIe/SSE2",
  "resolution": "1920x1080",
  "method": "opengl-timer-query",
  "frames": 32,
  "preset_id": "acoustic-raytraced-echolocation-point-cloud-live",
  "execution_fidelity": "conceptual-diagram",
  "fidelity_label": "Visual Diagram",
  "benchmark_eligible": false,
  "generated_at": "2026-11-30T21:07:47Z",
  "l4": {
   "weight_x": 27.18,
   "tier": "heavy",
   "p50_ms": 0.4321,
   "p95_ms": 0.4337,
   "speedup_x": 1.94,
   "gpu": "NVIDIA L4/PCIe/SSE2",
   "resolution": "1920x1080",
   "baseline_p50_ms": 0.0159
  },
  "a100": {
   "weight_x": 17.25,
   "tier": "moderate",
   "p50_ms": 0.4967,
   "p95_ms": 0.5017,
   "speedup_x": 1.69,
   "gpu": "NVIDIA A100-SXM4-40GB/PCIe/SSE2",
   "resolution": "1920x1080",
   "baseline_p50_ms": 0.0288
  }
 }
}