🎆 Bevy Hanabi
🎆 Hanabi — a GPU particle system for the Bevy game engine.

Overview
The Hanabi particle system is a modern GPU-based particle system for the Bevy game engine. It focuses on scale to produce stunning visual effects (VFX) in real time, offloading most of the work to the GPU, with minimal CPU intervention. The design is inspired by modern particle systems found in other industry-leading game engines.
🚧 This project is under heavy development, and is currently lacking both features and performance / usability polish. However, for moderate-size effects, it can already be used in your project. Feedback and contributions on both design and features are very much welcome.
🎆 Hanabi makes heavy use of compute shaders to offload work to the GPU in a performant way. Support for compute shaders on the wasm target (WebAssembly) is available as of v0.13 (Bevy 0.14), and only through WebGPU. See the WebAssembly support documentation for details.
Usage
The 🎆 Bevy Hanabi plugin is compatible with Bevy versions >= 0.6; see Compatible Bevy versions.
Add the dependency
Add the bevy_hanabi dependency to Cargo.toml:
[]
= "0.18"
See also Features below for the list of supported features.
System setup
Add the HanabiPlugin to your app:
use *;
default
.add_plugins
.add_plugins
.run;
Create an effect asset
Create an EffectAsset describing a visual effect:
Spawn a particle effect
Use a ParticleEffect to create an effect instance from an existing asset.
commands.spawn;
Examples
See the examples/ folder.
A web demo (using the WebAssembly target) showing all examples is availabe in the examples/wasm/ folder. You can open index.html in any browser to see a GIF of all the examples. Running the actual WebAssembly example however requires serving the files with an HTTP server. If you have NodeJS installed, you can do that for example by running npx http-server examples/wasm.
Note for Linux users: The examples build with the bevy/x11 feature by default to enable support for the X11 display server. If you want to use the Wayland display server instead, add the bevy/wayland feature.
Feature List
This list contains the major fixed features provided by 🎆 Hanabi. Beyond that, with the power of the Expressions API, visual effect authors can further customize their effects by assigning individual particle attributes (position, color, etc.).
- Spawn
- Constant rate
- One-time burst
- Repeated burst
- Spawner resetting
- Spawner activation/deactivation
- Randomized spawning parameters
- Initialize
- Constant position
- Position over shape
- cube
- circle
- sphere
- cone / truncated cone (3D)
- plane
- generic mesh / point cloud (?)
- Random position offset
- Velocity over shape (with random speed)
- circle
- sphere
- tangent
- Constant/random per-particle color
- Constant/random per-particle size
- Constant/random par-particle age and lifetime
- Update
- Simulation condition
- Always, even when hidden
- Only when visible
- Motion integration (Euler)
- Apply forces and accelerations
- Constant acceleration (gravity)
- Radial acceleration
- Tangent acceleration
- Force field
- Linear drag
- Collision
- Shape
- plane
- cube
- sphere
- Depth buffer
- Shape
- Allow/deny despawn box
- Lifetime
- Size change over lifetime
- Color change over lifetime
- Simulation condition
- Render
- Quad
- Textured
- Generic 3D mesh
- Deformation
- Stretch alongside velocity
- Trails / Ribbons
- Camera support
- Size and orient particles
- Face camera (Billboard)
- Face constant direction
- Orient alongside velocity
- Screen-space size (projection independent)
- Quad
- Debug
- GPU debug labels / groups
- Debug visualization
- Position magnitude
- Velocity magnitude
- Age / lifetime
Features
🎆 Bevy Hanabi supports the following cargo features:
| Feature | Default | Description |
|---|---|---|
2d |
✔ | Enable rendering through 2D cameras (Camera2d) |
3d |
✔ | Enable rendering through 3D cameras (Camera3d) |
serde* |
✔ | Use serde to derive Serialization and Deserialization on asset-related types. |
(*) serde is not compatible with WASM (due to the typetag dependency not being available on wasm without extra setup).
For optimization purpose, users of a single type of camera can disable the other type by skipping default features in their Cargo.toml. For example to use only the 3D mode:
= { = "0.18", = false, = [ "3d", "serde" ] }
Compatible Bevy versions
The main branch is compatible with the latest Bevy release.
Compatibility of bevy_hanabi versions:
bevy_hanabi |
bevy |
|---|---|
0.18 |
0.18 |
0.17 |
0.17 |
0.16 |
0.16 |
0.14-0.15 |
0.15 |
0.12-0.13 |
0.14 |
0.10-0.11 |
0.13 |
0.8-0.9 |
0.12 |
0.7 |
0.11 |
0.6 |
0.10 |
0.5 |
0.9 |
0.3-0.4 |
0.8 |
0.2 |
0.7 |
0.1 |
0.6 |
License
🎆 Hanabi is dual-licensed under either:
- MIT License (
LICENSE-MITor http://opensource.org/licenses/MIT) - Apache License, Version 2.0 (
LICENSE-APACHE2or http://www.apache.org/licenses/LICENSE-2.0)
at your option.
SPDX-License-Identifier: MIT OR Apache-2.0