logo

rendering · rendering

ScreenSpaceReflections

Free

Install with the CLI:

bjs download ScreenSpaceReflections

ScreenSpaceReflections

Wet floors and metal that shows the room.

JSON
"Sky": {
  "components": {
    "EnvironmentTexture": { "preset": "studio" },
    "ScreenSpaceReflections": { "strength": 0.8 }
  }
}

Screen-space reflections ray-march the depth and normal buffers of the frame already drawn, so anything on screen can reflect anything else on screen: rail in a flooded tunnel, a lamp in a steel wall. What is off screen cannot reflect, which is the trade you make for not rendering the scene twice.

The engine work lives in an adapter plugin. A project made with bjs create installs it for you: src/main.ts calls every adapter/register.ts that bjs download puts in the project, before the scene loads. If you boot the game from your own code, call it once:

TypeScript
import { registerScreenSpaceReflectionsExtension } from './Components/ScreenSpaceReflections/adapter/register';
registerScreenSpaceReflectionsExtension(adapter);

The playground does the same. Without it the component is inert.

Knobs

FieldDefaultWhat it does
activetrueMaster switch.
strength0.8How much reflection is mixed in.
reflectivityThreshold0.04Surfaces below this reflectivity stay matte. Raise it on a kit-bashed scene so rock stays rock and only metal and water shine.
maxDistance40How far a ray may travel, world units.
thickness0.5Assumed surface thickness for the march. Too small and thin rails are missed; too large and reflections smear.
maxSteps48Ray-march steps. Sharper and slower as it rises.
blur0.030 is a mirror.
roughnessFactor0.2Rough materials reflect less. 0 disables.
downsample1Reflection pass at half resolution. 0 for full, 2 for quarter.

Every field is live: change one on the component and the next frame shows it.

Pairs with

An EnvironmentTexture, always. Reflections fill in what the environment map cannot know about — the room — but the environment is what makes the metal read as metal in the first place. ToneMapping keeps the bright reflections from clipping.

More like this

Was this page helpful?

We read every note — tell us what's working and what isn't.

↑↓ NavigateEnter SelectEsc CloseCtrl+K Open Search