bevy/crates
Patrick Walton b7bcd313ca
Cluster light probes using conservative spherical bounds. (#13746)
This commit allows the Bevy renderer to use the clustering
infrastructure for light probes (reflection probes and irradiance
volumes) on platforms where at least 3 storage buffers are available. On
such platforms (the vast majority), we stop performing brute-force
searches of light probes for each fragment and instead only search the
light probes with bounding spheres that intersect the current cluster.
This should dramatically improve scalability of irradiance volumes and
reflection probes.

The primary platform that doesn't support 3 storage buffers is WebGL 2,
and we continue using a brute-force search of light probes on that
platform, as the UBO that stores per-cluster indices is too small to fit
the light probe counts. Note, however, that that platform also doesn't
support bindless textures (indeed, it would be very odd for a platform
to support bindless textures but not SSBOs), so we only support one of
each type of light probe per drawcall there in the first place.
Consequently, this isn't a performance problem, as the search will only
have one light probe to consider. (In fact, clustering would probably
end up being a performance loss.)

Known potential improvements include:

1. We currently cull based on a conservative bounding sphere test and
not based on the oriented bounding box (OBB) of the light probe. This is
improvable, but in the interests of simplicity, I opted to keep the
bounding sphere test for now. The OBB improvement can be a follow-up.

2. This patch doesn't change the fact that each fragment only takes a
single light probe into account. Typical light probe implementations
detect the case in which multiple light probes cover the current
fragment and perform some sort of weighted blend between them. As the
light probe fetch function presently returns only a single light probe,
implementing that feature would require more code restructuring, so I
left it out for now. It can be added as a follow-up.

3. Light probe implementations typically have a falloff range. Although
this is a wanted feature in Bevy, this particular commit also doesn't
implement that feature, as it's out of scope.

4. This commit doesn't raise the maximum number of light probes past its
current value of 8 for each type. This should be addressed later, but
would possibly require more bindings on platforms with storage buffers,
which would increase this patch's complexity. Even without raising the
limit, this patch should constitute a significant performance
improvement for scenes that get anywhere close to this limit. In the
interest of keeping this patch small, I opted to leave raising the limit
to a follow-up.

## Changelog

### Changed

* Light probes (reflection probes and irradiance volumes) are now
clustered on most platforms, improving performance when many light
probes are present.

---------

Co-authored-by: Benjamin Brienen <Benjamin.Brienen@outlook.com>
Co-authored-by: Alice Cecile <alice.i.cecile@gmail.com>
2024-12-05 13:07:10 +00:00
..
bevy_a11y Remove accesskit re-export from bevy_a11y (#16257) 2024-11-08 21:01:16 +00:00
bevy_animation Fix newline in AnimationEvaluationState docs (#16542) 2024-11-28 17:13:21 +00:00
bevy_app Move all_tuples to a new crate (#16161) 2024-12-03 17:41:09 +00:00
bevy_asset Support creating asset directories (#16220) 2024-11-04 22:06:00 +00:00
bevy_audio Update rodio requirement from 0.19 to 0.20 (#16359) 2024-12-03 17:55:42 +00:00
bevy_color Fix MSRVs for standalone crates (#16333) 2024-11-17 09:38:13 +00:00
bevy_core Support on_thread_spawn and on_thread_destroy for TaskPoolPlugin (#13045) 2024-11-11 20:00:01 +00:00
bevy_core_pipeline Move required components doc to type doc (#16575) 2024-12-03 19:45:20 +00:00
bevy_derive move ANDROID_APP to bevy_window (#15585) 2024-10-02 03:01:06 +00:00
bevy_dev_tools Retained Gizmos (#15473) 2024-12-04 21:21:06 +00:00
bevy_diagnostic Revert "Update sysinfo version to 0.32.1 (#16517)" (#16523) 2024-11-26 22:44:23 +00:00
bevy_dylib Generate links to definition in source code pages on docs.rs and dev-docs.bevyengine.org (#12965) 2024-07-29 23:10:16 +00:00
bevy_ecs Remove petgraph from bevy_ecs (#15519) 2024-12-03 20:01:55 +00:00
bevy_encase_derive Update `glam to 0.29, encase` to 0.10. (#15249) 2024-09-23 19:44:02 +00:00
bevy_gilrs Use Name component for gamepad (#16233) 2024-11-05 00:30:48 +00:00
bevy_gizmos Retained Gizmos (#15473) 2024-12-04 21:21:06 +00:00
bevy_gltf Make bevy_gltf compile without bevy_animation feature (#16551) 2024-11-30 00:04:30 +00:00
bevy_hierarchy Entity cloning (#16132) 2024-12-03 17:38:10 +00:00
bevy_image switch bevy_image to use wgpu-types wherever possible instead of wgpu (#16620) 2024-12-03 11:46:10 +00:00
bevy_input Move required components doc to type doc (#16575) 2024-12-03 19:45:20 +00:00
bevy_internal Fix the picking backend features not actually disabling the features (#16470) 2024-11-22 18:14:16 +00:00
bevy_log Use en-us locale for typos (#16037) 2024-10-20 18:55:17 +00:00
bevy_macro_utils Modify derive_label to support no_std environments (#15465) 2024-09-27 20:23:26 +00:00
bevy_math Use IntoIterator instead of Into<Vec<..>> in cubic splines interfaces (#16402) 2024-12-03 19:35:14 +00:00
bevy_mesh switch bevy_mesh to use wgpu-types instead of wgpu (#16619) 2024-12-03 19:49:49 +00:00
bevy_mikktspace Use en-us locale for typos (#16037) 2024-10-20 18:55:17 +00:00
bevy_pbr Cluster light probes using conservative spherical bounds. (#13746) 2024-12-05 13:07:10 +00:00
bevy_picking Fix the picking backend features not actually disabling the features (#16470) 2024-11-22 18:14:16 +00:00
bevy_ptr Fix MSRVs for standalone crates (#16333) 2024-11-17 09:38:13 +00:00
bevy_reflect Move all_tuples to a new crate (#16161) 2024-12-03 17:41:09 +00:00
bevy_remote BrpQueryRow has field deserialization fix (#16613) 2024-12-04 18:26:33 +00:00
bevy_render Move required components doc to type doc (#16575) 2024-12-03 19:45:20 +00:00
bevy_scene Move required components doc to type doc (#16575) 2024-12-03 19:45:20 +00:00
bevy_sprite Move required components doc to type doc (#16575) 2024-12-03 19:45:20 +00:00
bevy_state Make StateTransitionSteps public (#16612) 2024-12-03 19:48:00 +00:00
bevy_tasks Support on_thread_spawn and on_thread_destroy for TaskPoolPlugin (#13045) 2024-11-11 20:00:01 +00:00
bevy_text Add missing registration for TextEntity (#16649) 2024-12-04 18:16:48 +00:00
bevy_time Use en-us locale for typos (#16037) 2024-10-20 18:55:17 +00:00
bevy_transform Move required components doc to type doc (#16575) 2024-12-03 19:45:20 +00:00
bevy_ui Move required components doc to type doc (#16575) 2024-12-03 19:45:20 +00:00
bevy_utils Move all_tuples to a new crate (#16161) 2024-12-03 17:41:09 +00:00
bevy_window Support prefers_home_indicator_hidden (#16005) 2024-10-31 16:09:30 +00:00
bevy_winit bevy_winit(emit raw winit events) (#15884) 2024-12-03 17:20:43 +00:00