-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Solari: Light leak reduction and stochastic WC update #22348
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
base: main
Are you sure you want to change the base?
Conversation
| // Path spread is wide enough, terminate path in the world cache | ||
| let diffuse_brdf = ray_hit.material.base_color / PI; | ||
| radiance += throughput * diffuse_brdf * query_world_cache(ray_hit.world_position, ray_hit.geometric_world_normal, view.world_position, WORLD_CACHE_CELL_LIFETIME, rng); | ||
| radiance += throughput * diffuse_brdf * query_world_cache(ray_hit.world_position, ray_hit.geometric_world_normal, view.world_position, ray.t, WORLD_CACHE_CELL_LIFETIME, rng); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would this be ok if it were only done for the first trace? Or do all the bounces need to care about light leaks?
|
|
||
| if rand_f(&rng) >= f32(WORLD_CACHE_TARGET_CELL_UPDATES) / f32(world_cache_active_cells_count) { return; } | ||
|
|
||
| let ray_direction = sample_cosine_hemisphere(geometry_data.world_normal, &rng); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing the #ifndef NO_MULTIBOUNCE
| new_radiance += ray_hit.material.base_color * query_world_cache(ray_hit.world_position, ray_hit.geometric_world_normal, view.world_position, ray.t, cell_life, &rng); | ||
| } | ||
|
|
||
| world_cache_active_cells_new_radiance[active_cell_id.x] = new_radiance; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can probably just be a += here instead of having to load early and then store (might improve register pressure?)
Objective
Solution
To prevent light leaks:
Since this then greatly increases the number of cache cells in the scene, I changed the following to prevent too much of a decrease in performance (this PR is still a hit to performance though):
Also some misc changes:
Ideally the skipped cells wouldn't be totally random, and we'd have coarser-LOD cells update less frequently, but that would get very complicated as we'd have to track the total amount of cells per LOD in order to average out to
WORLD_CACHE_TARGET_CELL_UPDATES.