Skip to main content

Module rt_reflections

Module rt_reflections 

Source
Expand description

Hardware ray-traced reflection configuration. Backend-agnostic resolve of the authored PostProcessConfig fields into clamped settings, plus the per-frame GPU uniform. The acceleration-structure build and the inline ray-trace itself live in the backend (Metal); this module owns only the parameter math so it can be unit-tested without a GPU.

RT reflections replace SSR’s screen-space resolve: they reuse the same authored ssr_intensity / ssr_max_distance tunables (so a world toggling from SSR to RT keeps the same look knobs) but trace a real ray against the scene BVH, so reflected geometry that is off-screen still appears.

Structs§

RtParamsInputs
Per-frame camera + sun inputs for building the RT-reflection GPU uniform. fov_y_radians / aspect give the view-ray scale used to rebuild a view-space position from the SSR pre-pass G-buffer. inv_view_rot is the view-to-world rotation (the transpose of the view matrix’s orthonormal 3x3) and cam_pos the world camera position; together they form the camera-to-world transform that lifts the reconstructed hit point + normal into the BVH’s world space. sun_dir is the world-space unit direction toward the sun and sun_color its radiance; prefilter_mip_count is the IBL cubemap mip count (0 = no IBL) for the miss fallback.
RtReflectionSettings
Clamped RT-reflection tunables resolved from the authored asset fields. Held by the backend and turned into a per-frame RtParams once the camera and sun are known.