Real-time 2D global illumination through radiance cascades. Built with the Unity SRP Render Graph system. Runs at about 14ms per frame on my RTX 3060 laptop GPU at 1920x1080 and 16 samples per pixel per cascade, or 8ms for 4 samples per pixel per cascade (which still has reasonable quality).
- Add the "2D GI" renderer feature to your URP renderer
- Use a material with the "Sprite (GI)" shader on all objects that should emit or receive global illumination.
- Objects that emit light should have a variant of the material using the "_GI_EMISSION" keyword enabled (available as a toggle in the inspector).
The renderer feature has the following options to configure:
rayCountExponent(default2): Configures the number of rays per pixel per cascade. The actual number of rays is4^rayCountExponent, to make sure a valid spatial subdivision can be made. This will also determine the number of cascades.maxSteps(default32): The amount of raymarching steps. The default should be sufficient to reach the end of the screen, unless you have a lot of high frequency details.bilinearSampling(defaulttrue);
Made possible by Jason McGhee's excellent write-up and the original radiance cascades paper.

