Home

Awesome

kode80SSR

An open source (FreeBSD license) screen space reflections implementation for Unity3D 5. Features GPU DDA for screen space ray casting (derived from Morgan McGuire & Mike Mara's work), backface depth buffer for per-pixel geometry thickness, distance attenuated pixel stride, rough/smooth surface reflection blurring, fully customizable for quality/speed and more.

Read more on implementation: http://www.kode80.com/blog/2015/03/11/screen-space-reflections-in-unity-5

Usage

Add the SSR component to a Camera, see properties section below for details. Requires deferred rendering path and a scene made up of Standard Shader materials.

Status

Currently tested and optimized for OSX & Windows. Physically correct handling of specular is faked for now.

Properties

Downsample:

Each of the 3 main passes can be optionally downsampled to trade quality for performance.

Raycast:

For every pixel in the SSR pass a ray is cast. For every step of a ray the frontface and backface depth textures are sampled and ray intersection tests performed. This is the most demanding pass of the shader and so minimizing the number of steps per ray will have the biggest positive impact on performance. Depending on the scene it is possible to get acceptable results with a surprisingly small number of steps (less than 10 steps in some cases).

Reflection Fading:

Since SSR is a screen space effect, we rely on depth and normal passes for geometry information. This means that any geometry not rendered to the screen can not be reflected. To minimize the obviousness of this deficiency we can detect and smoothly fade these reflections.

Roughness:

Generally speaking, in PBR roughness/smoothness controls how sharp reflections appear. This is faked in the kode80SSR shader by using the roughness channel of the GBuffer to control the per-pixel radius of a bilateral blur pass.