bevy/crates
Aevyrie ade70b3925
Per-Object Motion Blur (#9924)
https://github.com/bevyengine/bevy/assets/2632925/e046205e-3317-47c3-9959-fc94c529f7e0

# Objective

- Adds per-object motion blur to the core 3d pipeline. This is a common
effect used in games and other simulations.
- Partially resolves #4710

## Solution

- This is a post-process effect that uses the depth and motion vector
buffers to estimate per-object motion blur. The implementation is
combined from knowledge from multiple papers and articles. The approach
itself, and the shader are quite simple. Most of the effort was in
wiring up the bevy rendering plumbing, and properly specializing for HDR
and MSAA.
- To work with MSAA, the MULTISAMPLED_SHADING wgpu capability is
required. I've extracted this code from #9000. This is because the
prepass buffers are multisampled, and require accessing with
`textureLoad` as opposed to the widely compatible `textureSample`.
- Added an example to demonstrate the effect of motion blur parameters.

## Future Improvements

- While this approach does have limitations, it's one of the most
commonly used, and is much better than camera motion blur, which does
not consider object velocity. For example, this implementation allows a
dolly to track an object, and that object will remain unblurred while
the background is blurred. The biggest issue with this implementation is
that blur is constrained to the boundaries of objects which results in
hard edges. There are solutions to this by either dilating the object or
the motion vector buffer, or by taking a different approach such as
https://casual-effects.com/research/McGuire2012Blur/index.html
- I'm using a noise PRNG function to jitter samples. This could be
replaced with a blue noise texture lookup or similar, however after
playing with the parameters, it gives quite nice results with 4 samples,
and is significantly better than the artifacts generated when not
jittering.

---

## Changelog

- Added: per-object motion blur. This can be enabled and configured by
adding the `MotionBlurBundle` to a camera entity.

---------

Co-authored-by: Torstein Grindvik <52322338+torsteingrindvik@users.noreply.github.com>
2024-04-25 01:16:02 +00:00
..
bevy_a11y Set the logo and favicon for all of Bevy's published crates (#12696) 2024-03-25 18:52:50 +00:00
bevy_animation Expose mutable Animation Clips (#13067) 2024-04-23 14:58:08 +00:00
bevy_app Simplify runner app exit code. (#13074) 2024-04-23 20:42:00 +00:00
bevy_asset Fix Clippy lints on WASM (#13030) 2024-04-20 09:15:42 +00:00
bevy_audio Implement clone for most bundles. (#12993) 2024-04-16 16:37:09 +00:00
bevy_color Fix crates not building individually (#12948) 2024-04-14 00:06:03 +00:00
bevy_core Fix beta lints (#12980) 2024-04-16 02:46:46 +00:00
bevy_core_pipeline Per-Object Motion Blur (#9924) 2024-04-25 01:16:02 +00:00
bevy_derive Forbid unsafe in most crates in the engine (#12684) 2024-03-27 03:30:08 +00:00
bevy_dev_tools Make AppExit more specific about exit reason. (#13022) 2024-04-22 16:48:18 +00:00
bevy_diagnostic Refactor App and SubApp internals for better separation (#9202) 2024-03-31 03:16:10 +00:00
bevy_dylib Set the logo and favicon for all of Bevy's published crates (#12696) 2024-03-25 18:52:50 +00:00
bevy_dynamic_plugin Forbid unsafe in most crates in the engine (#12684) 2024-03-27 03:30:08 +00:00
bevy_ecs Add #[track_caller] to Query methods (#12984) 2024-04-24 04:51:18 +00:00
bevy_ecs_compile_fail_tests Fix Ci failing over dead code in tests (#12623) 2024-03-21 18:08:47 +00:00
bevy_encase_derive Forbid unsafe in most crates in the engine (#12684) 2024-03-27 03:30:08 +00:00
bevy_gilrs Forbid unsafe in most crates in the engine (#12684) 2024-03-27 03:30:08 +00:00
bevy_gizmos Contextually clearing gizmos (#10973) 2024-04-23 00:16:12 +00:00
bevy_gltf Fix crates not building individually (#12948) 2024-04-14 00:06:03 +00:00
bevy_hierarchy fix bevy_hierarchy crate optional feature bevy_app (#12943) 2024-04-13 04:46:00 +00:00
bevy_input Added ButtonInput docs usage example (#13046) 2024-04-22 17:48:46 +00:00
bevy_internal Switch monolithic lib to module re-exports (#13059) 2024-04-22 01:32:51 +00:00
bevy_log Refactor App and SubApp internals for better separation (#9202) 2024-03-31 03:16:10 +00:00
bevy_macro_utils Clean up some low level dependencies (#12858) 2024-04-08 19:45:42 +00:00
bevy_macros_compile_fail_tests Fix Ci failing over dead code in tests (#12623) 2024-03-21 18:08:47 +00:00
bevy_math Additional doc aliases for WindingOrder in bevy_math (#13065) 2024-04-22 21:50:27 +00:00
bevy_mikktspace Enable clippy::ref_as_ptr (#12918) 2024-04-10 20:16:48 +00:00
bevy_pbr Meshlet continuous LOD (#12755) 2024-04-23 21:43:53 +00:00
bevy_ptr Fix uses of "it's" vs "its". (#13033) 2024-04-19 18:17:31 +00:00
bevy_reflect Fix uses of "it's" vs "its". (#13033) 2024-04-19 18:17:31 +00:00
bevy_reflect_compile_fail_tests Fix Ci failing over dead code in tests (#12623) 2024-03-21 18:08:47 +00:00
bevy_render Per-Object Motion Blur (#9924) 2024-04-25 01:16:02 +00:00
bevy_scene Implement clone for most bundles. (#12993) 2024-04-16 16:37:09 +00:00
bevy_sprite new example: sprite animation in response to an event (#12996) 2024-04-23 21:44:03 +00:00
bevy_tasks Remove async-task as a dependency (#13071) 2024-04-23 14:57:55 +00:00
bevy_text Fix beta lints (#12980) 2024-04-16 02:46:46 +00:00
bevy_time Fix uses of "it's" vs "its". (#13033) 2024-04-19 18:17:31 +00:00
bevy_transform Fix Clippy lints on WASM (#13030) 2024-04-20 09:15:42 +00:00
bevy_ui Correctly handle UI hierarchy without a camera (#12816) 2024-04-22 16:42:13 +00:00
bevy_utils Improve par_iter and Parallel (#12904) 2024-04-23 12:05:34 +00:00
bevy_window Make AppExit more specific about exit reason. (#13022) 2024-04-22 16:48:18 +00:00
bevy_winit Simplify runner app exit code. (#13074) 2024-04-23 20:42:00 +00:00