berdicles
Expressive CPU particle system for the bevy engine.
Feature Set
- Instancing based CPU particles.
- Expressive non-physics based particle traits.
- Familiar setup with bevy's native
MaterialandMesh. - Particles as emitters.
- Mesh based particle trails.
- Particle events that spawns other particles.
- Multiple renders from the same simulation result via
ParticleRef. - Billboard particles.
Non-features
- GPU simulation.
- SIMD and similar optimizations.
- First party physics support.
Basically the crates trades some potential optimizations for expressiveness.
Getting Started
Add a ParticleSystemBundle, which is a MaterialMeshBundle with a ParticleInstance.
- Huh?
First we need to add ParticleMaterialPlugin, not MaterialPlugin, which sets up a different render pipeline.
We only use vertex_shader() and fragment_shader() from Material so the rest can be ignored.
This uses the mesh as the particle shape and the shader for instancing. The StandardParticle is already setup
in this crate, but you can define your own Material by referencing this shader's source code.
To create a ParticleInstance we need a ParticleSystem trait implementor and a Particle that it spawns.
Trait Based Particles
Physics based particles is commonly seen in most particle system implementations, but they might be frustrating to work with in some situations. We provide alternative ways to implement particles, instead of defining things as velocities, forces or curves.
Sub-particle Systems
SubParticleSystem uses a parent particle system's particles as spawners for other particles.
- Add
ParticleParent(Entity)to point to a parent - Add the downcast function
as_sub_particle_systemto yourParticleSystemimplementation.
Yes you can chain these infinitely.
Event Particle Systems
EventParticleSystem can listen to events like particle despawning or colliding and spawn particles on events.
- Add
ParticleParent(Entity)to point to a parent - Add
ParticleEventBufferto the parent to record these events, - Add the downcast function
as_event_particle_systemto yourParticleSystemimplementation.
Trail Rendering
We can render trails behind particles as mesh.
- Implement
TrailedParticleon your particle. - Add
on_update,detach_sliceandas_trail_particle_systemto yourParticleSystemimplementation. - Add
TrailMeshOf(Entity)to aMaterialMeshBundleto render them.
Versions
| bevy | berdicles |
|---|---|
| 0.14 | latest |
License
Licensed under either of
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.
Contribution
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.