A general purpose 2d lighting plugin for bevy
.
Designed to be simple to use, yet expressive enough to fit a variety of needs.
- Component driven design
- Configurable point lights
- Camera specific ambient light
- Single camera rendering
In the basic
example, all we need is the plugin, a camera, and a light source.
# Cargo.toml
[dependencies]
bevy = "0.13"
bevy_light_2d = "0.1"
use bevy::prelude::*;
use bevy_light_2d::prelude::*;
fn main() {
App::new()
.add_plugins((DefaultPlugins, Light2dPlugin))
.add_systems(Startup, setup)
.run()
}
fn setup(mut commands: Commands) {
commands.spawn(Camera2dBundle::default());
commands.spawn(PointLight2dBundle {
point_light: PointLight2d {
radius: 100.0,
intensity: 3.0,
..default()
},
..default()
});
}
When I first started experimenting with Bevy, the lack of a first party 2d lighting implementation left me wanting. While there were some rather impressive experimental 2d lighting crates out there, there wasn't much in the way of drop in options available.
My goal with this crate is to fill that void, prioritizing ease of use and general application over depth of features.
- Light occluders + shadows
- Sprite lights
bevy | bevy_light_2d |
---|---|
0.13 | 0.1 |
I'd like to thank the authors of the below crates; they were a significant source of inspiration.