Skip to content

Solari radiance cache #20406

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

Merged
merged 35 commits into from
Aug 9, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
18816cf
Clamp jacobian to reduce bright spots
JMS55 Jul 23, 2025
b8438be
Release notes
JMS55 Jul 23, 2025
a83c266
Fmt
JMS55 Jul 23, 2025
8f16815
Go back to rejecting jacobian, but with a smaller threshold
JMS55 Jul 23, 2025
ff81d9b
Fix error message
JMS55 Jul 23, 2025
0e6dc5d
Merge commit '4b1b70d5011cfac9fd5be3aab76ee4b01300c863' into solari6-…
JMS55 Jul 24, 2025
9be8ac4
Balance heuristic for spatial GI resampling
JMS55 Jul 25, 2025
36aa061
Merge branch 'main' into solari6-clamp-jacobian
JMS55 Jul 25, 2025
695e520
Revert neighbor bias
JMS55 Jul 25, 2025
127ba04
WIP radiance cache port
JMS55 Jul 27, 2025
c74b472
More WIP
JMS55 Jul 27, 2025
2922c71
Fixes
JMS55 Jul 28, 2025
24a949b
More fixes
JMS55 Jul 28, 2025
838f01d
Add multibounce
JMS55 Jul 29, 2025
02f38b0
Misc
JMS55 Jul 29, 2025
b40897f
Improved spatial hashing (LOD is a bit WIP, takes a second to converg…
JMS55 Jul 31, 2025
3371f3f
Use geometric world normal for querying the cache
JMS55 Jul 31, 2025
af6cdf5
Add todo
JMS55 Jul 31, 2025
f95abe8
Misc
JMS55 Jul 31, 2025
9fbaf9b
Adaptive world cache blend rate
JMS55 Jul 31, 2025
be4762f
Misc
JMS55 Jul 31, 2025
8eb8fa3
Merge commit '0751cf4a6008e1ddd6c6389d012759658f504b0b' into solari6-…
JMS55 Aug 1, 2025
f54cc56
Merge commit '647b071796faef4403d2b568b13a5302be499883' into solari6-…
JMS55 Aug 4, 2025
e72bc41
Add TODO
JMS55 Aug 4, 2025
ea58077
Update release notes
JMS55 Aug 4, 2025
e499545
Add TODO
JMS55 Aug 4, 2025
15e24e5
Initial RIS for world cache
JMS55 Aug 4, 2025
023fca4
Use light tiles for world cache RIS
JMS55 Aug 4, 2025
815376a
Merge commit '023fca4dc2749fc7665c75f481cf1a50c7803d0c' into solari6-…
JMS55 Aug 4, 2025
dc6f57f
Merge branch 'main' into solari6-radiance-cache
JMS55 Aug 4, 2025
55c4f1d
Merge commit 'b378e0ad9701ac1ad98763ee6106bba164e20907' into solari6-…
JMS55 Aug 4, 2025
a7ae313
Formatting
JMS55 Aug 5, 2025
d7dce09
Fix naga_oil error
JMS55 Aug 5, 2025
46b19ee
Merge branch 'main' into solari6-radiance-cache
JMS55 Aug 5, 2025
deae9da
Merge branch 'main' into solari6-radiance-cache
JMS55 Aug 9, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions crates/bevy_pbr/src/render/utils.wgsl
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,10 @@ fn sample_uniform_hemisphere(normal: vec3<f32>, rng: ptr<function, u32>) -> vec3
return orthonormalize(normal) * vec3(x, y, z);
}

fn uniform_hemisphere_inverse_pdf() -> f32 {
return PI_2;
}

// https://www.realtimerendering.com/raytracinggems/unofficial_RayTracingGems_v1.9.pdf#0004286901.INDD%3ASec19%3A294
fn sample_disk(disk_radius: f32, rng: ptr<function, u32>) -> vec2<f32> {
let ab = 2.0 * rand_vec2f(rng) - 1.0;
Expand All @@ -141,7 +145,7 @@ fn sample_disk(disk_radius: f32, rng: ptr<function, u32>) -> vec2<f32> {
fn sample_cube_dir(uv: vec2f, face: u32) -> vec3f {
// Convert from [0,1] to [-1,1]
let uvc = 2.0 * uv - 1.0;

// Generate direction based on the cube face
var dir: vec3f;
switch(face) {
Expand All @@ -165,7 +169,7 @@ fn dir_to_cube_uv(dir: vec3f) -> CubeUV {
let abs_dir = abs(dir);
var face: u32 = 0u;
var uv: vec2f = vec2f(0.0);

// Find the dominant axis to determine face
if (abs_dir.x >= abs_dir.y && abs_dir.x >= abs_dir.z) {
// X axis is dominant
Expand Down Expand Up @@ -195,7 +199,7 @@ fn dir_to_cube_uv(dir: vec3f) -> CubeUV {
uv = vec2f(-dir.x, -dir.y) / abs_dir.z;
}
}

// Convert from [-1,1] to [0,1]
return CubeUV(uv * 0.5 + 0.5, face);
}
6 changes: 5 additions & 1 deletion crates/bevy_solari/src/realtime/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ use bevy_ecs::{component::Component, reflect::ReflectComponent, schedule::IntoSc
use bevy_pbr::DefaultOpaqueRendererMethod;
use bevy_reflect::{std_traits::ReflectDefault, Reflect};
use bevy_render::{
load_shader_library,
render_graph::{RenderGraphExt, ViewNodeRunner},
renderer::RenderDevice,
view::Hdr,
Expand All @@ -31,9 +32,12 @@ pub struct SolariLightingPlugin;

impl Plugin for SolariLightingPlugin {
fn build(&self, app: &mut App) {
embedded_asset!(app, "presample_light_tiles.wgsl");
load_shader_library!(app, "presample_light_tiles.wgsl");
embedded_asset!(app, "restir_di.wgsl");
embedded_asset!(app, "restir_gi.wgsl");
load_shader_library!(app, "world_cache_query.wgsl");
embedded_asset!(app, "world_cache_compact.wgsl");
embedded_asset!(app, "world_cache_update.wgsl");

app.insert_resource(DefaultOpaqueRendererMethod::deferred());
}
Expand Down
Loading
Loading