Screen Space Reflection (SSR)
What is Screen Space Reflection
Screen Space Reflection (SSR) is a real-time rendering technique used to simulate reflections on smooth surfaces. It computes reflection rays based on screen-space information (such as color buffer, depth buffer, normal buffer) rather than relying on pre-baked environment maps. SSR provides more accurate dynamic reflections than reflection probes, especially for reflecting objects visible on screen.
How SSR Works
The basic process of SSR is as follows:
- For each pixel, compute the reflection direction based on its world-space position and normal.
- Perform ray marching in screen space along the reflection direction, sampling the depth buffer to find surfaces intersected by the reflection ray.
- If an intersection is found, retrieve the color from the color buffer at that point as the reflection color.
- If no intersection is found, fall back to other reflection sources (e.g., reflection probes).
- **Dynamic Reflections**: Can reflect dynamic objects on screen, not limited by pre-baking.
- **Rich Detail**: Reflection content is based on actual rendered results, high realism.
- **No Extra Geometry Rendering**: Uses only screen-space data, cheaper than planar reflections or render-to-texture.
- **Screen-Space Limitation**: Can only reflect objects visible on screen; off-screen or back-facing objects cannot be reflected.
- **Performance Cost**: Ray marching requires multiple depth samples, can be expensive at high resolutions.
- **Noise**: If marching precision is insufficient, noise or banding may occur, requiring post-process denoising.
- **Thickness Issue**: For thin objects, depth comparison may be inaccurate, causing missing or incorrect reflections.
- **Reduce Resolution**: Compute SSR at half or quarter resolution, then upsample.
- **Hierarchical Depth (Hi-Z)**: Use mipmap chain to accelerate ray marching, reducing steps.
- **Limit Reflection Distance**: Set a maximum reflection distance to avoid long marches.
- **Temporal Filtering**: Combine with previous frame results to reduce noise.
- **Importance Sampling**: Adjust marching strategy based on material roughness.
Ray marching can use fixed steps, hierarchical steps (Hi-Z), or hybrid methods to improve performance and accuracy.
Advantages of SSR
Limitations of SSR
SSR Optimization
Combining SSR with Other Reflection Techniques
SSR is often used in conjunction with reflection probes and planar reflections. When SSR fails, fall back to reflection probes to ensure reflection information is always available. Ray tracing can also be used for more complete reflections.
Conclusion
SSR is an important reflection technique in modern real-time rendering, offering a good balance between performance and quality.
FAQ
What is the difference between SSR and ray-traced reflections?
SSR only uses screen-space information, cannot reflect off-screen objects, and has limited accuracy; ray-traced reflections can handle reflections in any direction, more accurate but with higher performance cost.
Does SSR support rough surface reflections?
Yes, but rough surface reflections are blurry, requiring more samples or pre-filtering. SSR works best for smooth surfaces; rough surfaces can rely on reflection probes.
How to reduce SSR noise?
Use temporal filtering, spatial filtering, increase marching precision, or use importance sampling. Combining with blur can also help.
Is SSR suitable for mobile platforms?
Mobile platforms have limited performance, SSR may be too expensive. But simplified versions can be used, or rely on reflection probes.
What buffers does SSR require?
Requires color buffer, depth buffer, and normal buffer. These are easily obtained in deferred rendering; forward rendering may need extra generation.