diff --git a/commits_categorized.md b/commits_categorized.md new file mode 100644 index 0000000000..7f4fb2a9ca --- /dev/null +++ b/commits_categorized.md @@ -0,0 +1,354 @@ +## Rendering + +### Animation + 5e70ad96c animations: don't ignore curves with one keyframe (#4406) + 449a1d223 animation player (#4375) + +### Skinning + + 9d54f3397 Skinned extraction speedup (#4428) + 3537c6ae2 Fix animation: shadow and wireframe support (#4367) + 31bd4ecbb Mesh Skinning. Attempt #3 (#4238) + +### More lights / Storage Buffers + + c5963b4fd Use storage buffers for clustered forward point lights (#3989) + 4feb0d520 increase the maximum number of point lights with shadows to the max supported by the device (#4435) + 0a4136d26 Add a helper for storage buffers similar to `UniformVec` (#4079) + 3f6068da3 fix issues with too many point lights (#3916) + 575ea81d7 add Visibility for lights (#3958) + a9f2817c4 bevy_pbr: Do not panic when more than 256 point lights are added the scene (#3697) + +### Clustered Improvements + 207ebde02 (james7132/main) Always update clusters and remove per-frame allocations (#4169) + 5af746457 fix cluster tiling calculations (#4148) + 244687a0b Dynamic light clusters (#3968) + b4483dbfc perf: only recalculate frusta of changed lights (#4086) + e3a3b5b9c Fixed the frustum-sphere collision and added tests (#4035) + 786654307 bevy_pbr: Optimize assign_lights_to_clusters (#3984) + +### Faster Culling +ac8bbafc5 Faster view frustum culling (#4181) + +### Sprites + 8e864fdd1 can specify an anchor for a sprite (#3463) +f6bc9a022 Sprites - keep color as 4 f32 (#4361) + +### Gltf + +d478723e1 insert the gltf mesh name on the entity if there is one (#4119) +8268e7fa9 expose extras from gltf nodes (#2154) +703ae5df5 gltf: add a name to nodes without names (#4396) + 30878e3a7 (mockersf/main) add AnimationPlayer component only on scene roots that are also animation roots (#4417) +48ac955af Fix loading non-TriangleList meshes without normals in gltf loader (#4376) + fbe7a49d5 Gltf animations (#3751) +3e631e623 gltf-loader: disable backface culling if material is double-sided (#4270) +b4bf5b5d8 Fix glTF perspective camera projection (#4006) + +### Shaders +551d9f6cd use error scope to handle errors on shader module creation (#3675) +e4203c392 shader preprocessor - do not import if scope is not valid (#4012) +e9f52b9dd Move import_path definitions into shader source (#3976) +56b0e88b5 Add view transform to view uniform (#3885) +b7dfe1677 include sources in shader validation error (#3724) +600ee7eee support all line endings in shader preprocessor (#3603) + +### Compressed Textures + 0529f633f KTX2/DDS/.basis compressed texture support (#3884) + +### Compute Pipeline Specialization + 9e450f282 Compute Pipeline Specialization (#3979) + +### Render To Texture + 81d57e129 Add capability to render to a texture (#3412) + +### Custom Vertex Buffer Layouts + e369a8ad5 Mesh vertex buffer layouts (#3959) + +### Wgpu Feature / Limit Overrides +803e8cdf8 bevy_render: Support overriding wgpu features and limits (#3912) +936468aa1 bevy_render: Use RenderDevice to get limits/features and expose AdapterInfo (#3931) + +### Other + +579928e8e bevy_pbr: Support flipping tangent space normal map y for DirectX normal maps (#4433) +6c085cba4 bevy_render: Support removal of nodes, edges, subgraphs (#3048) +1d5145fd6 StandardMaterial: expose a cull_mode option (#3982) +40b36927f Expose draw indirect (#4056) +0ccb9dd07 bevy_render: Fix Quad flip (#3741) +55da31543 bevy_render: Provide a way to opt-out of the built-in frustum culling (#3711) + +### Camera Marker Components + + bf6de8962 use marker components for cameras instead of name strings (#3635) + +### Tracing +fee7a2613 Tracy spans around main 3D passes (#4182) + +### Tweaks + +ef823d369 bevy_render: Do not automatically enable MAPPABLE_PRIMARY_BUFFERS (#3698) +865698548 Fix HDR asset support (#3795) +aa7b15889 Add a size method on Image. (#3696) +33ef5b503 bevy_render: Only auto-disable mappable primary buffers for discrete GPUs (#3803) +01bdf67c3 Improve the `set_active_camera` system (#4251) +ea6e6f7db Do not crash if RenderDevice doesn't exist (#4427) +dbd5e7ab6 Fixed case of R == G, following original conversion formula (#4383) +7ff3d876f Clean up duplicated color conversion code (#4360) +6844a6f4f Introduce `SystemLabel`'s for `RenderAssetPlugin`, and change `Image` preparation system to run before others (#3917) +0e821da70 bevy_render: Batch insertion for prepare_uniform_components (#4179) +e36c9b6cf Add conversions from Color to u32 (#4088) +cba9bcc7b improve error messages for render graph runner (#3930) +544b6dfb8 Change default `ColorMaterial` color to white (#3981) + +## ECS + 63fee2572 `ParamSet` for conflicting `SystemParam`:s (#2765) + + 509548190 Add get_multiple and get_multiple_mut APIs for Query and QueryState (#4298) + b33dae31e Rename get_multiple APIs to get_many (#4384) + + c26be3971 Remove unnecessary system labels (#4340) + b1c3e9862 Auto-label function systems with SystemTypeIdLabel (#4224) + +73edb11db Add more FromWorld implementations (#3945) + f16768d86 bevy_derive: Add derives for `Deref` and `DerefMut` (#4328) + + b6a647cc0 default() shorthand (#4071) + + 557ab9897 Make get_resource (and friends) infallible (#4047) + +2f11c9dca Add Query::contains (#3090) +64d217823 Allow iter combinations on queries with filters (#3656) + +b1afe2dcc Make `System` responsible for updating its own archetypes (#4115) +21a875d67 Some small changes related to run criteria piping (#3923) +032b0f4ba Fix derive(SystemParam) macro (#4400) +1b63d949e Re-add ECS benchmark suite (#4332) +4c1678c78 Hide docs for concrete impls of Fetch, FetchState, and SystemParamState (#4250) +6e61fef67 Obviate the need for `RunSystem`, and remove it (#3817) +cf46baa17 Add clear_schedule (#3941) +c1a4a2f6c Remove the config api (#3633) + ba6b74ba2 Implement `WorldQuery` derive macro (#2713) +bdbf62634 Implement init_resource for `Commands` and `World` (#3079) +6615b7bf6 Deprecate `.system` (#3302) +b3462428c Move the CoreStage::Startup to a seperate StartupSchedule label (#2434) + 760466588 Implement AnyOf queries (#2889) +fe4a42a64 Mut to immut impls (#3621) +f00aec245 Added method to restart the current state (#3328) +7d712406f Simplify sending empty events (#2935) +6f111136b Cleanup some things which shouldn't be components (#2982) + 1f99363de Add &World as SystemParam (#2923) +c216738b3 Implement len and is_empty for EventReaders (#2969) +21ac4bc0a impl Command for (#2996) +69e9a47d9 SystemParam Derive fixes (#2838) +ce752d252 Increment last event count on next instead of iter (#2382) + +## UI +6f16580b8 Fix clicked UI nodes getting reset when hovering child nodes (#4194) +954022c79 Add text wrapping support to Text2d (#4347) +d3e526bfc Add FocusPolicy to NodeBundle and ImageBundle (#3952) +e749ee786 Fix ui interactions when cursor disappears suddenly (#3926) +fe0e5580d Fix node update (#3785) + +## Utils +b3a1db60f Proper prehashing (#3963) + +## Audio + + b21c69c60 Audio control - play, pause, volume, speed, loop (#3948) + +## Assets +baae97d00 `iter_mut` on Assets: send modified event only when asset is iterated over (#3565) +98938a855 Internal Asset Hot Reloading (#3966) +62329f7fd Useful error message when two assets have the save UUID (#3739) +75286b854 check if resource for asset already exists before adding it (#3560) +e928acb9f bevy_asset: Add AssetServerSettings watch_for_changes member (#3643) + +## Windowing + +39d89fe0d Enable drag-and-drop events on windows (#3772) +3756181e2 (HEAD, origin/staging, origin/main) Change scaling mode to FixedHorizontal (#4055) +b3aff9a7b Add docs and common helper functions to `Windows` (#4107) + 2d674e7c3 Reduce power usage with configurable event loop (#3974) +1477765f6 Replace VSync with PresentMode (#3812) +c16d0c5a3 do not set cursor grab on window creation if not asked for (#3617) + +## Transforms +54d2e86af bevy_transform: Use Changed in the query for much faster transform_propagate_system (#4180) +54fbaf4b4 Add transform hierarchy stress test (#4170) +a304fd9a9 Split bevy_hierarchy out from bevy_transform (#4168) +2b1120261 (robtfm/main) fix mul_vec3 tranformation order: should be scale -> rotate -> translate (#3811) +59ee51229 Add TransformBundle (#3054) +f584e7295 Add Transform::rotate_around method (#3107) +37a7be56d Make transform builder methods const (#3045) + +## Safety + dba779001 REMOVE unsound lifetime annotations on `EntityMut` (#4096) + 024d98457 yeet unsound lifetime annotations on `Query` methods (#4243) + 637a14991 unsafeify `World::entities_mut` (#4093) + 050d2b7f0 yeet `World::components_mut` >:( (#4092) + 142e7f3c5 Backport soundness fix (#3685) + af22cc1dc Use ManuallyDrop instead of forget in insert_resource_with_id (#2947) + +## Examples + +3555603df example on how to create an animation in code (#4399) +e7e74457c scene viewer improvements: animation reset (#4420) +7e3637c36 fix scene_viewer example on wasm (#4426) +28d0a4002 Only enable mouse movement when pressed in scene_viewer (#4405) +ac29cbecf add support for loading animations in `scene_viewer` example (#4403) +738cd5e74 Add a scene viewer tool (#4183) +21f6760b2 Render to texture example: No need to create an image handle manually. (#4223) +9dfd4e4b0 (ManevilleF/staging) Add examples for Transforms (#2441) +6ce8e5006 Add mouse grab example (#4114) +a188babce many_cubes: Add a cube pattern suitable for benchmarking culling changes (#4126) +159fe527a (Ku95/main) Slow down the many_cubes example (#4117) +6c95b582a (tornewuff/staging, DJMcNab/main) Make many_cubes example more interesting (#4015) +3ffa655cd examples: add screenspace texture shader example (#4063) +38f6da5a8 Add generic systems example (#2636) +385a2b189 add examples on how to have a data source running in another thread / in a task pool thread (#2915) +f991c73bd Add move sprite example. (#2414) +ac63c491f Simple 2d rotation example (#3065) +3e8e6c567 add an example using UI & states to create a game menu (#2960) + +## CI + + 28ba87e6c (alice-i-cecile/main) CI runs `cargo miri test -p bevy_ecs` (#4310) +c44f8b2b6 Run tests (including doc tests) in `cargo run -p ci` command (#3849) + +## Profiling + +de677dbfc Use more ergonomic span syntax (#4246) + +## Dev Docs + +e020c5721 Add automatic docs deployment to GitHub Pages (#3535) +026563cb1 Deploy dev docs - install dependencies (#4222) +6ff17eaab Deploy dev docs - fix sed command (#4221) + +## Tweaks / Docs +f23ae104b Slight perf improvements and tidy for contributors example (#3764) +f907d67d7 Fix formatting, spelling, phrasing and consistency (#4275) +dbb2fcb67 Re-enable test_property_type_registration() (#4419) +cf831d518 input clear should not clear pressed (#4418) +99a2dc50a Cleanup some outdated parts of ecs_guide (#4342) +d9d2fb640 Added pressed state to input clear so it clears everything (#4410) +f90da74e3 Remove `face_toward.rs` (#4277) +0ed08d6a1 fix multiple_windows example (#4389) +dd2001f2f bevy_render: add a small color box to each color (#4387) +648544faf Bump actions/cache from 2 to 3 (#4348) +aca7fc185 Remove outdated perf comments (#4374) +3af90b67a Update RemovedComponents doc comment (#4373) +4480b36bf (BoxyUwU/main) Replace confusing links from CONTRIBUTING.md with short instruction (#4369) +2b35dbabf impl Reflect and Debug for Mesh2dHandle (#4368) +c7c08f95c Fix gamepad connection system ordering (#4313) +f3a61327a Remove `margins.rs` (#4284) +f5e53ba6f Only insert or remove input if needed (#4273) +8570b651f Clean up Breakout logic (#4311) +a190cd59d Revert changes to colors in Breakout game (#4325) +ab83336f5 Replace `_system` system names in Breakout examples (#4312) +d51b54a65 Break out Breakout components into a more sensible organization (#4261) +fa791d6bb (bilsen/main) Make a note about the MSRV (#4274) +31636a350 Update linux_dependencies for Gentoo. (#4195) +685b6e59b (tornewuff/main) register `Camera{2,3}d` components for reflection (#4269) +cd694c0d0 Prevent event from getting registered twice (#4258) +b0ddce36b Check an `Input`'s `pressed` set before adding to `just_released`. (#4209) +af24576b9 Move magic numbers into constants in Breakout example (#4255) +95d3f32b9 Revert "Add cart's fork of ecs_bench_suite (#4225)" (#4252) +08ef2f0a2 Add cart's fork of ecs_bench_suite (#4225) +e7a942044 Change `Cow<[ComponentId]>` to `Box<[ComponentId]>` (#4185) +7ce3ae43e Bump Bevy to 0.7.0-dev (#4230) +c1a237879 Add "Changelog" and "Migration Guide" to PR template (#4143) +a291b5aae Ignore duplicate wasi crate in dependency tree (#4190) +b493165bf Use reactive rendering for ui examples. (#4164) +1a85fb5ea Fix mesh2d_manual example (#4037) +4add96b1b Cleanup doc / comments about changed defaults (#4144) +de2a47c2b export TaskPoolThreadAssignmentPolicy (#4145) +e41c5c212 Fix UI node Transform change detection (#4138) +fb02b8422 Bump actions/checkout from 2 to 3 (#4136) +a88a59c9e Bump actions/upload-artifact from 1 to 3 (#4135) +ce871d16f Bump actions/labeler from 3 to 4 (#4134) +c05ba2370 Add Reflect support for DMat3, DMat4, DQuat (#4128) +0eec2ea0d Slight changes from the book (#4077) +72bb38cad Example of module-level log usage and RUST_LOG usage in main doc (#3919) +caf6611c6 remove Events from bevy_app, they now live in bevy_ecs (#4066) +1ba9818a7 Significantly reduce the amount of building required for benchmarks (#4067) +258f49535 log spans on panic when trace is enabled (#3848) +461cf536b Slight perf improvements and tidy for bevymark (#3765) +44bf66e43 Minor Dark/Light Logo Tweak (#4051) +371c90f6f Minor Bevy Logo Tweaks (#4050) +b697e73c3 Enhanced par_for_each and par_for_each_mut docs (#4039) +c4e88fe4b Rename "2d rotation" example name to "rotation" (#3965) +1fa54c200 Updated visibility of reflected trait (#4034) +519148275 Rename rg3d to Fyrox in README (#4032) +95bc99fd3 Implement Reflect for missing Vec* types (#4028) +a2d49f4a6 Make `WinitWindows` non send (#4027) +b3a2cbbc9 remove external_type_uuid macro (#4018) +5afda8df6 Fix all_tuples macro for non-0/1 starts (#4002) +fb8af3aec Update Hexasphere to 7.0.0 (#4001) +c4f132afb Fix call with features in docs/profiling.md (#3967) +b0768a583 Fix custom material glsl example using incorrect CameraViewProj (#3962) +510439768 Alien cake addict: Allow holding movement keys (#2072) +330160cf1 SystemState usage docs (#3783) +d8974e7c3 small and mostly pointless refactoring (#2934) +5bb4201f2 add informative panic message when adding render commands to a DrawFunctions that does not exist (#3924) +d305e4f02 only use unique type UUIDs (#3579) +647526835 Fix hardcoded texture bind group index in bevy_ui (#3905) +9a7852db0 (robtfm/staging) Fix SetSpriteTextureBindGroup to use index (#3896) +1e049a651 Fix type mismatch error with latest winit (#3883) +1468211e2 fix unreachable macro calls for rust 2021 (#3889) +f7478f448 doc: remove mention of void return type in entry_point docs (#3881) +3d6e4893f reverse how diagnostic values are saved (#3056) +b13f238fc allow Entity to be deserialized with serde_json (#3873) +a0af066af fix typo in bevy_ecs/README.md (#3869) +3431335ee add missing `into_inner` to `ReflectMut` (#3841) +b11ee3ffb Remove duplicate call to set_vertex_buffer(0, ...) in shader_instancing example (#3738) +ca83e8a6d fix: remove unneeded filter in check_light_mesh_visibility (#3861) +6b8d64cd0 impl more traits for bevy_core::Name (#3611) +e2cce092d derive clone for Input (#3569) +ef65548fb Change default window title to "app" (#3417) +bb1538a13 improve error message for attempting to add systems using add_system_to_stage (#3287) +6ac9d6876 Make ECS benchmark more representative (#2941) +19bd6b9c3 Update rodio 0.15 (#3846) +b506c30cd fix: only init_resource() once for AmbientLight (#3853) +506642744 docs: Fix private doc links and enable CI test (#3743) +6cab36165 Update ClearColor Resource docs (#3842) +6a499b125 Update gltf requirement from 0.16.0 to 1.0.0 (#3826) +c285a69f7 Add the Inside version to the Collision enum (#2489) +4134577e6 Fix Code of Conduct bolding in readme (#3822) +ca029ef0e Naga export (#3714) +44d09dc46 fix timer test to be less reliant on float precision (#3789) +435fb7af4 Improve shader_material example documentation (#3601) +6d76229c3 Fix a typo in shader_defs example (#3762) +514754d65 Add crate level docs to bevy_log and enable #![warn(missing_docs)] (#3520) +f5039a476 Mark .id() methods which return an `Entity` as must_use (#3750) +f3de12bc5 Add a warning when `watch_for_changes` has no effect (#3684) +f1f6fd349 Remove `ComponentsError` (#3716) +e30d600db Update docstrings for `text_system` and `text2d_system` (#3732) +cb2ba19d9 rename Texture to Image in doc of `from_buffer` function (#3713) +e88e394fe Remove wasm specific examples (#3705) +836ffeda3 Add missing dependencies for Fedora with Wayland (#3708) +a3e43b6ab Remove cargo-lipo from iOS ci job (#3671) +8139022ec Change bevy_core::Name to implement Deref (#3681) +e16ba80bd Add bevy_bird SVG for simpleicons.org (#3672) +d11cd6345 Fixed doc comment with render Node input/output methods (#3642) +3fcdc5a49 Expanded Msaa documentation. (#3693) +758fc5af6 Remove a couple of unnecessary full paths (#3699) +e30199f7a Document bevy_tasks and enable #![warn(missing_docs)] (#3509) +71814ca91 Added API guidelines to CONTRIBUTING.md (#3646) +8e1f660e1 Don't panic in macro shape validation (#3647) +2186eae89 bevy_crevice: Fix incorrect iterator usage in WriteStd430 impl for [T] (#3591) +7c22f92ce Document sub apps (#3403) +f073b2d7f document more of bevy_reflect (#3655) +39db8ecd0 Added docs for bevy_transform (#3516) +17bb812d5 Ignore clippy 1.58 (#3667) +7fd781e67 Fix documentation for QueryState::iter_manual (#3644) +84144c942 Remove documentation warning on EntityCommands::insert that is no longer necessary (#3653) +bc499591c Use `use` instead of lots of full paths (#3564) +fc0f15f11 Documentation: simplify NixOS dependencies (#3527) +6bc5c6098 Remove tests from example style guide (#3582) +130953c71 Enable the `doc_markdown` clippy lint (#3457) +e56685370 Fix `doc_markdown` lints in `bevy_render` (#3479) +6f167aa3d Documented `Events` (#3306) +8c81e8167 Thread local example cleanup (#3586) +4b4dbb021 document `Struct`, `TupleStruct` and `Tuple` (#3081) diff --git a/content/news/2022-04-15-bevy-0.7/bevy_scene_viewer.png b/content/news/2022-04-15-bevy-0.7/bevy_scene_viewer.png new file mode 100644 index 0000000000..2070df1e45 Binary files /dev/null and b/content/news/2022-04-15-bevy-0.7/bevy_scene_viewer.png differ diff --git a/content/news/2022-04-15-bevy-0.7/bistro_compressed.png b/content/news/2022-04-15-bevy-0.7/bistro_compressed.png new file mode 100644 index 0000000000..7cebcec482 Binary files /dev/null and b/content/news/2022-04-15-bevy-0.7/bistro_compressed.png differ diff --git a/content/news/2022-04-15-bevy-0.7/dev_docs.png b/content/news/2022-04-15-bevy-0.7/dev_docs.png new file mode 100644 index 0000000000..e6eacf3375 Binary files /dev/null and b/content/news/2022-04-15-bevy-0.7/dev_docs.png differ diff --git a/content/news/2022-04-15-bevy-0.7/fox.mp4 b/content/news/2022-04-15-bevy-0.7/fox.mp4 new file mode 100644 index 0000000000..9d894c4151 Binary files /dev/null and b/content/news/2022-04-15-bevy-0.7/fox.mp4 differ diff --git a/content/news/2022-04-15-bevy-0.7/index.md b/content/news/2022-04-15-bevy-0.7/index.md new file mode 100644 index 0000000000..568cb05ef4 --- /dev/null +++ b/content/news/2022-04-15-bevy-0.7/index.md @@ -0,0 +1,1166 @@ ++++ +title = "Bevy 0.7" +date = 2022-04-15 +[extra] +author = "Carter Anderson" +twitter = "cart_cart" +github = "cart" +youtube = "cartdev" +image = "mushroom.png" +show_image = true +image_subtitle = "'Stylized mushrooms' scene by QumoDone rendered in Bevy. This scene is licensed under Creative Commons Attribution." +image_subtitle_link = "https://sketchfab.com/3d-models/stylized-mushrooms-9d22e02ce2a548959b1c4c4c1d546842" ++++ + +Thanks to **123** contributors, **349** pull requests, and our [**generous sponsors**](https://github.com/sponsors/cart), I'm happy to announce the **Bevy 0.7** release on [crates.io](https://crates.io/crates/bevy)! + +For those who don't know, Bevy is a refreshingly simple data-driven game engine built in Rust. You can check out [Quick Start Guide](/learn/book/getting-started/) to get started. Bevy is also free and open source forever! You can grab the full [source code](https://github.com/bevyengine/bevy) on GitHub. Check out [Bevy Assets](https://bevyengine.org/assets) for a collection of community-developed plugins, games, and learning resources. + +To update an existing Bevy App or Plugin to **Bevy 0.7**, check out our [0.6 to 0.7 Migration Guide](/learn/book/migration-guides/0.6-0.7/). + +As always, there are a _ton_ of new features, bug fixes, and quality of life tweaks in this release, but here are some of the highlights: + +* Skeletal animation and mesh skinning +* GLTF animation importing +* Unlimited* point lights in a scene +* Improved clustered forward rendering: dynamic/adaptive clustering and faster, more accurate cluster assignment +* Compressed texture support (KTX2 / DDS / .basis): load more textures in a scene, faster +* Compute shader / pipeline specialization: Bevy's flexible shader system was ported to compute shaders, enabling hot reloading, shader defs, and shader imports +* Render to texture: cameras can now be configured to render to a texture instead of a window +* Flexible mesh vertex layouts in shaders +* ECS improvements: Order systems using their names, Query::many_mut, use conflicting parameters in systems via ParamSets, WorldQuery derives +* Documentation improvements: better examples, more doc tests and more coverage +* More audio control: pause, volume, speed, and looping +* Power usage options to enable only updating Bevy Apps when input occurs + + + +## Skeletal Animation + +
authors: @james7132, @mockersf, @lassade, @Looooong
+ +Bevy finally supports 3D skeletal animation! + + + +
Scene Credits: Tanabata evening - Kyoto inspired city scene by Mathias Tossens is licensed under Creative Commons Attribution. Character model and animation are royalty free assets from Mixamo. +
+ +Skeletal animations can now be played, paused, scrubbed, looped, reversed, and speed controlled using the new [`AnimationPlayer`] component and [`AnimationClip`] asset: + +```rust +#[derive(Component)] +struct Animations { + dance: Handle, +} + +fn start_dancing(mut query: Query<(&Animations, &mut AnimationPlayer)>) { + for (animations, mut animation_player) in query.iter_mut() { + animation_player.play(animations.dance.clone()); + } +} +``` + +[`AnimationPlayer`] can also be used to animate arbitrary [`Transform`] components, not just skeletons! + +This critical feature has been a long time coming, but we wanted to build it in a way that meshed nicely with the [new Bevy renderer](/news/bevy-0-6/#the-new-bevy-renderer) and didn't just "hack things in". This builds on our new [Flexible Mesh Vertex Layouts](/news/bevy-0-7/#flexible-mesh-vertex-layouts), [Shader Imports](/news/bevy-0-6/#shader-imports), and [Material](/news/bevy-0-6/#materials) systems, which ensures that this logic is flexible and reusable, even with non-standard meshes and custom render pipelines. + +And we're just getting started! Multi-track animation blending and higher level animation state management should arrive in the very near future. Now is a great time to start contributing animation features to Bevy. We've smashed through most of the foundational technical hurdles and what remains is largely high level api design choices. We already have a couple of draft RFCs open in these areas: [Animation Composition](https://github.com/bevyengine/rfcs/pull/51) and [Animation Primitives](https://github.com/bevyengine/rfcs/pull/49). Feel free to join the conversation! + +[`AnimationPlayer`]: https://docs.rs/bevy/0.7.0/bevy/animation/struct.AnimationPlayer.html +[`AnimationClip`]: https://docs.rs/bevy/0.7.0/bevy/animation/struct.AnimationClip.html +[`Transform`]: https://docs.rs/bevy/0.7.0/bevy/transform/components/struct.Transform.html + +## GLTF Animation Importing + +
authors: @mockersf
+ +Bevy's GLTF importer was extended to import GLTF animations into the new [`AnimationPlayer`] system. This supports both "skeletal animation" and arbitrary transform animations: + + + +```rust +struct FoxAnimations { + walk: Handle, +} + +fn setup(mut commands: Commands) { + commands.spawn_scene(asset_server.load("models/animated/Fox.glb#Scene0")); + commands.insert_resource(FoxAnimations { + walk: asset_server.load("models/animated/Fox.glb#Animation0"), + }); +} + +fn play_on_load( + animations: Res, + mut players: Query<&mut AnimationPlayer, Added>, +) { + for mut player in players.iter_mut() { + player.play(animations.walk.clone()).repeat(); + } +} +``` + +## Unlimited* Point Lights + +
authors: Rob Swain (@superdump), @robtfm
+ +Bevy can now render scenes with arbitrary numbers of point lights on platforms that support storage buffers (which is basically everything but WebGL). In the last Bevy release (0.6) we added [Clustered Forward Rendering](/news/bevy-0-6/#clustered-forward-rendering), which is a rendering technique that optimizes each fragment's light calculation costs by assigning lights to sub-volumes of the visible volume, called "clusters". However in the interest of platform compatibility (WebGL), we initially limited ourselves to 256 lights because that is what fit in a uniform buffer binding. + +In **Bevy 0.7**, we added the ability to automatically "upgrade" to using unbounded storage buffers for Clustered Forward Rendering on platforms that support them, enabling unlimited* point lights. There is an asterisk there because in practice this is limited by memory and hardware constraints. + +## Light Clustering Features and Optimizations + +
authors: Rob Swain (@superdump), @robtfm, @dataphract, @cart
+ +With the upper limit of 256 point lights removed, the only limit on lights is what the hardware can support and bottlenecks in our algorithms. To increase the number of lights, we made a number of optimizations to our clustering algorithms. + +* **Dynamic Light Clusters** + * By default cluster x/y slices are now dynamically configured based on the lights in the scene, which can significantly increase performance in some scenes. + * The clustering behavior is now also user-configurable as FixedZ (the new default dynamic x/y behavior, fixing the number of z slices), custom fixed x/y/z slice values, single-cluster, and "no clustering", giving you control when you know a certain cluster configuration will perform even better. + * Additionally, in 0.6 the visible volume that is covered by all the clusters basically matched the full visible volume of the view frustum. This meant that if all the point lights were in the foreground, all the clusters beyond the lights were wasted space. In 0.7, it is possible to limit the far bound to be closer than the camera far bound, which means the lights can be spread across more clusters, which can significantly increase rendering performance. +* **Iterative Sphere Refinement**: Bevy now uses the Just Cause 3 iterative sphere refinement approach to cluster assignment, which gives us a ~10% performance increase on some benchmarks and more accurate clustering (which can also improve render performance). +* **Light Frustum Change Detection**: We now use Bevy ECS's change detection feature to only recalculate the view frustum of lights that have changed. +* **Cluster Assignment Optimizations**: The cluster assignment data access patterns and data structures received a variety of tweaks that improved performance. + +Here is a video illustrating a progression from the old limit of 256 point lights to 25,000 point lights at 60fps! + +(Note that the 25,000 lights example disables the debug light spheres to ensure that light calculations are the bottleneck) + + + +And we have [even more clustering optimizations](https://github.com/bevyengine/bevy/pull/4345) in the works! + +## Configurable Light Visibility + +
authors: @robtfm
+ +Lights can now be turned on and off using Bevy's standard [`Visibility`] component: + +```rust +commands.spawn(PointLightBundle { + visibility: Visibility { + is_visible: false, + }, + ..default() +}); +``` + +[`Visibility`]: https://docs.rs/bevy/0.7.0/bevy/render/view/struct.Visibility.html + +## Compressed GPU Textures + +
authors: Rob Swain (@superdump)
+ +As scenes grow larger, so do their assets. Compressing these assets is a great way to save space. The Amazon Bistro scene featured below has well over 1GB of compressed textures. + +PNG is a popular compressed format, but it must be decompressed before the GPU can use it. This can be a slow process for large scenes. Those textures are then used in their uncompressed form, taking up large quantities of limited memory. Compressed GPU textures can be used directly in their compressed format by the GPU and can be loaded without any additional processing. This reduces load times significantly. As they remain compressed, this also reduces RAM usage significantly. + +The Bistro scene took a total of 12.9s to load with PNG textures, but only 1.5s with compressed textures - taking approximately a tenth of the load time! The total RAM usage was ~12GB with uncompressed textures, and 5GB with compressed textures, less than half! + +The benefits don't stop there either - because the textures are compressed and can be used by the GPU in that format, reading from them uses less memory bandwidth, which can bring performance benefits. The Bistro scene gains about 10% in frame rate from using compressed textures. + +![bistro compressed](bistro_compressed.png) + + +Another benefit is that mipmaps are supported, which makes for smoother, less noisy textures. Bevy currently doesn't have support for automatically generating mipmaps for uncompressed textures, so using compressed textures is a nice way to have mipmaps now! + +In summary, Bevy now supports loading compressed textures from `.dds`, `.ktx2`, and `.basis` files. This includes support for the standard ASTC, BCn, and ETC2 formats, as well as 'universal' formats like ETC1S and UASTC that can be transcoded to the standard formats supported by specific systems at runtime. The glTF loader was also extended to support loading these formats. + +These features can be enabled using the `dds`, `ktx2`, and `basis-universal` cargo features. + +## Render To Texture + +
authors: @HackerFoo
+ +Bevy now has initial support for rendering to texture by configuring the `render_target` field on `Camera`. This enables scenarios such as mirrors, split screen, 2d UI in 3d space, portals, etc. + + + +Note that the current implementation is relatively low level. It will generally require interacting with Bevy's Render Graph and defining new camera types. If you would like to use this feature now, the [render_to_texture example](https://github.com/bevyengine/bevy/blob/main/examples/3d/render_to_texture.rs) illustrates the steps required. We have plans for ["high level render targets"](https://github.com/bevyengine/bevy/discussions/4191) that will make rendering to textures possible in just a few lines of code. Stay tuned for details! + +## Bevy-Native Compute Shaders + +
authors: @Ku95
+ +Bevy's flexible asset-driven shader system was ported to compute shaders/pipelines, enabling hot reloading, [shader defs](https://bevyengine.org/news/bevy-0-6/#shader-preprocessor), [shader imports](https://bevyengine.org/news/bevy-0-6/#shader-imports), and [pipeline specialization](https://bevyengine.org/news/bevy-0-6/#pipeline-specialization) based on user-configurable keys: + +```rust +#import "shaders/game_of_life_texture_bind_group.wgsl" + +[[stage(compute), workgroup_size(8, 8, 1)]] +fn game_of_life_update([[builtin(global_invocation_id)]] invocation_id: vec3) { + let location = vec2(i32(invocation_id.x), i32(invocation_id.y)); + let alive = is_location_alive(location); + + // shader defs are configurable at runtime, prompting new variants of the shader to be compiled +#ifdef WRITE_OUTPUT + storageBarrier(); + textureStore(texture, location, vec4(f32(alive))); +#endif +} +``` + +## Flexible Mesh Vertex Layouts + +
authors: @cart, @parasyte
+ +In **Bevy 0.7**, it is now easy to make shaders support any Mesh vertex layout and arbitrary vertex attributes. Bevy's "shader pipeline specialization" system was extended to support "specializing on mesh vertex layouts". + +For most Bevy users, this means that [Materials](/news/bevy-0-6/#materials), including the built in [`StandardMaterial`] and custom shader materials now support arbitrary Meshes automatically, provided those Meshes have the vertex attributes required by the material shaders. It also means that if your Mesh is missing any attribute required by its material, rendering can fail gracefully. + +We also made use of this system to implement joint weights and indices for our new [Skeletal Animation](/news/bevy-0-7/#skeletal-animation) implementation. + +For Bevy users that like to write lower level graphics pipelines, this feature makes it possible to easily and efficiently specialize your pipelines according to Mesh vertex layouts: + +```rust +impl SpecializedMeshPipeline for SomeCustomPipeline { + type Key = SomeCustomKey; + + fn specialize( + &self, + key: Self::Key, + layout: &MeshVertexBufferLayout, + ) -> Result { + // this is a layout that matches the requirements requested, + // but catered to whatever mesh is currently being rendered + let vertex_buffer_layout = layout.get_layout(&[ + Mesh::ATTRIBUTE_POSITION.at_shader_location(0), + Mesh::ATTRIBUTE_NORMAL.at_shader_location(1), + Mesh::ATTRIBUTE_UV_0.at_shader_location(2), + ])?; + + Ok(RenderPipelineDescriptor { + vertex: VertexState { + buffers: vec![vertex_buffer_layout], + /* define the rest of the vertex state here */ + }, + /* define the rest of the mesh pipeline here */ + }) + } +``` + +[`StandardMaterial`]: https://docs.rs/bevy/0.7.0/bevy/pbr/struct.StandardMaterial.html + +## Camera Marker Components + +
authors: @jakobhellermann
+ +In **Bevy 0.7**, Cameras now use the "marker component" pattern to determine the "camera type" (ex: 3D, 2D, UI), rather than using string names. + +This means that it is now cheaper and easier to select cameras of a specific type: + +```rust +fn move_3d_camera_system(transforms: Query<&mut Transform, With>) { + for mut camera in transforms.iter_mut() { + // move camera here + } +} +``` + +## Ergonomic System Ordering + +
authors: @cart, @aevyrie, @alice-i-cecile, @DJMcNab
+ +Bevy uses "labels" to define ordering constraints between its ECS systems when they run in parallel. In previous versions of Bevy, the only way to order systems was to define custom labels: + +```rust +#[derive(SystemLabel, Clone, Hash, Debug, PartialEq, Eq)] +struct UpdateVelocity; + +app + .add_system(update_velocity.label(UpdateVelocity)) + .add_system(movement.after(UpdateVelocity)) +``` + +In **Bevy 0.7**, manually defining labels is no longer required. You can order systems using functions, just like you do when adding systems! + +```rust +app + .add_system(update_velocity) + .add_system(movement.after(update_velocity)) +``` + +This is accomplished by "auto-labeling" systems with their [`TypeId`] (the label type is [`SystemTypeIdLabel`]). Internally ordering still uses labels. + +The Bevy ECS labeling system is powerful and there are still legitimate use cases for custom labels (such as labeling multiple systems with the same label and exporting a stable public API as a plugin author). But most common use cases can take advantage of the ergonomic auto-labeling functionality. + +[`TypeId`]: https://doc.rust-lang.org/std/any/struct.TypeId.html +[`SystemTypeIdLabel`]: https://docs.rs/bevy/0.7.0/bevy/ecs/system/struct.SystemTypeIdLabel.html + +## Default Shorthand + +
authors: @cart
+ +Bevy makes heavy use of Rust's [struct update pattern](https://doc.rust-lang.org/book/ch05-01-defining-structs.html#creating-instances-from-other-instances-with-struct-update-syntax) in combination with the `Default` trait when initializing entities. This significantly reduces the amount of typing required by enabling developers to only fill in the fields they want to change. + +The standard way of doing this is to write out `..Default::default()`: + +```rust +commands.spawn_bundle(SpriteBundle { + texture: some_texture, + ..Default::default() +}) +``` + +This is much better than filling in each field's component manually: + +```rust +commands.spawn(SpriteBundle { + texture: some_texture, + sprite: Default::default(), + transform: Default::default(), + global_transform: Default::default(), + visibility: Default::default(), +}); +``` + +However this can feel repetitive when you're doing it for tens or hundreds of entities. We added a way to make this even easier, without needing to resort to macros: + +```rust +commands.spawn_bundle(SpriteBundle { + texture: some_texture, + ..default() +}) +``` + +This is equivalent in functionality to `..Default::default()`, it's just more compressed. And you can still use the longer form if you prefer. The `default()` function is included in Bevy's prelude, so you don't need to manually import it. Ergonomics for the win! + +## Query::many + +
authors: @alice-i-cecile
+ +Bevy ECS solves a hard problem: providing easy and fast access to data in parallel while still respecting Rust's strict mutability and ownership rules. Since our first release, we've supported efficiently accessing specific entities in our ECS Queries: + +```rust +struct SomeEntities { + a: Entity, + b: Entity, +} + +fn system(mut query: Query<&mut Transform>, entities: Res) { + let a_transform = query.get_mut(entities.a).unwrap(); +} +``` + +However, to respect Rust's mutability rules, we need to disallow apis that might produce "aliased mutability". Seasoned Bevy users will probably recognize this Rust borrow checker error: + +```rust +fn system(mut query: Query<&mut Transform>, entities: Res) { + let a_transform = query.get_mut(entities.a).unwrap(); + // This line fails to compile because `query` is already mutably borrowed above + let b_transform = query.get_mut(entities.b).unwrap(); +} +``` + +_You_ know Entity A and Entity B are different entities at runtime. But Rust's borrow checker has no way to know that at compile time! I'm sure you can imagine game development scenarios that would benefit from having mutable access to multiple components at the same time. This borrow checker restriction was a common pain point and the workarounds were ... not fun (using scopes to ensure conflicting accesses are dropped, copying data, re-querying things, etc). + +Fortunately, **Bevy 0.7** introduces a brand new set of apis to save the day! + +```rust +fn system(mut query: Query<&mut Transform>, entities: Res) { + // Takes an array of entities and returns an array of mutable Query results + // This will panic if there are entity conflicts or the entities do not exist + let [a_transform, b_transform] = query.many_mut([entities.a, entities.b]); +} +``` + +There are plenty of variants: + +```rust +// Same as many_mut, but returns a Result instead of panicking +if let Ok([a_transform, b_transform]) = query.get_many_mut([entities.a, entities.b]) { +} + +// There are also immutable/read-only variants +let [a_transform, b_transform] = query.many([entities.a, entities.b]); +if let Ok([a_transform, b_transform]) = query.get_many([entities.a, entities.b]) { +} +``` + +And they all support arbitrary numbers of entities: + +```rust +let [a, b, c] = query.many([entity_a, entity_b, entity_c]); +``` + +## ParamSets + +
authors: @bilsen
+ +To prevent aliased mutability, Bevy ECS disallows systems that have parameters that conflict with each other. For example, if two Queries both request write access to the same component in the same "archetype", that could result in aliased mutable access, so Bevy disallows that system and errors out. + +Previous versions of Bevy supported conflicting Queries in the same system using QuerySets, which only allow access to one Query in the set at a time: + +```rust +// These queries could each return a mutable A component for the same entity, so they must be put in a set to be considered a valid system. +fn system(mut set: QuerySet<(QueryState<(&mut A, &B)>, QueryState<(&mut A, &C)>)>) { + for (a, b) in set.q0().iter_mut() { + } +} +``` + +**Bevy 0.7** removes `QuerySet` in favor of `ParamSet`, which generalizes the QuerySet pattern for _any_ system parameter: + +```rust +fn system(mut set: ParamSet<(Query<(&mut A, &B)>, Query<(&mut A, &C)>)>) { + for (a, b) in set.p0().iter_mut() { + } +} +``` + +But ParamSets aren't just limited to Queries! Consider this example, where the `EventWriter` parameter (which internally accesses the `Events` resource) conflicts with the raw access to that resource. Previously, expressing this wouldn't be possible. But with ParamSets, it is! + +```rust +fn system(mut set: ParamSet<(EventWriter, ResMut>)>) { + for jump_event in set.p1().drain() { + } +} +``` + +We still recommend avoiding ParamSets where possible for clarity's sake. But every so often they are a necessary and useful tool! + +## Deref / DerefMut Derives + +
authors: @MrGVSV
+ +Rust encourages the use of the [newtype pattern](https://doc.rust-lang.org/rust-by-example/generics/new_types.html) when expanding a type with new functionality or meaning. This is also a useful tool in Bevy: + +```rust +#[derive(Component)] +struct Items(Vec); + +fn give_sword(mut query: Query<&mut Items>) { + for mut items in query.iter_mut() { + items.0.push(Item::new("Flaming Poisoning Raging Sword of Doom")); + } +} +``` + +This works just fine, but that `0` at the end of `items.0` sticks out like a sore thumb. Many of us in the Bevy Org think `.0` has no place in public apis. But the newtype pattern is still useful! Ideally, Rust would provide a way to express that `Items` is a new type, while transparently provided access to the `Vec` stored within. There are designs being discussed by the Rust team, but we don't want to wait for nice things! + +Fortunately, the Deref / DerefMut traits in std provide the behavior we want. Users can already manually implement these traits, but for such a common pattern, we decided that providing our own trait derives was worth it. In **Bevy 0.7**, you can now derive Deref and DerefMut, enabling much nicer public apis: + +```rust +#[derive(Component, Deref, DerefMut)] +struct Items(Vec); + +fn give_sword(mut query: Query<&mut Items>) { + for mut items in query.iter_mut() { + // No more .0! + items.push(Item::new("Flaming Poisoning Raging Sword of Doom")); + } +} +``` + +Astute `std` doc readers might notice that the Rust team [recommends only using `Deref`/`DerefMut` for smart pointers, to avoid confusion](https://doc.rust-lang.org/std/ops/trait.Deref.html). Components like `Items` are _not_ smart pointers. We choose to ignore this advice, as this pattern works, is already widely used in the Rust ecosystem, and Good UX Comes First. + +## WorldQuery Derives + +
authors: @mvlabat
+ +Sometimes when building Bevy Apps you might find yourself repeating the same sets of components over and over in your queries: + +```rust +fn move_players(mut players: Query<(&mut Transform, &mut Velocity, &mut PlayerStats)>) { + for (transform, velocity, stats) in players.iter_mut() { + } +} + +fn player_gravity(mut players: Query<(Entity, &mut Transform, &mut Velocity, &mut PlayerStats)>) { + for (entity, transform, velocity, stats) in players.iter_mut() { + } +} +``` + +Maybe you've gotten tired of typing the same components over and over. In **Bevy 0.7**, you can now easily create your own custom [`WorldQuery`] trait implementations with the [`WorldQuery`] derive: + +```rust +#[derive(WorldQuery)] +struct PlayerMovementQuery<'w> { + transform: &'w mut Transform, + velocity: &'w mut Velocity, + stats: &'w mut PlayerStats, +} + +fn move_players(mut players: Query) { + for player in players.iter_mut() { + } +} + +fn player_gravity(mut players: Query<(Entity, PlayerMovementQuery)>) { + for (entity, player) in players.iter_mut() { + } +} +``` + +[`WorldQuery`]: http://docs.rs/bevy/0.7.0/bevy/ecs/query/trait.WorldQuery.html + +## World::resource + +
authors: @alice-i-cecile
+ +We've noticed that the majority of direct [`World`] resource access immediately unwraps the results of `get_resource`: + +```rust +let time = world.get_resource::