bevy/crates/bevy_pbr/src
Greeble 5da64ddbee
Fix motion blur on skinned meshes (#18712)
## Objective

Fix motion blur not working on skinned meshes.

## Solution

`set_mesh_motion_vector_flags` can set
`RenderMeshInstanceFlags::HAS_PREVIOUS_SKIN` after specialization has
already cached the material. This can lead to
`MeshPipelineKey::HAS_PREVIOUS_SKIN` never getting set, disabling motion
blur.

The fix is to make sure `set_mesh_motion_vector_flags` happens before
specialization.

Note that the bug is fixed in a different way by #18074, which includes
other fixes but is a much larger change.

## Testing

Open the `animated_mesh` example and add these components to the
`Camera3d` entity:

```rust
MotionBlur {
    shutter_angle: 5.0,
    samples: 2,
    #[cfg(all(feature = "webgl2", target_arch = "wasm32", not(feature = "webgpu")))]
    _webgl2_padding: Default::default(),
},
#[cfg(all(feature = "webgl2", target_arch = "wasm32", not(feature = "webgpu")))]
Msaa::Off,
```

Tested on `animated_mesh`, `many_foxes`, `custom_skinned_mesh`,
Win10/Nvidia with Vulkan, WebGL/Chrome, WebGPU/Chrome. Note that testing
`many_foxes` WebGL requires #18715.
2025-04-04 22:36:03 +00:00
..
atmosphere Bump crate-ci/typos from 1.30.2 to 1.31.0 (#18656) 2025-04-02 10:59:15 +00:00
cluster reexport entity set collections in entity module (#18413) 2025-03-30 03:51:14 +00:00
decal reexport entity set collections in entity module (#18413) 2025-03-30 03:51:14 +00:00
deferred Add required shader defs for environment map binding arrays in deferred (#18634) 2025-03-31 18:07:54 +00:00
light reexport entity set collections in entity module (#18413) 2025-03-30 03:51:14 +00:00
light_probe bevy_reflect: Add clone registrations project-wide (#18307) 2025-03-17 18:32:35 +00:00
lightmap bevy_reflect: Add clone registrations project-wide (#18307) 2025-03-17 18:32:35 +00:00
meshlet Fix mesh extraction for meshes without associated material. (#18631) 2025-03-31 18:09:27 +00:00
prepass Fix motion blur on skinned meshes (#18712) 2025-04-04 22:36:03 +00:00
render Fix motion blur on skinned meshes (#18712) 2025-04-04 22:36:03 +00:00
ssao Add bevy_anti_aliasing (#18323) 2025-03-19 18:40:32 +00:00
ssr bevy_reflect: Add clone registrations project-wide (#18307) 2025-03-17 18:32:35 +00:00
volumetric_fog bevy_reflect: Add clone registrations project-wide (#18307) 2025-03-17 18:32:35 +00:00
components.rs reexport entity set collections in entity module (#18413) 2025-03-30 03:51:14 +00:00
extended_material.rs bevy_reflect: Add clone registrations project-wide (#18307) 2025-03-17 18:32:35 +00:00
fog.rs bevy_reflect: Add clone registrations project-wide (#18307) 2025-03-17 18:32:35 +00:00
lib.rs Add missing system ordering constraint to prepare_lights (#18308) 2025-03-15 22:57:52 +00:00
material_bind_groups.rs bevy_reflect: Add clone registrations project-wide (#18307) 2025-03-17 18:32:35 +00:00
material.rs Fix motion blur on skinned meshes (#18712) 2025-04-04 22:36:03 +00:00
mesh_material.rs bevy_reflect: Add clone registrations project-wide (#18307) 2025-03-17 18:32:35 +00:00
parallax.rs bevy_reflect: Add clone registrations project-wide (#18307) 2025-03-17 18:32:35 +00:00
pbr_material.rs Make bindings behind pbr_specular_textures flag consistent with other gated fields (#18645) 2025-03-31 18:49:12 +00:00
wireframe.rs bevy_reflect: Add clone registrations project-wide (#18307) 2025-03-17 18:32:35 +00:00