Monograph · 08 · Hybrid RT
Pipelines · full depth
Hybrid ray tracing
Document RT shadow and RT GI as first-class techniques: how they init (pipeline + SBT), what they bind each frame, and exactly where deferred inserts them. Not a third world model.
Injection model
Deferred still owns beauty. Hybrid answers two questions with rays on the same TLAS the path tracer uses: “is this lit?” and “what one-bounce indirect arrives?”
Dashed arrow: results feed lighting; no second scene upload.
Technique init lifecycle
Both RTShadowTechnique and RTGITechnique follow the same skeleton (see their init):
- Load KHR ray-tracing function pointers
createOutputImage— full-res storage image for visibility or GI- GI only: material albedo buffer for secondary shading
createDescriptorResources— TLAS + GBuffer views + outputscreateRTPipeline— compact raygen/miss/(hit) groupcreateShaderBindingTableresizewhen framebuffer size changes
Full PT carries 30+ AOVs and multi-bounce state. Hybrid needs thin pipelines that only answer V or Lᵢ¹ and fit inside the deferred graph’s time budget.
Shadow render workflow
- Fill
ShadowInput: position/normal/depth views, view/proj, camera pos, size, light direction/type - Update descriptors if views changed
- Push constants / uniforms for light
traceRays— primary work is visibility rays from GBuffer world pos- Output: soft/hard visibility factor image
- Lighting samples it as Vₖ
Ray flags typically prioritize TerminateOnFirstHit and skip shading — pure occlusion. Soft shadows average multiple samples toward an area/sphere light (same idea as PT NEE, cheaper continuation).
GI render workflow
- Inputs: position, normal, albedo, depth + camera + TLAS
- Optional material albedo SSBO for hit shading
- For each pixel: sample hemisphere at normal; trace one secondary ray
- On hit: shade with direct / emissive / simple lighting; on miss: env if bound
- Weight by BRDF×cosine/pdf; write indirect RGB
- Lighting adds as bounce fill (biased vs full path trace)
Realtime. Multi-bounce color bleeding is PathTracer’s job (Ch. 06). Hybrid targets contact GI and soft fill for deferred iteration.
Placement in deferred graph
- CSM (raster cascades)
- GBuffer MRT
- SSAO → bind into lighting
- if AS supported && instanceCount > 0: addComputePass RTShadow
- if same: RT GI pass
- Deferred lighting consumes V and Lᵢ¹
- Sky / post
Graph declares texture reads so barriers place GBuffer in SHADER_READ before RT techniques sample it.
Host enable path
// each deferred frame
if (m_rtAccel && m_rtAccel->isSupported()) {
m_deferredRenderer->setAccelerationStructure(m_rtAccel.get());
m_deferredRenderer->setRTShadowsEnabled(true);
}
// techniques only run if instanceCount > 0 inside deferred graph
Limits
Static BLAS in trunk (animation removed). Hybrid ≠ PT parity. Noise depends on spp/filter — often combined with temporal post, not offline OIDN.
rt_shadow_technique.cppinit · SBT · renderrt_gi_technique.cppinit · materials · renderdeferred_renderer.cppgraph injectrender_dispatch.cpphost enablert_acceleration_structure.*shared TLASDesign units in this module
Each card is a focused design page (what / how / why + sources). Full tree: Sitemap.