Fix motion blur on skinned meshes #18712
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Objective
Fix motion blur not working on skinned meshes.
Solution
set_mesh_motion_vector_flags
can setRenderMeshInstanceFlags::HAS_PREVIOUS_SKIN
after specialization has already cached the material. This can lead toMeshPipelineKey::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 theCamera3d
entity:Tested on
animated_mesh
,many_foxes
,custom_skinned_mesh
, Win10/Nvidia with Vulkan, WebGL/Chrome, WebGPU/Chrome. Note that testingmany_foxes
WebGL requires #18715.