ScreenSpaceReflections

ScreenSpaceReflections

  • perceptual_roughness_threshold : f32
  • thickness : f32
  • linear_steps : u32
  • linear_march_exponent : f32
  • bisection_steps : u32
  • use_secant : bool

Description

Add this component to a camera to enable screen-space reflections (SSR).

Screen-space reflections currently require deferred rendering in order to appear. Therefore, they also need the [DepthPrepass] and [DeferredPrepass] components, which are inserted automatically.

SSR currently performs no roughness filtering for glossy reflections, so only very smooth surfaces will reflect objects in screen space. You can adjust the perceptual_roughness_threshold in order to tune the threshold below which screen-space reflections will be traced.

As with all screen-space techniques, SSR can only reflect objects on screen. When objects leave the camera, they will disappear from reflections. An alternative that doesn't suffer from this problem is the combination of a LightProbe and [EnvironmentMapLight]. The advantage of SSR is that it can reflect all objects, not just static ones.

SSR is an approximation technique and produces artifacts in some situations. Hand-tuning the settings in this component will likely be useful.

Screen-space reflections are presently unsupported on WebGL 2 because of a bug whereby Naga doesn't generate correct GLSL when sampling depth buffers, which is required for screen-space raymarching.

Functions