Skip to content

Commit b257cc2

Browse files
authored
Solari: Make light tiles properly random (#24670)
# Objective - Due to reusing the same constant in presample_light_tiles RNG as I used in the frame_index RNG, the light tiles were not properly random. Tile N+1 on frame X+1 would use the same pool of light as tile N on frame X - it was just "scrolling" each frame. ## Solution - Use a different constant to properly randomize the pool
1 parent 82404b6 commit b257cc2

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

crates/bevy_solari/src/realtime/presample_light_tiles.wgsl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ enable wgpu_ray_query;
1313
@compute @workgroup_size(1024, 1, 1)
1414
fn presample_light_tiles(@builtin(workgroup_id) workgroup_id: vec3<u32>, @builtin(local_invocation_index) sample_index: u32) {
1515
let tile_id = workgroup_id.x;
16-
var rng = (tile_id * 5782582u) + sample_index + constants.frame_index;
16+
var rng = (tile_id * 0x9E3779B9u) + sample_index + constants.frame_index;
1717

1818
let sample = generate_random_light_sample(&rng);
1919

0 commit comments

Comments
 (0)