Skip to content

Commit 6a3120f

Browse files
JMS55mockersf
authored andcommitted
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 bbf2c05 commit 6a3120f

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
@@ -238,6 +238,13 @@ impl ViewNode for SolariLightingNode {
238238
pass.dispatch_workgroups(dx, dy, 1);
239239
}
240240

241+
pass.set_pipeline(presample_light_tiles_pipeline);
242+
pass.set_push_constants(
243+
0,
244+
bytemuck::cast_slice(&[frame_index, solari_lighting.reset as u32]),
245+
);
246+
pass.dispatch_workgroups(LIGHT_TILE_BLOCKS as u32, 1, 1);
247+
241248
pass.set_bind_group(2, &bind_group_world_cache_active_cells_dispatch, &[]);
242249

243250
pass.set_pipeline(decay_world_cache_pipeline);
@@ -270,13 +277,6 @@ impl ViewNode for SolariLightingNode {
270277
0,
271278
);
272279

273-
pass.set_pipeline(presample_light_tiles_pipeline);
274-
pass.set_push_constants(
275-
0,
276-
bytemuck::cast_slice(&[frame_index, solari_lighting.reset as u32]),
277-
);
278-
pass.dispatch_workgroups(LIGHT_TILE_BLOCKS as u32, 1, 1);
279-
280280
pass.set_pipeline(di_initial_and_temporal_pipeline);
281281
pass.set_push_constants(
282282
0,

0 commit comments

Comments
 (0)