Animation Events, Curves, and no_std
2024-10-14
According to my notes there were over 100 PRs merged last week which represents a truly incredible effort by the community to get ready for the 0.15 release candidates.
0.15 is really shaping up to be a stellar release including Required Components, new Animation and Curve APIs, and more.
There's a whole lot to get into this week so let's start with some new rendering functionality.
Order Independent Transparency
#14876 introduces Order Independent Transparency as an alternative to alpha blending. Alpha blending is achieved by sorting the geometry of a scene and allowing each to contribute, in that sorted order, color to the scene. Order Independent Transparency instead sorts per-pixel which can result in solving situations in which alpha blending fails.
This is a two-pass technique and the code is well documented with comments so if you're interested in digging into the lower levels of rendering definitely give this PR a read.
Foresight is a production Bevy user that has been using this implementation in production for months now without issue.
Screen Shake
A new 2d_screen_shake
example takes inspiration from Math for Game Programmers: Juicing Your Cameras With Math and implements a 2d screen shake example!
cargo run --example 2d_screen_shake
New Image APIs
A number of new functions for operating on Image
in terms of pixels were added in #10392. These include:
pixel_data_offset
pixel_bytes
/pixel_bytes_mut
get_color_at
/get_color_at_1d
/get_color_at_3d
set_color_at
/set_color_at_1d
/set_color_at_3d
A new example cpu_draw
shows off drawing a spiral pattern with the new APIs.
cargo run --example cpu_draw
Required Components
The followup work to Required Components is ongoing.
Another set of Required Components PRs went in this week as well including:
As of #15796 the Component
implementation has now been removed from Handle
. The API changes to enable this were already made in previous Required Components PRs.
Retained Render world
The recently merged retained render world means that entity ids aren't the same anymore between the main world and the render world. #15582 introduces a new SyncComponentPlugin<C: Component>
which uses the Required Components behavior to add SyncToRenderWorld
as a Required Component for the specified component C
. The plugin also adds a component hook that will clear all components from the render world entity when C
is removed.
#15756 also makes the retained render world a bit more type safe, especially when dealing with main world entity id keys in collections used in the render world.
Animation Events
#15538 introduces the ability to trigger events via AnimationClip
. Use cases for this include playing sounds when a characters feet touch the ground, triggering projectiles at the right time, and more.
running_animation.add_event_to_target(
feet.front_left,
0.625,
OnStep
);
The animated_fox
example has been updated to use events and a new animation_events
example shows off a smaller use case.
Curves
In #15675 common interpolations were added. A new example was added to showcase the ease functions in 15703.
Macos Window Options
#15820 adds the ability to specify additional window options that only exist on macos, such as making the title bar transparent.
More tools for hierarchies
In 0.14 HierarchyQueryExt
powers the ability to iterate over descendants and ancestors with Query
and in #15627 that expands the trait to include
parent
children
root_parent
iter_leaves
iter_siblings
iter_descendants_depth_first
Text Rework
The way spans of text are structured has changed and #15591 showcases that. The new way to update spans of text (which are now entities themselves) looks like this:
fn refresh_text(
query: Query<Entity, With<TimeText>>,
mut writer: UiTextWriter,
time: Res<Time>
) {
let entity = query.single();
*writer.text(entity, 1) = format_time(time.elapsed());
}
no_std
Bevy's no_std support is growing, and as a result its nice to make sure the improvements being made are kept. A new CI tool was introduced in #15843 to make sure crates that have been made no_std do actually compile for a no_std environment.
Alice's Merge Train is a maintainer-level view into active PRs, both those that are merging and those that need work.
Showcase
Bevy work from the #showcase channel in Discord and around the internet. Use hashtag #bevyengine.
Disco Elysium + Yarn Spinner
showcase
This is a disco elysium inspired UI for Yarn Spinner dialogue.
no_std Bevy
showcase
700+ FPS in this no_std demonstration Bevy UEFI app. If the prospect of no_std
Bevy interests you, consider checking out the tracking issue for details on how far away this is from release!
Bevy + The Lightmapper
showcase
The author of The Lightmapper has been working on an example Bevy scene while adjusting The Lightmapper to have better support for KTX files (which Bevy supports).
Rusty Lander 0.7
showcase
Rusty Lander added new graphics like background terrain and a new spaceship as well as functionality and bug fixes like increasing the gravity after each successful landing and out of fuel messages. It also now has a Windows build.
Solar System Simulation
showcase
This solar system simulation now includes a scenario system, a built-in editor, and support for SPICE files. In the scenario system, you can create, edit and launch different compositions of bodies, or re-create missions like Voyager-1, while SPICE files contain planetary body data from NASA.
work-in-progress procedural mesh editor
showcase
This demo shows off bevy_copperfield
, which is an in-progress procedural mesh editor made with Bevy in mind. Once added as a dependency, bevy's 3D primitives will be available to be turned into editable mesh with a procgen
command. From there you can extrude, chamfer, and move around any part of the mesh
Polder
showcase
Bevy's 0.12 release header image included a video of a tiny planet city builder temporarily called Polder. The author also spoke about the implementation at the 4th unofficial Bevy meetup: Recreating Townscaper using Rust & Bevy.
The city builder is slowly growing into a larger game and recently gained a controllable character.
Crates
New releases to crates.io and substantial updates to existing projects
haalka 0.2
crate_release
haalka is a reactivity library powered by the FRP signals of futures-signals. It is a port of the web UI libraries MoonZoon and Dominator and offers the same signal semantics as a thin layer on top of bevy_ui. While haalka is primarily targeted at UI and provides high level UI abstractions as such, its core abstraction can be used to manage signals-powered reactivity for any entity, not just bevy_ui nodes.
haalka 0.2 brings Bevy 0.14 support, a migration to observers, a new component-driven API and more you can read in the changelog
bevy_tnua 0.20
crate_release
bevy_tnua is a floating character controller that can be used in 2d and 3d environments, and can use avian or rapier for physics. bevy_tnua 0.20 brings a new TnuaBuiltinKnockback
action for applying a knockback effect to the character as well as changing the "up" direction to be determined by the gravity instead of being fixated to positive Y.
bevy_pixelmap
crate_release
bevy_pixelmap
is "an infinite pixel grid that you can edit really fast.", which is meant to drive games similar to Noita
bevy_debug_log
crate_release
bevy_debug_log enables viewing the tracing debug log output inside your app - particularly on platforms like mobile where you have no easy way to follow the terminal output. It uses bevy_ui to display the logs, so no additional dependencies are required.
Bevy Entitiles 0.11.0
crate_release
A 2d tilemap library for bevy. With many useful algorithms/tools built in.
0.11 brings a switch to avian2d for physics as well as a number of bug fixes from a refactor. Wasm is currently not supported but its a priority for the next releases.
i-cant-believe-its-not-bsn
crate_release
Are you waiting to see what bsn! is going to be like? Me too. In the meantime check out i-cant-believe-its-not-bsn
which is a convenient way to spawn hierarchies of entities from a single bundle that also works with required components!
fn spawn_with_child(mut commands: Commands) -> Entity {
commands.spawn((A, WithChild(B(5)))).id()
}
leafwing-input-manager 0.15.1
crate_release
leafwing-input-manager 0.15.1 brings TripleAxislike
inputs, an attribute macro for your Actionlike
types and bug fixes galore.
Don't trigger animation events when paused 2 authored by atornity
simplify adding headers and improve consistency for RemoteHttpPlugin authored by spacemen0
Fix transparent_window example on wayland authored by mahkoh
Add scene summary authored by wduminy
Don't trigger animation events when paused authored by atornity
Inverse bevy_render bevy_winit dependency and move cursor to bevy_winit authored by KirmesBude
Add with_headers() method to RemoteHttpPlugin authored by spacemen0
Split out bevy_mesh from bevy_render authored by atlv24
Add Support for Triggering Events via `AnimationEvent`s authored by atornity
Fix wrong link in error authored by vladinator1000
Fix doc comment authored by tom-frantz
Rename the `Pickable` component and fix incorrect documentation authored by tim-blackbird
Spelling authored by LiamGallagher737
Fixes to animation graph evaluation authored by mweatherley
Add `Image` methods for easy access to a pixel's color authored by inodentry
Add more tools for traversing hierarchies authored by alice-i-cecile
Add most common interpolations authored by mockersf
Use global clear color for camera driver node. authored by tychedelia
Deprecate `get_or_spawn` authored by Trashtalk217
Migrate bevy picking authored by ecoskey
Fix a system ordering issue with motion blur for skinned meshes. authored by pcwalton
Feature-gate all image formats authored by clarfonthey
Allow `World::entity` family of functions to take multiple entities and get multiple references back authored by ItsDoot
add example for ease functions authored by mockersf
Add new crates to publish.sh authored by atlv24
fix some of the ease functions from interpolation authored by mockersf
Screen shake example authored by moOsama76
Stop using `Handle<T>` as a component in `bevy_gizmos` authored by tim-blackbird
Fix `query_gltf_primitives` example authored by tim-blackbird
Curves: `FromReflect` boogaloo part 2 authored by mweatherley
Serialize and deserialize tuple struct with one field as newtype struct authored by notmd
bevy_ecs: Replace panics in `QueryData` derive compile errors authored by MrGVSV
Synchronize removed components with the render world authored by kristoff3r
Improved text batching authored by ickshonpe
Use shader_def for oit resolve layer count authored by IceSentry
Fix failing ` cargo check` with only the bevy_dev_tools feature authored by papow65
easing_functions example: draw point closer to its curve authored by mockersf
Replace `Handle<AnimationGraph>` component with a wrapper authored by tim-blackbird
Ensure Bevy's rendering byte usage is little-endian authored by chompaa
fix: Skip some rendering logics when the viewport width or height is zero authored by ShoyuVanilla
fix: `register_type::<ScrollPosition>` authored by mrchantey
Add the functions `start_drag_move` and `start_drag_resize` to `Window` authored by IsseW
Add Order Independent Transparency authored by IceSentry
Fix `shader_prepass` example authored by tim-blackbird
Migrate bevy_sprite to required components authored by ecoskey
Fix meshlet materials authored by Jondolf
Rename `App/World::observe` to `add_observer`, `EntityWorldMut::observe_entity` to `observe`. authored by ItsDoot
Remove `thiserror` from `bevy_asset` authored by bushrat011899
Remove `thiserror` from `bevy_pbr` authored by bushrat011899
Remove `thiserror` from `bevy_sprite` authored by bushrat011899
Remove `thiserror` from `bevy_scene` authored by bushrat011899
Remove `thiserror` from `bevy_text` authored by bushrat011899
Remove `thiserror` from `bevy_transform` authored by bushrat011899
Remove `thiserror` from `bevy_ui` authored by bushrat011899
Remove `thiserror` from `bevy_reflect` authored by bushrat011899
Remove `thiserror` from `bevy_render` authored by bushrat011899
Put curve-related stuff behind a feature authored by mweatherley
Remove `Handle<T>` trait implementations that are dependent on `Component` authored by tim-blackbird
bevy_reflect: Add crate level `functions` feature docs authored by nixpulvis
promote atlas sources texture_ids to pub visibility authored by brandon-reinhart
Text rework authored by UkoeHB
Add `World::get_resource_or_init` as an alternative to `World::get_resource_or_insert_with` authored by ItsDoot
Remove the `Component` trait implementation from `Handle` authored by tim-blackbird
Improvements .gitignore authored by LoweredgamesDev
Rename TextBlock to TextLayout authored by UkoeHB
Dark text colors fix authored by ickshonpe
Add `register_type` for `UiAntiAlias` authored by ickshonpe
Remove `thiserror` from `bevy_app` authored by bushrat011899
Migrate reflection probes to required components authored by Jondolf
bevy_scene: Use `FromReflect` on extracted resources authored by MrGVSV
Remove `thiserror` from `bevy_image` authored by bushrat011899
Add `register_type` for `UiMaterialHandle` and `AnimationGraphHandle` authored by tim-blackbird
Remove `thiserror` from `bevy_time` authored by bushrat011899
Remove eprintln from `2d_screen_shake` example authored by rparrett
Fix missing Msaa::Off in scrolling_fog example authored by jirisvd
Remove `thiserror` from `bevy_animation` authored by bushrat011899
Remove `thiserror` from `bevy_color` authored by bushrat011899
Remove `thiserror` from `bevy_core_pipeline` authored by bushrat011899
Remove `thiserror` from `bevy_ecs` authored by bushrat011899
Remove `thiserror` from `bevy_gilrs` authored by bushrat011899
Remove `thiserror` from `bevy_gltf` authored by bushrat011899
Remove `thiserror` from `bevy_input` authored by bushrat011899
Remove `thiserror` from `bevy_math` authored by bushrat011899
Remove `thiserror` from `bevy_mesh` authored by bushrat011899
Fix auto_exposure example authored by rparrett
Fix sprite and picking examples authored by Jondolf
Fix mesh flags authored by ecoskey
Update multi_asset_sync.rs authored by foxzool
Fix OIT shaders error with DX12 backend authored by akimakinai
Type safe retained render world authored by tychedelia
Fix invalid scene file for `scene` example authored by rparrett
Make `AnimatableCurve::curve` public authored by mweatherley
Fix broken mesh2d authored by tychedelia
Picking: Filter out invisible sprites early authored by akimakinai
Fix gizmos authored by tim-blackbird
Fix formatting of `irradiance_volumes` example instructions authored by rparrett
Fix `loading_screen` example authored by rparrett
bevy_ecs: Special-case `Entity::PLACEHOLDER` formatting authored by MrGVSV
Use oslog for ios authored by therealbnut
Add `compile-check-no-std` Command to CI Tool authored by bushrat011899
Fix `println` in `morph_targets` example authored by rparrett
Fix `motion_blur` example instructions authored by rparrett
Fix `minimising` example minimizing every frame authored by rparrett
Fix potential deadlock in `AssetServer` on single-threaded modes. authored by andriyDev
Fix panic in `gamepad_viewer` example when gamepad is connected authored by rparrett
Add `bevy_window::Window` options for MacOS authored by aecsocket
Some animation doc improvements authored by mweatherley
Remove a `dbg!` statement left over from debugging authored by LiamGallagher737
Want to contribute to Bevy?
Here you can find two types of potential contribution: Pull Requests that might need review and Issues that might need to be worked on.
Pull Requests Opened this week
improve sub view example with dynamic viewports authored by m-edlund
Read back full screen state from window on macOS authored by coreh
Add some missing features from the gamepads-as-entities change that were needed to update `leafwing-input-manager`. authored by pcwalton
Simplified easing curves authored by mweatherley
Vary transforms for custom_skinned_mesh example authored by shanecelis
Add methods for getting Image pixel rects authored by clarfonthey
Add `insert_batch` and variations authored by JaySpruce
Observed entity query data fetching: `Trigger<FooEvent, (), (&mut Foo, &Bar)>` authored by ItsDoot
Filter UI traversal to only Node and GhostNode authored by villor
Implement `WorldQuery` for `MainWorld` and `RenderWorld` components authored by alice-i-cecile
Ray Casting for Primitive Shapes authored by Jondolf
Update hashbrown to 0.15 authored by clarfonthey
Add mesh picking backend and `MeshRayCast` system parameter authored by Jondolf
Upgrade to Taffy 0.6 authored by nicoburns
Deprecate SpatialBundle authored by NiseVoid
add AsVal trait that helps with constructing Val authored by TotalKrill
fix: removed WinitPlugin from headless_renderer example authored by cxreiff
Add window drag move and drag resize without decoration example. authored by shanecelis
Arc-ed assets authored by andriyDev
Move `ImageLoader` and `CompressedImageSaver` to `bevy_image`. authored by andriyDev
Add `Trigger::components`, which lists the component targets that were triggered authored by ItsDoot
Add `no_std` Support to `bevy_math` authored by bushrat011899
Introduce methods on QueryState to obtain a Query authored by chescock
split up `TextStyle` authored by ickshonpe
Skip bloom rendering if HDR is disabled authored by akimakinai
Store `QueryState` in `Query` as a `Cow` and remove distinct `QueryLens` type authored by ItsDoot
Meshlet new error projection authored by JMS55
fix spatial audio examples authored by awtterpip
fix mesh2d_manual example authored by awtterpip
Time<Real> documentation improvement authored by BenjaminBrienen
`spirv_shader_passthrough` must enable `wgpu/spirv` authored by BenjaminBrienen
Migrate from `Query::single` and friends to `Single` authored by pablo-lua
examples(shaders/glsl): Update GLSL Shader Example Camera View uniform authored by jakeswenson
Issues Opened this week
`ReflectBundle::remove` should return the removed `ReflectBundle` authored by alice-i-cecile
Use u64 for change ticks authored by richchurcher
Stop using `Handle<MeshletMesh>` as a component authored by tim-blackbird
Stop using `Handle<AnimationGraph>` as a component authored by tim-blackbird
Remove `Component` trait impl from `Handle<T>` authored by tim-blackbird
Reflection is not symmetrical authored by UkoeHB
wgpu error when setting Viewport::physical_position value for a Camera authored by moOsama76
Support FBX file loading authored by tbillington
Deprecate and remove insert_or_spawn_batch authored by alice-i-cecile
Example `custom_shader_instancing` cannot be run authored by ciaochaos
Ensure Bevy's rendering byte usage is little-endian authored by alice-i-cecile
Meaning of the `EnvironmentMapLight` component is unclear authored by alice-i-cecile
Add drag move example authored by alice-i-cecile
WARN Duplicate AssetLoader preregistered for Asset type `bevy_image::image::Image` with extensions `["hdr"]`. when run breakout example authored by C-Entropy
alien_cake_addict example lighting issues authored by LiamGallagher737
Transition animations for UI elements authored by viridia
Arc-ed assets authored by andriyDev
Creating multiple apps with RenderPlugin enabled during benchmark with Criterion causes create authored by hukasu
Stop using `Handle<T: UiMaterial>` as a component authored by tim-blackbird
Change detection for text is more painful after text rework authored by alice-i-cecile
Revert default mesh material authored by alice-i-cecile
Ease migration for `OrthographicProject::ScalingMode` change authored by alice-i-cecile
macos: `anti_aliasing` example crashes when MSAA is set to 8 samples authored by rparrett
Support for low-level virtual input authored by khassar00
iOS prefersHomeIndicatorAutoHidden() authored by kraftwer1
sub app cannot run as the official example suggested authored by RamonBrisk
`spatial_audio_2d` and `spatial_audio_3d` examples: emitter jumps when movement is unpaused authored by rparrett
Make methods on `Time`, `Timer`, and `Stopwatch` more consistent authored by rparrett
Expanded examples in relation to texture atlases and sprite sheets to show how to use it in other systems authored by teenangst
UI Layout Or Size Can Seem To Shift Unnecessarily Post-Creation authored by TrialDragon
Are the `random_sampling` and `sampling_primitives` examples redundant? authored by rparrett
`render_primitives` example panics when changing cameras authored by rparrett
macos: `clearcoat` and `rotate_environment_map` examples panic authored by rparrett
Ignore a type when registered authored by BenjaminBrienen
Nightly CI detects new dead code lints in benchmarks authored by alice-i-cecile
`mesh2d_manual` example doesn't render correctly authored by rparrett
`pbr` example is missing one of it labels authored by rparrett
Rename `StateScoped` to `StateExitDespawn`, add the inverse variant `StateEntryDespawn` authored by Jaso333
Access registered systems. authored by Phoqinu
CI workflow for breaking changes needs to be updated to match the new label authored by alice-i-cecile
Add support for multiview cameras authored by awtterpip
Replace all uses of `Query::single` with `Single` authored by alice-i-cecile
Compilation Error of accesskit_macos when compiling bevy authored by NightProg
Add ChildBuilder::spawn_batch authored by papow65
Conditional extraction to render world can cause desync authored by akimakinai