bevy/crates
Arseny Kapoulkine cc1764772e
Improve MeshletMesh::from_mesh performance (#13904)
This change reworks `find_connected_meshlets` to scale more linearly
with the mesh size, which significantly reduces the cost of building
meshlet representations. As a small extra complexity reduction, it moves
`simplify_scale` call out of the loop so that it's called once (it only
depends on the vertex data => is safe to cache).

The new implementation of connectivity analysis builds edge=>meshlet
list data structure, which allows us to only iterate through
`tuple_combinations` of a (usually) small list. There is still some
redundancy as if two meshlets share two edges, they will be represented
in the meshlet lists twice, but it's overall much faster.

Since the hash traversal is non-deterministic, to keep this part of the
algorithm deterministic for reproducible results we sort the output
adjacency lists.

Overall this reduces the time to process bunny mesh from ~4.2s to ~1.7s
when using release; in unoptimized builds the delta is even more
significant.

This was tested by using https://github.com/bevyengine/bevy/pull/13431
and:

a) comparing the result of `find_connected_meshlets` using old and new
code; they are equal in all steps of the clustering process
b) comparing the rendered result of the old code vs new code *after*
making the rest of the algorithm deterministic: right now the loop that
iterates through the result of `group_meshlets()` call executes in
different order between program runs. This is orthogonal to this change
and can be fixed separately.

Note: a future change can shrink the processing time further from ~1.7s
to ~0.4s with a small diff but that requires an update to meshopt crate
which is pending in https://github.com/gwihlidal/meshopt-rs/pull/42.
This change is independent.
2024-06-27 07:05:24 +02:00
..
bevy_a11y Release Candidate 0.14.0-rc.3 2024-06-16 17:50:19 +02:00
bevy_animation Release Candidate 0.14.0-rc.3 2024-06-16 17:50:19 +02:00
bevy_app feat(bevy_app): expose an API to perform updates for a specific sub-app. (#14009) 2024-06-26 00:13:24 +02:00
bevy_asset Release Candidate 0.14.0-rc.3 2024-06-16 17:50:19 +02:00
bevy_audio Release Candidate 0.14.0-rc.3 2024-06-16 17:50:19 +02:00
bevy_color Release Candidate 0.14.0-rc.3 2024-06-16 17:50:19 +02:00
bevy_core Release Candidate 0.14.0-rc.3 2024-06-16 17:50:19 +02:00
bevy_core_pipeline don't crash without features bevy_pbr, ktx2, zstd (#14020) 2024-06-26 21:55:00 +02:00
bevy_derive Release Candidate 0.14.0-rc.3 2024-06-16 17:50:19 +02:00
bevy_dev_tools Release Candidate 0.14.0-rc.3 2024-06-16 17:50:19 +02:00
bevy_diagnostic Release Candidate 0.14.0-rc.3 2024-06-16 17:50:19 +02:00
bevy_dylib Release Candidate 0.14.0-rc.3 2024-06-16 17:50:19 +02:00
bevy_dynamic_plugin Release Candidate 0.14.0-rc.3 2024-06-16 17:50:19 +02:00
bevy_ecs Emit a warning if the result of EntityCommand::with_entity is not used (#14028) 2024-06-26 21:56:23 +02:00
bevy_encase_derive Release Candidate 0.14.0-rc.3 2024-06-16 17:50:19 +02:00
bevy_gilrs Release Candidate 0.14.0-rc.3 2024-06-16 17:50:19 +02:00
bevy_gizmos Release Candidate 0.14.0-rc.3 2024-06-16 17:50:19 +02:00
bevy_gltf Release Candidate 0.14.0-rc.3 2024-06-16 17:50:19 +02:00
bevy_hierarchy Release Candidate 0.14.0-rc.3 2024-06-16 17:50:19 +02:00
bevy_input Release Candidate 0.14.0-rc.3 2024-06-16 17:50:19 +02:00
bevy_internal don't crash without features bevy_pbr, ktx2, zstd (#14020) 2024-06-26 21:55:00 +02:00
bevy_log Release Candidate 0.14.0-rc.3 2024-06-16 17:50:19 +02:00
bevy_macro_utils Release Candidate 0.14.0-rc.3 2024-06-16 17:50:19 +02:00
bevy_math Release Candidate 0.14.0-rc.3 2024-06-16 17:50:19 +02:00
bevy_mikktspace Release Candidate 0.14.0-rc.3 2024-06-16 17:50:19 +02:00
bevy_pbr Improve MeshletMesh::from_mesh performance (#13904) 2024-06-27 07:05:24 +02:00
bevy_ptr Release Candidate 0.14.0-rc.3 2024-06-16 17:50:19 +02:00
bevy_reflect Release Candidate 0.14.0-rc.3 2024-06-16 17:50:19 +02:00
bevy_render Fix typo in CPU adapter warning (#14037) 2024-06-26 21:56:23 +02:00
bevy_scene Release Candidate 0.14.0-rc.3 2024-06-16 17:50:19 +02:00
bevy_sprite bug: Fix 9-slice textures with asymmetric borders. (#13921) 2024-06-21 19:36:48 +02:00
bevy_state Move StateTransitionSteps registration to states plugin (#13939) 2024-06-21 19:36:48 +02:00
bevy_tasks Release Candidate 0.14.0-rc.3 2024-06-16 17:50:19 +02:00
bevy_text Release Candidate 0.14.0-rc.3 2024-06-16 17:50:19 +02:00
bevy_time Make time_system public (#13879) 2024-06-19 04:14:58 +02:00
bevy_transform Release Candidate 0.14.0-rc.3 2024-06-16 17:50:19 +02:00
bevy_ui Make default behavior for BackgroundColor and BorderColor more intuitive (#14017) 2024-06-26 00:16:30 +02:00
bevy_utils Release Candidate 0.14.0-rc.3 2024-06-16 17:50:19 +02:00
bevy_window apply window scale to window size when creating it (#13967) 2024-06-21 20:27:55 +02:00
bevy_winit Have WindowPosition::Centered take scale_factor_override into account (#13949) 2024-06-26 21:57:12 +02:00