{
 "id": "hybrid-ray-traced-reflections",
 "title": "Hybrid ray-traced reflections",
 "aliases": [
  "RT reflections with SSR fallback",
  "hybrid reflections",
  "ray-traced reflections denoised"
 ],
 "domain": "gi",
 "subdomain": "specular GI",
 "stage": "lighting",
 "realtime": "realtime",
 "platforms": [
  "desktop-gpu",
  "unreal",
  "unity"
 ],
 "year_introduced": 2018,
 "inputs": [
  "gbuffer",
  "depth",
  "normals",
  "irradiance-probes"
 ],
 "outputs": [
  "radiance"
 ],
 "style": "photoreal",
 "dynamic": "dynamic",
 "summary": "Reflections are traced against the scene only where screen-space reflections or probes would fail, with ray counts adapted to roughness and a denoiser to clean the result. It trades some tracing cost for high-quality, off-screen reflections.",
 "how_it_works": "A hybrid pipeline mixes sources for the reflected radiance. The cheapest is screen-space marching ([screen-space-reflections](screen-space-reflections)); when the march leaves the screen or reaches hidden surfaces the pipeline falls back to hardware ray tracing against the BVH, and misses beyond that read a reflection probe ([reflection-probes-parallax-corrected-cubemaps](reflection-probes-parallax-corrected-cubemaps)) or sky.\n\nRays are generated per pixel from importance-sampled GGX normals ([vndf-sampling](vndf-sampling)), with count and tracing budget scaled by roughness. Very rough surfaces skip tracing entirely and use probes. At hit points the renderer evaluates a simplified material with probe or cached lighting rather than recursive shading, to bound cost.\n\nThe traced result is noisy, so a spatial filter guided by roughness and a temporal accumulation stage reconstruct it. Shadow rays at the hit and a reflection-to-reflection depth of one keep it within a frame budget on current GPUs.",
 "when_to_use": "Choose it for mirror-like and glossy reflections of dynamic content on ray-tracing-capable hardware, where SSR leaves holes at screen edges and probes are too coarse.\n\nPrefer [screen-space-reflections](screen-space-reflections) alone on mid-range hardware or when off-screen reflections are unimportant. Prefer [planar-reflections-oblique-clipping](planar-reflections-oblique-clipping) for a single flat mirror where re-rendering is cheaper and exact. Prefer [path-tracing](path-tracing) or [restir-gi](restir-gi) when reflections must include multiple glossy bounces and full global illumination, and [reflection-probes-parallax-corrected-cubemaps](reflection-probes-parallax-corrected-cubemaps) when rays are unavailable.",
 "cost": {
  "class": "heavy",
  "notes": "Tracing plus denoising typically takes several milliseconds at 1080p on ray-tracing GPUs; cost scales with ray count and hit-shader complexity."
 },
 "failure_modes": [
  "Visible seam where the pipeline switches between SSR, traced and probe sources, especially in mirrored moving content",
  "Noisy or smeared rough reflections when the denoiser's history is rejected on moving objects",
  "Ghosting of dynamic objects because temporal accumulation keeps reflections from previous frames",
  "Reflections of simplified hit shading look flatter than the directly shaded scene",
  "Ray budget runs out on very glossy large surfaces such as wet floors, producing tracing bubbles",
  "Fine detail such as thin grates or foliage gives incoherent rays and slow traversal"
 ],
 "sources": [
  {
   "role": "primary",
   "key": "doi:10.1007/978-1-4842-4427-2_25",
   "type": "chapter",
   "title": "Hybrid Rendering for Real-Time Ray Tracing",
   "authors": [
    "Colin Barré-Brisebois",
    "Henrik Halén",
    "Graham Wihlidal",
    "Andrew Lauritzen",
    "Jasper Bekkers",
    "Tomasz Stachowiak",
    "Johan Andersson"
   ],
   "year": 2019,
   "venue": "Ray Tracing Gems",
   "url": "https://doi.org/10.1007/978-1-4842-4427-2_25",
   "ids": {
    "doi": "10.1007/978-1-4842-4427-2_25"
   },
   "license": null,
   "extra": {
    "csl_type": "book-chapter"
   },
   "provenance": {
    "title": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1007/978-1-4842-4427-2_25",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "authors": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1007/978-1-4842-4427-2_25",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "year": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1007/978-1-4842-4427-2_25",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "venue": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1007/978-1-4842-4427-2_25",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "url": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1007/978-1-4842-4427-2_25",
     "checked_at": "2026-11-29T15:51:27.588Z"
    }
   },
   "status": "verified",
   "checked_at": "2026-11-29T15:51:27.588Z",
   "title_sim": 1,
   "__bib": "barrbrisebois2019hybrid"
  },
  {
   "role": "implementation",
   "key": "gh:nvidiagameworks/falcor",
   "type": "code",
   "title": "NVIDIAGameWorks/Falcor",
   "description": "Real-Time Rendering Framework",
   "authors": [
    "NVIDIAGameWorks"
   ],
   "year": 2017,
   "venue": "GitHub",
   "url": "https://github.com/NVIDIAGameWorks/Falcor",
   "ids": {
    "repo": "NVIDIAGameWorks/Falcor"
   },
   "license": "NOASSERTION",
   "extra": {
    "stars": 3285,
    "stars_checked": "2026-11-29",
    "archived": false,
    "fork": false,
    "pushed_at": "2026-09-21T15:12:00Z",
    "language": "C++",
    "homepage": "https://developer.nvidia.com/falcor",
    "license_name": "Other"
   },
   "provenance": {
    "title": {
     "authority": "github",
     "endpoint": "https://api.github.com/repos/NVIDIAGameWorks/Falcor",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "authors": {
     "authority": "github",
     "endpoint": "https://api.github.com/repos/NVIDIAGameWorks/Falcor",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "year": {
     "authority": "github",
     "endpoint": "https://api.github.com/repos/NVIDIAGameWorks/Falcor",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "venue": {
     "authority": "github",
     "endpoint": "https://api.github.com/repos/NVIDIAGameWorks/Falcor",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "url": {
     "authority": "github",
     "endpoint": "https://api.github.com/repos/NVIDIAGameWorks/Falcor",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "license": {
     "authority": "github",
     "endpoint": "https://api.github.com/repos/NVIDIAGameWorks/Falcor",
     "checked_at": "2026-11-29T15:51:27.588Z"
    }
   },
   "status": "verified",
   "checked_at": "2026-11-29T15:51:27.588Z",
   "title_sim": null,
   "__bib": "nvidiagameworks2017nvidiagameworks"
  }
 ],
 "presets": [
  {
   "id": "hybrid-ray-traced-reflections-live",
   "title": "Hybrid Ray-Traced Reflections — screen-space reflection holes & missing off-screen emitters (left) vs world-space RT fallback (right)",
   "runtime": "glsl-fragment",
   "params": {
    "P_FLOOR_ROUGH": 0.1,
    "P_PANEL_GLOW": 1.4,
    "P_CAM_SWAY": 0.45,
    "P_SPLIT": 0.48
   },
   "basis": "original",
   "license_note": "MIT — written for this index.",
   "code": "const float P_FLOOR_ROUGH = 0.10; // P Floor Roughness [0.02, 0.35, 0.02]\nconst float P_PANEL_GLOW = 1.40; // P Neon Intensity [0.4, 2.4, 0.1]\nconst float P_CAM_SWAY = 0.45; // P Camera Sway [0.0, 1.5, 0.05]\nconst float P_SPLIT = 0.48; // P SSR / Hybrid RT Split [0.0, 1.0, 0.02]\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// Gallery hall with glossy floor, pillars, a central sculpture, AND off-screen overhead neon light strips!\nvec2 mapGallery(vec3 p) {\n  float dFloor = p.y + 0.65;\n  vec2 res = vec2(dFloor, 1.0);\n\n  // Back wall\n  float dBack = p.z + 2.45;\n  if (dBack < res.x) res = vec2(dBack, 2.0);\n\n  // Two dark slate pillars (visible on-screen)\n  float dP1 = sdBox(p - vec3(-0.92, 0.25, -0.75), vec3(0.22, 0.92, 0.22));\n  if (dP1 < res.x) res = vec2(dP1, 3.0);\n  float dP2 = sdBox(p - vec3(0.92, 0.25, -0.95), vec3(0.22, 0.92, 0.22));\n  if (dP2 < res.x) res = vec2(dP2, 3.0);\n\n  // Central floating warm amber neon ring/monolith (partially on screen)\n  float dCol = length(p - vec3(0.0, -0.05, -0.55)) - 0.34;\n  if (dCol < res.x) res = vec2(dCol, 4.0);\n\n  // OFF-SCREEN overhead magenta-gold ceiling light panel (above camera frustum y = 1.45!)\n  float dCeilPanel = sdBox(p - vec3(0.0, 1.48, -0.65), vec3(1.15, 0.06, 0.55));\n  if (dCeilPanel < res.x) res = vec2(dCeilPanel, 5.0);\n\n  // OFF-SCREEN behind-pillar cyan vertical beacon strip (occluded from primary camera!)\n  float dHiddenStrip = sdBox(p - vec3(-0.92, 0.15, -1.28), vec3(0.16, 0.72, 0.06));\n  if (dHiddenStrip < res.x) res = vec2(dHiddenStrip, 6.0);\n\n  return res;\n}\n\nvec3 calcNormal(vec3 p) {\n  vec2 e = vec2(0.0025, 0.0);\n  return normalize(vec3(\n    mapGallery(p + e.xyy).x - mapGallery(p - e.xyy).x,\n    mapGallery(p + e.yxy).x - mapGallery(p - e.yxy).x,\n    mapGallery(p + e.yyx).x - mapGallery(p - e.yyx).x\n  ));\n}\n\nvec3 shadeHit(vec3 p, vec3 n, float id, float glow) {\n  vec3 lDir = normalize(vec3(0.45, 0.85, 0.35));\n  float ndl = max(dot(n, lDir), 0.0);\n  if (id < 1.5) return vec3(0.06, 0.07, 0.09) * (0.4 + 0.6 * ndl);\n  if (id < 2.5) {\n    float stripe = smoothstep(0.06, 0.01, abs(fract(p.x * 1.4) - 0.5));\n    return mix(vec3(0.14, 0.16, 0.21), vec3(0.28, 0.32, 0.40), stripe) * (0.35 + 0.65 * ndl);\n  }\n  if (id < 3.5) {\n    // Pillar with thin emissive trim\n    float trim = smoothstep(0.06, 0.015, abs(p.y + 0.12));\n    return vec3(0.18, 0.21, 0.28) * (0.3 + 0.7 * ndl) + vec3(0.18, 0.88, 1.0) * trim * glow * 1.4;\n  }\n  if (id < 4.5) return vec3(0.95, 0.66, 0.28) * (0.28 + 0.72 * ndl);\n  if (id < 5.5) {\n    // Overhead off-screen neon art panel (warm coral + magenta bars)\n    float bars = 0.5 + 0.5 * sin(p.x * 7.5 + iTime * 1.4);\n    return mix(vec3(2.4, 0.32, 0.58), vec3(2.8, 1.45, 0.25), bars) * glow;\n  }\n  return vec3(0.16, 1.95, 2.35) * glow;\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 useHybridRT = sx >= split;\n\n  float rough = clamp(P_FLOOR_ROUGH, 0.01, 0.45);\n  float glow = clamp(P_PANEL_GLOW, 0.3, 2.8);\n  float sway = sin(iTime * max(P_CAM_SWAY, 0.0) * 0.8) * 0.28;\n\n  vec3 ro = vec3(sway, 0.16, 2.15);\n  vec3 ta = vec3(0.0, -0.22, -0.65);\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  float fl = 1.48;\n  vec3 rd = normalize(fw * fl + ri * uv.x + up * uv.y);\n\n  vec3 envAmb = mix(vec3(0.04, 0.05, 0.08), vec3(0.11, 0.14, 0.22), smoothstep(-0.3, 0.5, rd.y));\n  vec3 col = envAmb;\n\n  float t = 0.05;\n  float hitId = 0.0;\n  for (int i = 0; i < 64; i++) {\n    vec2 h = mapGallery(ro + rd * t);\n    if (h.x < 0.002) { hitId = h.y; break; }\n    t += h.x;\n    if (t > 9.0) break;\n  }\n\n  if (hitId > 0.5) {\n    vec3 p = ro + rd * t;\n    vec3 n = calcNormal(p);\n    col = shadeHit(p, n, hitId, glow);\n\n    // Glossy reflection pass on marble floor (id == 1) and chrome sphere (id == 4)\n    if (hitId < 1.5 || (hitId > 3.5 && hitId < 4.5)) {\n      vec3 reflN = n;\n      if (hitId < 1.5) {\n        // Subtle marble tile normal ripple for floor roughness\n        vec2 tile = floor(p.xz * 2.0);\n        float w = sin(p.x * 16.0 + tile.y) * cos(p.z * 16.0 + tile.x) * rough * 0.08;\n        reflN = normalize(n + vec3(w, 0.0, -w));\n      }\n      vec3 rDir = reflect(rd, reflN);\n      vec3 rOrig = p + n * 0.015;\n\n      // Trace world-space reflection ray\n      float rt = 0.04;\n      float rId = 0.0;\n      for (int j = 0; j < 52; j++) {\n        vec2 rh = mapGallery(rOrig + rDir * rt);\n        if (rh.x < 0.003) { rId = rh.y; break; }\n        rt += rh.x;\n        if (rt > 8.0) break;\n      }\n\n      vec3 reflCol = envAmb;\n      if (rId > 0.5) {\n        vec3 rp = rOrig + rDir * rt;\n        vec3 rn = calcNormal(rp);\n        vec3 trueRefl = shadeHit(rp, rn, rId, glow);\n\n        // Project reflection hit point rp back into primary camera screen space to test SSR visibility!\n        vec3 camToHit = rp - ro;\n        float cz = dot(camToHit, fw);\n        vec2 projUv = vec2(dot(camToHit, ri), dot(camToHit, up)) * (fl / max(cz, 0.05));\n        float aspect = iResolution.x / max(iResolution.y, 1.0);\n        bool onScreen = (cz > 0.1) && (abs(projUv.x) < 0.48 * aspect) && (abs(projUv.y) < 0.46);\n        // Also test if rp is occluded from the primary camera (e.g., back of pillar or hidden beacon)\n        bool unoccluded = onScreen;\n        if (onScreen) {\n          vec3 camDir = normalize(camToHit);\n          float camDist = length(camToHit);\n          float ocT = 0.08;\n          for (int k = 0; k < 24; k++) {\n            float od = mapGallery(ro + camDir * ocT).x;\n            if (od < 0.008 && ocT < camDist - 0.08) { unoccluded = false; break; }\n            ocT += max(od, 0.06);\n            if (ocT >= camDist - 0.08) break;\n          }\n        }\n\n        if (useHybridRT) {\n          // Hybrid RT: seamlessly uses world-space ray hit everywhere, even off-screen or occluded!\n          reflCol = trueRefl;\n        } else {\n          // SSR-only: succeeds for visible on-screen objects, but drops out to dull probe fallback off-screen/occluded!\n          float edgeFade = smoothstep(0.49 * aspect, 0.36 * aspect, abs(projUv.x)) * smoothstep(0.47, 0.34, abs(projUv.y));\n          float ssrConf = (unoccluded ? 1.0 : 0.0) * edgeFade;\n          reflCol = mix(envAmb * 0.8, trueRefl, ssrConf);\n        }\n      }\n\n      float ndv = max(dot(reflN, -rd), 0.0);\n      float F = (hitId < 1.5) ? (0.18 + 0.78 * pow(1.0 - ndv, 4.0)) : (0.55 + 0.45 * pow(1.0 - ndv, 4.0));\n      col = mix(col, reflCol, clamp(F * (1.0 - rough * 0.6), 0.0, 0.94));\n    }\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": "reduced-sandbox",
   "proof": {
    "kind": "rendered",
    "label": "rendered 2026-11-30",
    "ok": true,
    "proof": {
     "ok": true,
     "technique": "hybrid-ray-traced-reflections",
     "runtime": "glsl-fragment",
     "checked_at": "2026-11-30T21:07:12.000Z",
     "renderer": "Headless EGL Tesla T4/PCIe/SSE2, OpenGL 3.30 Core, 512×512, iTime=1.5",
     "stats": {
      "mean": 0.4093,
      "std": 0.1389,
      "min": 0.253,
      "max": 0.9281
     },
     "image": "/specimens/hybrid-ray-traced-reflections-live.webp",
     "reason": null
    }
   }
  }
 ],
 "related": [
  "screen-space-reflections",
  "reflection-probes-parallax-corrected-cubemaps",
  "planar-reflections-oblique-clipping",
  "vndf-sampling",
  "restir-gi",
  "path-tracing"
 ],
 "extends": [
  "screen-space-reflections"
 ],
 "supersedes": [],
 "combines_with": [
  {
   "id": "vndf-sampling",
   "why": "Visible-normal sampling picks the microfacet normal for each reflection ray so rough lobes are sampled efficiently."
  },
  {
   "id": "blue-noise-screen-space-sampler",
   "why": "Per-pixel ray directions use the sampler so the noise the denoiser sees is high-frequency."
  },
  {
   "id": "temporal-anti-aliasing",
   "why": "Reprojection and history rejection logic is shared between the reflection denoiser and TAA."
  }
 ],
 "provenance": {
  "prose": "original text written for this index (research draft, editorially reviewed)",
  "sources_verified_at": "2026-11-29T15:51:27.588Z",
  "draft": "data/drafts/gi/hybrid-ray-traced-reflections.json"
 },
 "solves": [
  "screen space reflections are missing off screen content",
  "want high quality glossy reflections on rtx hardware",
  "reflections need to fall back gracefully when rays miss",
  "probes reflections are too coarse for mirror like floors"
 ],
 "authority": "Barré-Brisebois et al., 2019",
 "url": "https://texelatlas.vercel.app/t/hybrid-ray-traced-reflections/",
 "execution_fidelity": "reduced-sandbox",
 "fidelity_label": "Analytic Sandbox",
 "benchmark_eligible": true,
 "gpu_weight": {
  "weight_x": 42.15,
  "tier": "heavy",
  "p50_ms": 1.3866,
  "p95_ms": 1.4713,
  "baseline_p50_ms": 0.0329,
  "gpu": "Tesla T4/PCIe/SSE2",
  "resolution": "1920x1080",
  "method": "opengl-timer-query",
  "frames": 32,
  "preset_id": "hybrid-ray-traced-reflections-live",
  "execution_fidelity": "reduced-sandbox",
  "fidelity_label": "Analytic Sandbox",
  "benchmark_eligible": true,
  "generated_at": "2026-11-30T21:07:47Z",
  "l4": {
   "weight_x": 46.43,
   "tier": "heavy",
   "p50_ms": 0.7383,
   "p95_ms": 0.7453,
   "speedup_x": 1.88,
   "gpu": "NVIDIA L4/PCIe/SSE2",
   "resolution": "1920x1080",
   "baseline_p50_ms": 0.0159
  },
  "a100": {
   "weight_x": 27.49,
   "tier": "heavy",
   "p50_ms": 0.7918,
   "p95_ms": 0.7969,
   "speedup_x": 1.75,
   "gpu": "NVIDIA A100-SXM4-40GB/PCIe/SSE2",
   "resolution": "1920x1080",
   "baseline_p50_ms": 0.0288
  }
 }
}