-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Solari: Dynamic realtime global illumination #10000
Conversation
This reverts commit cdf0271.
@JMS55 What happened? Did it just get too far behind or something? |
A couple of things:
I am really looking forward to coming back to this in the future, but wgpu needs to support raytracing first. Realtime RT-GI is super cool, and since I started this project there's been even more exciting papers, but I don't have the time or motivation to keep trying to patch wgpu and bevy. If anyone would like to see this work continue, please contribute raytracing support to wgpu along with the tests it needs to get merged. |
WARNING: Highly experimental, will not be merged anytime soon.
Here's a pretty image so the PR isn't entirely text, but keep in mind there's still a lot of work needed to get this to a generally usable and artifact/bug-free state.
Overview
Solari is an implementation of fully dynamic, fully realtime raytraced global illumination. All lights and objects can move and mutate, contribute indirect lighting (including emissive meshes), and receive indirect light bounces. It's comparable in scope to Unreal Engine 5's Lumen (Fortnite, Lumen in the Land of Nanite), or Nvidia's RTXGI (Cyberpunk 2077).
This is a high end GPU-intensive rendering technique. All testing was done on an RTX 3080 GPU, at both 1080p and 4k, with an initial target budget of around 4ms of GPU time (ideally we can get this down to ~2ms with further optimizations). As it relies on hardware raytracing support, it only works on GPUs such as Nvidia's RTX 2000 series+, and AMD's RX 6000 series+. Currently, this PR is using an experimental fork of wgpu that implements hardware raytracing on the Vulkan backend only. Metal and DirectX12 are not currently supported.
Note that Solari only (currently) does indirect diffuse lighting. Indirect specular lighting (reflections) will come later, and raytraced direct diffuse and specular lighting much later as part of a separate sub-plugin of Solari, likely using a different technique.
Current Technique
The following is a simple high-level overview of Solari's current rendering, as details are extremely subject to change and I don't want to have to rewrite this frequently. A detailed breakdown will probably come once everything is actually finished. See the literature section of this PR description for links to each of the techniques.
Like Lumen and specifically GI-1.0, Solari uses a multi-level radiance/irradiance cache. The high level process is as follows:
The final path is as such: camera -> visible point on screen (probe placed) -> a different point in the world (world cache queried) -> light sources. GI-1.0 has a great illustration of this:
A more detailed, technical breakdown is as follows:
TODOs
See
crates/bevy_pbr/src/solari/todo.txt
.Expect lots of bugs, ghosting, light leaks, quality issues, etc. Especially in non-toy scenes. Anything in
bevy_pbr::solari::scene
should be treated as temporary, and only written in order to let me work on the actual shader techniques.This is a draft PR, and will likely remain that way for a long while. I've been working on this basically solo for months already, and expect to continue doing so for many more months. That said, I'm putting this out there in the hopes of raising additional help developing Solari. If you're interested in helping with the development, please reach out on the rendering-dev channel in Bevy's discord!
Blockers
All of these are currently worked around either in Bevy (along with other hacks), or hacked around in forked dependencies.
Other missing nice-to-haves for better performance:
Literature
Thanks
Finally, I'd like to thank Alexander Sannikov for his help understanding and implementing his radiance cascades technique, @daniel-keitel for their work implementing raytracing support in wgpu, and countless others in the Bevy discord, wgpu/naga communities, and other graphics forums that have given me advice on this project. Far too many people to name individually :)