Skip to content
/ SSRT Public
forked from cdrinmatane/SSRT

Real-time indirect diffuse illuminaton using screen-space information for Unity.

License

Notifications You must be signed in to change notification settings

ddutchie/SSRT

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ssrt

Screen Space Ray Tracing

Real-time indirect diffuse illuminaton using screen-space information for Unity.

Features

  • One bounce indirect diffuse lighting.
  • Ambient occlusion.
  • Support of emissive surfaces as indirect light source.
  • Fallback to Unity ambient or cubemap based ambient.

Limitations

  • Currently still using legacy rendering pipeline.
  • Works only with Deferred rendering.

Installation

Copy the SSRT folder in the Asset folder of your Unity project, and add the SSRT component on the main camera. Tested with Unity 2019.1.1f1.

The project needs to be in linear color space, and the camera should use deferred rendering.

It's highly recommended to add the latest post-processing stack package from the package manager and activate temporal anti-aliasing on the main camera. This will help remove a lot of the noise.

Usage

There are keyboard shortcuts to enable/disable SSRT, mapped to the following numbers:

  • 1 = SSRT On.
  • 2 = SSRT Off.
  • 3 = Indirect lighting with texture.
  • 4 = Indirect lighting only.
  • 5 = SSRT On with AO enabled also on direct lighting.
  • H = Set half resolution rendering.
  • F = Set full resolution rendering.

Properties

Sampling

  • Rotation Count: Number of directionnal rotations applied during sampling.
  • Step Count: Number of samples taken along one edge of the current conic slice. The total number of samples taken per pixel is rotationCount * stepCount * 2.
  • Radius: Effective sampling radius in world space. AO and GI can only have influence within that radius.
  • Exp Start / Exp Factor: Controls samples distribution. Exp Start is an initial multiplier on the step size, and Exp Factor is an exponent applied at each step. By using a start value < 1, and an exponent > 1, it's possible to get exponential step size.
  • Jitter Samples: Applies some noise on sample positions to hide the banding artifacts that can occur when there is undersampling.

GI

  • GI Boost: Intensity of the indirect diffuse light.
  • Light Buffer HDR: Using an HDR light buffer gives more accurate lighting but have an impact on performances.
  • Light Buffer Resolution: Using lower resolution light buffer can help performances but can accentuate aliasing.
  • LnDl Offset: Bypass the dot(lightNormal, lightDirection) weighting.
  • nDl Offset: Bypass the dot(normal, lightDirection) weighting.

Occlusion

  • Power: Power function applied to AO to make it appear darker/lighter.
  • Thickness: Constant thickness value of objects on the screen in world space. Is used to ignore occlusion past that thickness level, as if light can travel behind the object.
  • Falloff: Occlusion falloff relative to distance.
  • Multi Bounce AO: Multi-Bounce analytic approximation from GTAO.
  • Direct Lighting AO: Composite AO also on direct lighting.

Offscreen Fallback

  • Fallback Method: Ambient lighting to use. Off uses the Unity ambient lighting, but it's possible to use instead a static irradiance cubemap (pre-convolved), or render a cubemap around camera every frame (expensive).
  • Cubemap Fallback: Static irradiance cubemap to use if it's the chosen fallback.

Filters

  • Resolution Downscale: The resolution at which SSRT is computed. If lower than fullscreen the effect will be upscaled to fullscreen afterwards. Lower resolution can help performances but can also introduce more flickering/aliasing. Important: resolution needs to be divisible by 2 when using downscaling or it can introduce artifacts. Use a fixed resolution instead of free aspect.
  • Reuse Count: Number of neighbor pixel to reuse (helps reduce noise).
  • Temporal Enabled: Enable/Disable temporal reprojection.
  • Temporal Response: Controls the speed of the accumulation, slower accumulation is more effective at removing noise but can introduce ghosting.

Debug Mode

  • Debug Mode: View of the different SSRT buffers for debug purposes.
  • Light Only: If enabled will show only the radiance that affects the surface, if unchecked radiance will be multiplied by surface albedo.

Credits

The following code has been developed at CDRIN by Olivier Therrien as a R&D project on real-time global illumination.

cdrin

License

The SSRT code is under MIT license (See LICENSE file).

The Plaza model is made by patrix, is under CC Attribution-NonCommercial-ShareAlike license, and comes from here.

Acknowledgements

This project drew a lot of inspiration from the following work:

About

Real-time indirect diffuse illuminaton using screen-space information for Unity.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C# 55.7%
  • HLSL 22.3%
  • ShaderLab 22.0%