Builtin Library
README.md
ScreenSpaceReflections
Reflections off the scene's own drawn frame, as a one-feature component. A
scene lists its features together, each with its settings, on RenderFeatures
({ feature = "@builtin::systems.reflections.ssr", settings = { ... } }); this
component carries the same knobs as fields for one feature.
local id = entity.spawn("reflections").id
entity(id).component.add("ScreenSpaceReflections", {
intensity = 1.0,
maxDistance = 40,
quality = "high",
})
Polished floors start reflecting what stands on them, wet ground reflects what is above it, and metal picks up its surroundings — all from geometry the camera can already see, with nothing authored per surface.
Roughness decides who gets them. A screen-space ray traces one direction, which
is a mirror; roughnessCutoff is where that stops being a fair stand-in for a
surface's real lobe, and past it the pass leaves the surface alone.
Every field is live: edit one in the inspector and the reflections follow.
Setting intensity to 0 turns them off without losing the rest of the settings.
Several of these in one scene share one set of reflections: the one edited last is in force, removing it hands the reflections to the newest of the others, and only removing the last one takes them down. While one stands in the scene, the reflections come back if something else takes them down.
How much a reflection shows through is the surface's own Fresnel term, so metal takes almost all of it and a dielectric floor takes a few percent head-on and more at a grazing angle — the same way a wet road reads dry underfoot and mirror-like down the street.
For code that adjusts reflections at runtime, reach for
@builtin::systems.reflections.ssr — same options, no component.
The full description of what each knob does and how the passes work is in the
package readme: guides { path = "systems/reflections" }.