Surface Cache GI Preview

Hi everybody! My name is Rasmus and I’m a graphics engineer in Unity’s lighting team. As some of you already know, we have been working on a new dynamic global illumination feature for Unity called Surface Cache GI (SCGI). This is part of a larger effort to improve lighting quality in dynamic worlds where light baking may not be suitable.


Unity internal test content, indirect diffuse lighting contributed through Surface Cache GI in URP.

We already had several rounds of internal testing. While the feature is still not quite ready for release, it is reaching a level of maturity where it makes sense to invite everybody in the community to test it and to provide feedback. Our motivation for doing this is two-fold. First, we want your feedback on its design and how it works. Second, we hope we can collaborate to identify and squash as many bugs as possible before releasing in 6.7 LTS.

Getting Started

Below we show examples of what Surface Cache GI can do. If you are ready to jump in right away, head over to Unity Surface Cache GI - Getting Started to learn how to enable SCGI and start using it.

Please make sure to provide us with feedback about the feature either in this thread, or through Surface Cache GI - Product Experience Feedback.

New Capabilities

Surface Cache unlocks these new capabilities:

  1. Dynamic geometry: Indirect lighting that adapts when geometry changes. This includes situations like destructible or procedural worlds, adding/removing props and buildings (e.g. city builders), opening/closing doors, dynamic content loading (e.g. product configurators, archviz).

  2. Dynamic lighting: Indirect lighting that adapts when lights change. This includes situations like day/night cycles, turning lights on/off, torch and flash lights. With Enlighten and APV Lighting Scenarios, Unity already has some support for dynamic indirect lighting but these methods require a precomputation step and they only work with static geometry. Surface Cache GI lifts both limitations.

  3. Faster iteration: Without the need to rebake lighting it becomes much faster and more enjoyable to iterate on your game worlds and lighting environments. For optimal performance you may optionally switch to baked lighting for the final release of your game.

Design Goals

People use Unity in a lot of very different ways. No rendering technique is perfect for all cases so designing something like Surface Cache GI involves difficult compromises. In our design, we aimed for a balance between runtime performance and visual quality. We prioritized platform reach, performance, ease of use, and robustness over high-end graphical fidelity.

Next Steps

For more information about this feature, its limitations, how it compares to existing GI methods, and how to get started, please checkout Unity Surface Cache GI - Getting Started. We have poured our minds and hearts into Surface Cache GI and we hope you are as excited about it as we are. We look forward to hearing your feedback.

FAQ

Does Surface Cache require hardware ray-tracing?
No. Surface Cache is built on top of the UnifiedRayTracing library, and therefore it will use hardware raytracing when it is available and use a compute shader fallback when it is not.

Does Surface Cache work with Metal Ray Tracing or Vulkan Ray Tracing?
Surface Cache works with Metal and Vulkan but it cannot exploit hardware ray tracing on these APIs because Unity itself does not support this. Unity’s Ray Tracing team is currently investigating the feasibility of adding support for Metal Ray Tracing and Vulkan Ray Tracing. If support is added, Surface Cache will automatically benefit from this.

What papers/techniques are Surface Cache based on?
Surface Cache is heavily inspired by Frostbite’s GIBS, Kajiya renderer’s irradiance cache, and Nvidia’s SHARC. It is not a direct implementation of either of these. Instead, it takes aspects of each solution and combines them in a new way that is tailored for Unity’s users.

What about specular indirect lighting?
Surface Cache GI is diffuse-only, but you may combine it with Reflection Probes and/or the upcoming Screen Space Reflections (aka SSR).

58 Likes

For optimal performance you may optionally switch to baked lighting for the final release of your game

This phrase should be printed on every wall possible. I’m so tired about games using a realtime global illumination system when literally everything is static.

16 Likes

Really exiting news, can’t wait to get my hands on it.
IMO, GI is half the battle in terms of providing excellent lighting, so I’m curious if HDRP’s RTAO (or similar) will be coming to URP, as URP is now embracing RT tech thanks to the URT.

1 Like

first crash : ) it was scene with ~15million vertices. (cad models), used default GI settings.

D3D12Fence::Wait(132704) error: got 18446744073709551615. Device removal.
d3d12: Failed to process DXGI messages. Enable the debug layer!
d3d12: Device failed error (887a0006).
d3d12: Local memory usage exceeds budget by 167530496
d3d12: Local memory reservation exceeds reservation availability by 5445779456
d3d12: Local memory usage:
Budget: 8837644288
CurrentUsage: 9005174784
AvailableForReservation: 67108864
CurrentReservation: 5512888320
d3d12: GfxDevice was not out of Non-Local memory
d3d12: Non-Local memory usage:
Budget: 67742187520
CurrentUsage: 3702747136
AvailableForReservation: 0
CurrentReservation: 34005311488
d3d12: Unrecoverable GPU device error! Run with -force-d3d12-debug and see logs for more info.
Cannot use DisplayDialog because it was run from a thread that is not the main thread: Fatal Error! d3d12: Unrecoverable GPU device error! Run with -force-d3d12-debug and see logs for more info.

Crash!!!

Should we report bugs here or via the normal bug reporter tool of Unity?

There’s a big one where SCGI is either not able to identify mainTex or not able to reconstruct the material in areas lit by bounced GI:

This scene has no custom shader btw so it’s highly unlikely that it can’t get the default _mainTex.
As you can see here when SCGI is enabled these areas turn monochrome:


Edit: The issue might be irradiance:

Thank you so much Lighting Team! :high_voltage:

I’m eagerly waiting for this for my upcoming island-empire / city builder game! (full ECS) It will be a total game changer!

Will try it out asap and give you all the feedback I can provide!

Keep up the great work and take some time to celebrate, I will! :smiley:

4 Likes

Lovely! Now we just need a realtime reflection solution.

updating probes or using realtime probes is possible but for stuff like opening that door it’s gonna take a lot of doing to make it look natural.

I’m super glad to see this though!

This issue I think is reflection probes. If you don’t update reflection probes with this dynamic lighting you will run into problems like this.

Each room here needs a reflection probe to properly represent the lighting there.

Maybe SSR might help with occlusion I think? But it’s hard to say.

That looks odd indeed.

Here’s a few things to try:

  1. You could try to inspect this scene via Window > Analysis > Rendering Debugger > Lighting > Lighting Debug Mode = Global Illumination. This allows you to see raw irradiance (i.e. incoming light as opposed to outgoing which is the default).
  2. In Lighting > Environment you can try to switch to Color mode and then choose a weird color like green. Does that give you anything meaningful or do you still see “grey”? Surface Cache should react in realtime so you should be able to try a few things out this way. You could disable the sun to make it more clear.
  3. Ensure you have no baked lighting: In Lighting window you can click the dropdown array in the lower right and then Clear Baked Data. Surface Cache picks up lights which are not baked (which is not the same as lights which are marked as realtime).
  4. In attempt to simplify, you could try removing the directional light and then iteratively removing game object while ensuring the issue still happens. If you can reduce it down to a few objects lit by the environment light, then you could submit a bug report with the minimized project attached. That would allow us to take a look.
  5. For simplicity you could (temporarily) set Lighting Window > Environment > Environment Reflections > Intensity Multiplier to 0. This disables all specular reflection from the global ambient probe. Having this enabled can sometimes be confusing when debugging diffuse.
4 Likes

It’s not, I’ve seen the same issue when I made my own Ray Traced GI solution, you need to take texture properties from shaders and if a custom shader uses non conventional names like Tex instead of _mainTex you end up with monochrome GI, but that doesn’t seem to be the case here.

Is that so :thinking:

To me it just looks like the default GI/reflection probe getting in the way.

Also a question for @rasmusn while the light propagation is definitely fast for a tool like this i have seen faster. Would ray reconstruction help this in the future?

If you haven’t already you can reduce the lag by setting Temporal Smoothing = 0. This may increase temporal noise which you can solve increasing sample count (if you can afford this). We expect to be able to further reduce the general reaction time before the final release.

I assume you are referring to technologies like Nvidia DLSS and AMD FSR. Generally, no, this will not help here. These technologies assume a screen space input where each pixel holds “path tracing samples”. This is not what we do. We take “path tracing samples” per Surface Cache patch (to maintain a low ray count). That said, we expect to continue improving the current screen space noise artifacts in the coming months.

5 Likes

Yeah irradiance might be the problem, this is not how it’s supposed to look:


Also there’s no baked GI, SCGI works fine"ish" in a different scene on the same project so something scene related?

I can send the whole thing I don’t mind

In a different scene where SCGI works you can get disocclusion artifacts around thin objects in front of far objects, similar to SSR artifacting:


Edit: It’s not exclusive to thin objects, this seems by the design nature of SCGI being a bit like Screen Space GI?

It seems occlusion is kinda working (interios look dark). It is just the color that is off. I would check that Lighting > Environment has a proper environment light configuration but probably you already did that. For example, if you set it to Color and choose Red, then irradiance should become red. Note that this would work regardless of albedo color of the surface.

Thanks, but the simpler the better, actually :).

You can probably fix this by increasing Surface Cache Volume Override > Volume Configuration > Size. Similar to shadow mapping, we require you to define the volume in which you want SCGI to cover. Currently, I think your value is too low. Try bumping it.

If you enable Cell Index debugging mode you can see the patches move in realtime as you play with the settings in the volume override (admittedly, the debugging UX is not great currently but it does work).

1 Like

Only transparent materials respond, not opaque:

Hm, I was assuming it was some sort of denoising which RR might help but I guess not? But isn’t that what the temporal smoothing would do?

:thinking:

Maybe i’ll do some stress testing later, i’ve still been meaning to make a public “lighting test” map

Thanks for trying this. Perhaps you can send me a small project with a single building (or something like that) exhibiting this issue and I can take a look on my machine. That would be helpful.

1 Like

Sadly exporting just a few buildings to a new project removes the issue, I think it might be something with my project config so I have to send the whole thing, will a DM be fine?

1 Like

Even with Surface Cache GL, when I’m trying to achieve realism, URP feels like dropping GTA V assets into the GTA San Andreas engine. The lighting and materials completely ruin the high quality models. The materials especially look really poor. URP is technologically very, very far behind HDRP, and I’m starting to doubt whether you’ll be able to achieve even a remotely similar level of rendering quality in the coming years. Sad because I really like this engine, but this level of graphics is completely unsuitable for my future projects. HDRP looks very unique, and if it received a similar system, it would be a major competitor to UE5.

5 Likes