Skip to content

Commit 444c795

Browse files
authored
Solari: Fix world cache update using last frame's light tiles due to incorrect pass ordering (#21348)
Light tiles used to be generated _after_ the world cache update, despite the world cache update relying on them. This means that the world cache update used last frame's light tiles, which is fine for static lights, but completely wrong for dynamic lights and lead to missing GI contributions from dynamic lights. Moving the presample light tile step to before the world cache update fixes this. Can be tested by running the solari example, turning off the directional light so there's only the emissive robot light, enabling VISUALIZE_WORLD_CACHE, and then comparing before/after this PR.
1 parent 3f08ae4 commit 444c795

File tree

1 file changed

+7
-7
lines changed
  • crates/bevy_solari/src/realtime

1 file changed

+7
-7
lines changed

crates/bevy_solari/src/realtime/node.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,13 @@ impl ViewNode for SolariLightingNode {
251251
pass.dispatch_workgroups(dx, dy, 1);
252252
}
253253

254+
pass.set_pipeline(presample_light_tiles_pipeline);
255+
pass.set_push_constants(
256+
0,
257+
bytemuck::cast_slice(&[frame_index, solari_lighting.reset as u32]),
258+
);
259+
pass.dispatch_workgroups(LIGHT_TILE_BLOCKS as u32, 1, 1);
260+
254261
pass.set_bind_group(2, &bind_group_world_cache_active_cells_dispatch, &[]);
255262

256263
pass.set_pipeline(decay_world_cache_pipeline);
@@ -283,13 +290,6 @@ impl ViewNode for SolariLightingNode {
283290
0,
284291
);
285292

286-
pass.set_pipeline(presample_light_tiles_pipeline);
287-
pass.set_push_constants(
288-
0,
289-
bytemuck::cast_slice(&[frame_index, solari_lighting.reset as u32]),
290-
);
291-
pass.dispatch_workgroups(LIGHT_TILE_BLOCKS as u32, 1, 1);
292-
293293
pass.set_pipeline(di_initial_and_temporal_pipeline);
294294
pass.set_push_constants(
295295
0,

0 commit comments

Comments
 (0)