Expand description
§berdicles
Instancing and projectile system for bevy.
§Use cases
Despite the name, berdicles
can do pretty much anything related to instancing,
for example render the same material with different colors.
The crate can create VFX such as particle systems, spawn hair or grass, manage projectile events, etc.
§Feature Set
- Instancing based particles.
- Fully support bevy’s mesh and material system.
- Custom shaders and instance buffers.
- Emit projectiles from parent projectiles.
- Mesh based projectile trails.
- Projectile events that spawn other particles, i.e. explosion.
- Multiple renders from the same simulation result via
ProjectileRef
. - Billboard rendering.
Non-features
- GPU simulation.
- SIMD.
§Getting Started
Add a ProjectileCluster
, Mesh3d
and InstancedMaterial3d
to an entity.
To create a ProjectileCluster
we need a ProjectileSystem
trait implementor and
a Projectile
type that it can spawns.
See the examples folder for more information.
§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.
impl Particle for SpiralParticle {
fn update(&mut self, dt: f32) {
self.lifetime += dt;
}
fn get_transform(&self) -> Transform {
Transform::from_translation(
Vec3::new(self.lifetime, 0., 0.)
).with_rotation(
Quat::from_rotation_y(self.lifetime)
)
}
fn expiration_state(&self) -> ExpirationState{
ExpirationState::explode_if(self.lifetime > 8.)
}
}
§Comparison with bevy_hanabi
berdicle
is more of a projectile system since we have more control
over the simulation and the render pipeline.
Events can be easily extracted from berdicles
due to this fact. However,
for most VFX with no gameplay function,
bevy_hanabi
should be the superior choice.
§Versions
bevy | berdicles |
---|---|
0.14 | 0.1-0.2 |
0.15 | 0.3-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.
Modules§
- shader
- Shader module for
berdicles
. - templates
- trail
- Module for rendering trails.
- util
- Utility for implementing particles.
Structs§
- Default
Instance Buffer - Instance buffer of a particle.
- Despawn
Projectile Cluster - Remove the associated entity if all projectiles are despawned.
- Erased
Extract Buffer - Extended
Instanced Material - Extended version of a base
InstancedMaterial
usingInstancedMaterialExtension
. - Hair
Particles - A
ProjectileSystem
that spawns once and maintains a GPU side instance buffer, i.e. grass. - Instanced
Material3d - Component form of
InstancedMaterial
, provides a material forProjectileCluster
. - Instanced
Material Plugin - Add particle rendering pipeline for an
InstancedMaterial
. - Projectile
Buffer - Type erased buffer for particles.
- Projectile
Cluster - Component form of a type erased
ProjectileSystem
. - Projectile
Event - Event and data on an individual particle.
- Projectile
Event Buffer - A buffer of particle events. If added to a particle bundle, will record particle events happened
in this frame. Also enables
EventProjectileSystem
. - Projectile
Parent - Parent of the particle, if present will read data/event from the parent’s particle buffer.
- Projectile
Plugin - Plugin for
berdicle
. - Projectile
Ref - Create a cheap copy of a
ProjectileCluster
’s output to use with a different set of material and mesh. - Standard
Particle InstancedMaterial
that displays an unlit combination ofbase_color
andtexture
on a mesh.
Enums§
- Expiration
State - If and how a particle has expired.
- Particle
Buffer Strategy - Strategy for cleaning up particle buffers.
- Particle
Buffer Type - Type of particle buffer.
- Projectile
Event Type - Event on individual particle.
Traits§
- Erased
Event Particle System - Type erased
EventProjectileSystem
. - Erased
Particle System - Type erased version of
ProjectileSystem
. - Erased
SubParticle System - An erased
SubProjectileSystem
. - Event
Projectile System - A
ProjectileSystem
that spawns particles on parent’s emitted events. - Instanced
Material - Instanced
Material Extension - Projectile
- A
Projectile
. Must beCopy
and have alignment less than16
. - Projectile
Instance Buffer - Projectile
System - A particle spawner type.
- SubProjectile
System - A
ProjectileSystem
that spawns projectiles from a parentProjectileSystem
’s alive particles.
Functions§
- projectile_
simulation_ system - The main system of
berdicle
, runs inUpdate
.