Skip to content

Commit

Permalink
Fix a system ordering issue with motion blur for skinned meshes. (#15693
Browse files Browse the repository at this point in the history
)

Currently, it's possible for the `collect_meshes_for_gpu_building`
system to run after `set_mesh_motion_vector_flags`. This will cause
those motion vector flags to be overwritten, which will cause the shader
to ignore the motion vectors for skinned meshes, which will cause
graphical artifacts.

This patch corrects the issue by forcing `set_mesh_motion_vector_flags`
to run after `collect_meshes_for_gpu_building`.
  • Loading branch information
pcwalton authored Oct 7, 2024
1 parent 8039f34 commit 0a1d60f
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions crates/bevy_pbr/src/render/mesh.rs
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ impl Plugin for MeshRenderPlugin {
.add_systems(
Render,
(
set_mesh_motion_vector_flags.before(RenderSet::Queue),
set_mesh_motion_vector_flags.in_set(RenderSet::PrepareAssets),
prepare_skins.in_set(RenderSet::PrepareResources),
prepare_morphs.in_set(RenderSet::PrepareResources),
prepare_mesh_bind_group.in_set(RenderSet::PrepareBindGroups),
Expand Down Expand Up @@ -208,7 +208,11 @@ impl Plugin for MeshRenderPlugin {
.after(prepare_view_targets),
collect_meshes_for_gpu_building
.in_set(RenderSet::PrepareAssets)
.after(allocator::allocate_and_free_meshes),
.after(allocator::allocate_and_free_meshes)
// This must be before
// `set_mesh_motion_vector_flags` so it doesn't
// overwrite those flags.
.before(set_mesh_motion_vector_flags),
),
);
} else {
Expand Down

0 comments on commit 0a1d60f

Please sign in to comment.