stride3d / stride

Stride (formerly Xenko), a free and open-source cross-platform C# game engine.
https://stride3d.net
MIT License
6.6k stars 952 forks source link

Dynamic diffuse global illumination with light probes DDGI #1271

Open ykafia opened 2 years ago

ykafia commented 2 years ago

According to this blog post, we can repurpose the current light probes system to be dynamic, work in real time and at little expense.

We already have some shaders, probes generators and a probe rendering system to handle it.

Fydar commented 4 months ago

Interesting. I'm not a graphics programmer, but I am very interested in the subject.

Correct me if I'm wrong, but it looks like it's GI using light probes; but those light probes cast rays to their surrounding environment randomly every frame which slowly influences the value contained in that probe. Those light probes maintain a history of all of the raycast results in a structure like a ring buffer.

There also seems to be an algorithm for adjusting the position of those light probes (in some cases, SDFs, in other cases voxel queries) and another algorithm for masking light probes that that shouldn't effect certain probes to prevent light leaking.

image

I found a source that uses SDFs to adjust probe positions here.

ykafia commented 4 months ago

That's how I understood it yeah!

Although it needs hardware raytracing contrary to what I tought back when I created the issue.

Fydar commented 4 months ago

According to one SDFDDGI paper:

'Inspired by RTXGI, we propose SDFDDGI (Signed-Distance-Field Dynamic Diffuse Global Illumination). Compared to RTXGI, our approach doesn’t need the use of specific hardware, made improvements in its performance and result, increased dynamic response speed and completely solved light leaking problems.' - Signed Distance Fields Dynamic Diffuse Global Illumination

Likely the method could be optimized further using raytracing hardware; but this implementation queries the environment using a software implementation of "ray tracing" which queries SDF clusters and performs geometry intersection tests, which then sample the scene lighting (RSMs) and the light probes from the last generation of lighting.