{
 "id": "deep-shadow-maps",
 "title": "Deep shadow maps",
 "aliases": [
  "DSM",
  "transmittance function shadow maps",
  "deep shadows"
 ],
 "domain": "volumes",
 "subdomain": "volumetric shadows",
 "stage": "visibility",
 "realtime": "offline",
 "platforms": [
  "cpu",
  "houdini",
  "cuda"
 ],
 "year_introduced": 2000,
 "inputs": [
  "particles",
  "volume-density",
  "mesh"
 ],
 "outputs": [
  "visibility-mask"
 ],
 "style": "photoreal",
 "dynamic": "both",
 "summary": "Instead of one depth per light pixel, store a piecewise-linear transmittance curve along the light ray. It shadows hair, smoke and semi-transparent fuzzy objects with soft partial occlusion that ordinary shadow maps cannot represent.",
 "how_it_works": "A standard shadow map stores the nearest depth, so a pixel is either lit or shadowed. A deep shadow map stores, for each light-space pixel, a function giving how much light survives at each depth along the ray.\n\nThe light renders the scene with all semi-transparent samples (hair fibres, volume slices, particles). For each pixel the samples are sorted by depth and accumulated into a transmittance function: starting at one, each opacity reduces the value. The curve is stored compactly as piecewise linear data with a bounded error, and neighbouring pixels are filtered by averaging functions rather than single depths, which gives soft shadows without noise.\n\nAt shading time the renderer transforms a point into light space, finds the function and evaluates it at the point's depth. Visibility is the evaluated transmittance. Because the function is filtered across a pixel footprint, thin hair strands produce stable partial shadow instead of aliasing.",
 "when_to_use": "Choose it in offline renderers for hair, fur, smoke, clouds and dense particle effects where self-shadowing must be smooth and film-quality.\n\nPrefer [shadow-mapping](shadow-mapping) or [percentage-closer-filtering](percentage-closer-filtering) for opaque geometry. Prefer [variance-shadow-maps](variance-shadow-maps) or [moment-shadow-maps](moment-shadow-maps) for real-time soft shadows of opaque or alpha-tested objects. Prefer [froxel-volumetric-fog](froxel-volumetric-fog) and [volume-ray-marching](volume-ray-marching) in real time for fog and clouds, which compute transmittance directly. Prefer [ray-traced-shadows](ray-traced-shadows) or [delta-tracking](delta-tracking) when a path tracer can estimate transmittance per shading point.",
 "cost": {
  "class": "offline",
  "notes": "Build time and memory scale with the number of semi-transparent samples per light pixel; lookup is a search along one stored function."
 },
 "failure_modes": [
  "Memory grows with depth complexity, so dense hair or volumes need aggressive compression of the transmittance curves",
  "Light bleeding and wrong shadows if the compression tolerance is too coarse for thin dense layers",
  "Resolution tied to the light's pixel grid, so close-up views need higher resolution or tiling",
  "One map per light, which makes many-light scenes expensive",
  "Moving objects require rebuilding the map every frame",
  "Surface and volume samples need consistent opacity conventions, otherwise self-shadow offsets show as dark bands"
 ],
 "sources": [
  {
   "role": "primary",
   "key": "doi:10.1145/344779.344958",
   "type": "paper",
   "title": "Deep shadow maps",
   "authors": [
    "Tom Lokovic",
    "Eric Veach"
   ],
   "year": 2000,
   "venue": "Proceedings of the 27th annual conference on Computer graphics and interactive techniques  - SIGGRAPH '00",
   "url": "https://doi.org/10.1145/344779.344958",
   "ids": {
    "doi": "10.1145/344779.344958"
   },
   "license": null,
   "extra": {
    "csl_type": "proceedings-article"
   },
   "provenance": {
    "title": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1145/344779.344958",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "authors": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1145/344779.344958",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "year": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1145/344779.344958",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "venue": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1145/344779.344958",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "url": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1145/344779.344958",
     "checked_at": "2026-11-29T15:51:27.588Z"
    }
   },
   "status": "verified",
   "checked_at": "2026-11-29T15:51:27.588Z",
   "title_sim": 1,
   "__bib": "lokovic2000deep"
  },
  {
   "role": "primary",
   "key": "doi:10.1145/1730804.1730831",
   "type": "paper",
   "title": "Fourier opacity mapping",
   "authors": [
    "Jon Jansen",
    "Louis Bavoil"
   ],
   "year": 2010,
   "venue": "Proceedings of the 2010 ACM SIGGRAPH symposium on Interactive 3D Graphics and Games",
   "url": "https://doi.org/10.1145/1730804.1730831",
   "ids": {
    "doi": "10.1145/1730804.1730831"
   },
   "license": null,
   "extra": {
    "csl_type": "proceedings-article"
   },
   "provenance": {
    "title": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1145/1730804.1730831",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "authors": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1145/1730804.1730831",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "year": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1145/1730804.1730831",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "venue": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1145/1730804.1730831",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "url": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1145/1730804.1730831",
     "checked_at": "2026-11-29T15:51:27.588Z"
    }
   },
   "status": "verified",
   "checked_at": "2026-11-29T15:51:27.588Z",
   "title_sim": 1,
   "__bib": "jansen2010fourier"
  }
 ],
 "presets": [
  {
   "id": "deep-shadow-maps-live",
   "title": "Deep Shadow Maps — hard binary single-depth shadow map (left) vs piecewise volumetric transmittance curve (right)",
   "runtime": "glsl-fragment",
   "params": {
    "P_OPTICAL_DEPTH": 1.65,
    "P_LIGHT_ANGLE": 0.55,
    "P_PLUME_TURB": 0.72,
    "P_SPLIT": 0.48
   },
   "basis": "original",
   "license_note": "MIT — written for this index.",
   "code": "const float P_OPTICAL_DEPTH = 1.65; // P Optical Depth [0.4, 3.2, 0.1]\nconst float P_LIGHT_ANGLE = 0.55; // P Light Elevation [0.15, 1.2, 0.05]\nconst float P_PLUME_TURB = 0.72; // P Cloud Wisps [0.2, 1.4, 0.05]\nconst float P_SPLIT = 0.48; // P Binary / Deep SM Split [0.0, 1.0, 0.02]\n\nfloat hash31(vec3 p) {\n  p = fract(p * vec3(127.1, 311.7, 74.7));\n  p += dot(p, p.yzx + 19.19);\n  return fract((p.x + p.y) * p.z);\n}\n\nfloat noise3(vec3 p) {\n  vec3 i = floor(p);\n  vec3 f = fract(p);\n  f = f * f * (3.0 - 2.0 * f);\n  return mix(\n    mix(mix(hash31(i), hash31(i + vec3(1.0, 0.0, 0.0)), f.x),\n        mix(hash31(i + vec3(0.0, 1.0, 0.0)), hash31(i + vec3(1.0, 1.0, 0.0)), f.x), f.y),\n    mix(mix(hash31(i + vec3(0.0, 0.0, 1.0)), hash31(i + vec3(1.0, 0.0, 1.0)), f.x),\n        mix(hash31(i + vec3(0.0, 1.0, 1.0)), hash31(i + vec3(1.0, 1.0, 1.0)), f.x), f.y),\n    f.z\n  );\n}\n\nfloat fbm3(vec3 p) {\n  float v = 0.0, a = 0.5;\n  for (int i = 0; i < 4; i++) {\n    v += a * noise3(p);\n    p *= 2.04;\n    a *= 0.5;\n  }\n  return v;\n}\n\n// Semi-transparent swirling volumetric plume hovering above a stone floor\nfloat evalCloudDensity(vec3 p, float turb) {\n  vec3 c = p - vec3(0.0, 0.24, -0.18);\n  float r = length(c * vec3(0.85, 1.18, 0.92));\n  if (r > 0.92) return 0.0;\n  float n = fbm3(c * 2.8 + vec3(iTime * 0.22, -iTime * 0.14, 0.0));\n  float base = smoothstep(0.82, 0.16, r) + (n - 0.5) * turb * 0.85;\n  return clamp(base, 0.0, 1.0) * smoothstep(0.88, 0.52, r);\n}\n\n// Integrate transmittance along light ray from p toward lDir (Deep Shadow Map T(z) vs Binary single-depth threshold!)\nfloat evalLightTrans(vec3 p, vec3 lDir, float optD, float turb, bool useDSM) {\n  float acc = 0.0;\n  bool hitBinary = false;\n  float ds = 0.085;\n  for (int i = 0; i < 14; i++) {\n    vec3 q = p + lDir * (float(i) + 0.5) * ds;\n    float d = evalCloudDensity(q, turb);\n    if (d > 0.22) hitBinary = true;\n    acc += d * ds;\n  }\n  if (useDSM) {\n    // Deep Shadow Map: smooth continuous Beer-Lambert transmittance function T(z) = exp(-sigma * integral)\n    return exp(-acc * optD * 2.8);\n  }\n  // Standard single-depth shadow map: binary 0/1 cutoff at alpha-test depth threshold!\n  return hitBinary ? 0.06 : 1.0;\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 sx = fragCoord.x / max(iResolution.x, 1.0);\n  float split = clamp(P_SPLIT, 0.0, 1.0);\n  bool useDSM = sx >= split;\n\n  float optD = clamp(P_OPTICAL_DEPTH, 0.2, 4.0);\n  float lAng = clamp(P_LIGHT_ANGLE, 0.1, 1.4);\n  float turb = clamp(P_PLUME_TURB, 0.1, 1.6);\n\n  vec3 lDir = normalize(vec3(cos(lAng) * 0.65, sin(lAng) + 0.45, 0.48));\n  vec3 ro = vec3(0.25 * sin(iTime * 0.24), 0.36, 2.25);\n  vec3 ta = vec3(0.0, -0.06, -0.15);\n  vec3 fw = normalize(ta - ro);\n  vec3 ri = normalize(cross(fw, vec3(0.0, 1.0, 0.0)));\n  vec3 up = cross(ri, fw);\n  vec3 rd = normalize(fw * 1.42 + ri * uv.x + up * uv.y);\n\n  vec3 sky = mix(vec3(0.64, 0.74, 0.88), vec3(0.16, 0.32, 0.62), smoothstep(-0.08, 0.55, rd.y));\n  vec3 col = sky;\n\n  // Floor plane y = -0.62 catching cast volumetric shadow\n  float tMax = 6.0;\n  if (rd.y < -0.005) {\n    float tf = (-0.62 - ro.y) / rd.y;\n    if (tf > 0.05 && tf < 14.0) {\n      tMax = tf;\n      vec3 fp = ro + rd * tf;\n      vec2 tile = floor(fp.xz * 2.2);\n      vec3 alb = mix(vec3(0.58, 0.56, 0.52), vec3(0.72, 0.70, 0.66), mod(tile.x + tile.y, 2.0));\n      float sh = evalLightTrans(fp + vec3(0.0, 0.02, 0.0), lDir, optD, turb, useDSM);\n      col = alb * (vec3(1.25, 1.12, 0.94) * max(lDir.y, 0.1) * sh + vec3(0.20, 0.26, 0.38));\n      col = mix(col, sky, 1.0 - exp(-tf * 0.08));\n    }\n  }\n\n  // Raymarch the floating wispy cloud volume with self-shadowing from Binary SM vs Deep Shadow Map!\n  float t0 = max(0.75, 0.05);\n  float t1 = min(tMax, 3.55);\n  if (t1 > t0) {\n    float trans = 1.0;\n    vec3 volCol = vec3(0.0);\n    const int STEPS = 32;\n    float dt = (t1 - t0) / float(STEPS);\n    float hg = 0.25 + 0.75 * pow(max(dot(rd, lDir), 0.0), 4.0);\n    for (int i = 0; i < STEPS; i++) {\n      vec3 mp = ro + rd * (t0 + (float(i) + 0.5) * dt);\n      float d = evalCloudDensity(mp, turb);\n      if (d > 0.01) {\n        float lTrans = evalLightTrans(mp, lDir, optD, turb, useDSM);\n        vec3 lit = vec3(1.45, 1.24, 0.96) * lTrans * (0.6 + 0.75 * hg) + vec3(0.24, 0.34, 0.52) * (0.5 + 0.5 * mp.y);\n        float ext = d * optD * 2.2;\n        float stepT = exp(-ext * dt);\n        volCol += trans * lit * (1.0 - stepT);\n        trans *= stepT;\n        if (trans < 0.02) break;\n      }\n    }\n    col = col * trans + volCol;\n  }\n\n  float sep = smoothstep(0.0035, 0.0008, abs(sx - split));\n  col = mix(col, vec3(0.95, 0.97, 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": "deep-shadow-maps",
     "runtime": "glsl-fragment",
     "checked_at": "2026-11-30T21:07:06.000Z",
     "renderer": "Headless EGL Tesla T4/PCIe/SSE2, OpenGL 3.30 Core, 512×512, iTime=1.5",
     "stats": {
      "mean": 0.8281,
      "std": 0.0659,
      "min": 0.6612,
      "max": 0.9059
     },
     "image": "/specimens/deep-shadow-maps-live.webp",
     "reason": null
    }
   }
  }
 ],
 "related": [
  "shadow-mapping",
  "variance-shadow-maps",
  "moment-shadow-maps",
  "percentage-closer-filtering",
  "froxel-volumetric-fog",
  "volume-ray-marching"
 ],
 "extends": [
  "shadow-mapping"
 ],
 "supersedes": [],
 "combines_with": [
  {
   "id": "openvdb",
   "why": "Volume density grids are sampled along light rays to generate the transmittance functions."
  },
  {
   "id": "volume-ray-marching",
   "why": "The marcher reads the deep shadow map to attenuate in-scattered light at each step."
  }
 ],
 "provenance": {
  "prose": "original text written for this index (research draft, editorially reviewed)",
  "sources_verified_at": "2026-11-29T15:51:27.588Z",
  "draft": "data/drafts/volumes/deep-shadow-maps.json"
 },
 "solves": [
  "hair and fur shadows look hard or aliased",
  "smoke needs soft self shadowing in an offline render",
  "shadow map cannot handle semi transparent fuzzy objects",
  "partial occlusion from fibres or clouds is missing"
 ],
 "authority": "Lokovic & Veach, 2000",
 "url": "https://texelatlas.vercel.app/t/deep-shadow-maps/",
 "execution_fidelity": "conceptual-diagram",
 "fidelity_label": "Visual Diagram",
 "benchmark_eligible": false,
 "gpu_weight": {
  "weight_x": 508.83,
  "tier": "extreme",
  "p50_ms": 16.7405,
  "p95_ms": 17.1646,
  "baseline_p50_ms": 0.0329,
  "gpu": "Tesla T4/PCIe/SSE2",
  "resolution": "1920x1080",
  "method": "opengl-timer-query",
  "frames": 16,
  "preset_id": "deep-shadow-maps-live",
  "execution_fidelity": "conceptual-diagram",
  "fidelity_label": "Visual Diagram",
  "benchmark_eligible": false,
  "generated_at": "2026-11-30T21:07:47Z",
  "l4": {
   "weight_x": 470.59,
   "tier": "extreme",
   "p50_ms": 7.4824,
   "p95_ms": 7.5903,
   "speedup_x": 2.24,
   "gpu": "NVIDIA L4/PCIe/SSE2",
   "resolution": "1920x1080",
   "baseline_p50_ms": 0.0159
  },
  "a100": {
   "weight_x": 405.19,
   "tier": "extreme",
   "p50_ms": 11.6695,
   "p95_ms": 11.7774,
   "speedup_x": 1.43,
   "gpu": "NVIDIA A100-SXM4-40GB/PCIe/SSE2",
   "resolution": "1920x1080",
   "baseline_p50_ms": 0.0288
  }
 }
}