zaycev / bevy-magic-light-2d

Experiment with computing 2D shading, lighting and shadows with Bevy Engine
Apache License 2.0
427 stars 37 forks source link
# 🔮 Magic Light 2D – experimental dynamic 2D global illumination system for Bevy Engine. [![Build status](https://github.com/zaycev/bevy-magic-light-2d/workflows/PR/badge.svg?branch=main)](https://github.com/zaycev/bevy-magic-light-2d/actions) [![dependency status](https://deps.rs/repo/github/zaycev/bevy-magic-light-2d/status.svg)](https://deps.rs/repo/github/zaycev/bevy-magic-light-2d)
[![Discord](https://assets-global.website-files.com/6257adef93867e50d84d30e2/636e0b5061df29d55a92d945_full_logo_blurple_RGB.svg)](https://discord.gg/jarl) (ping me if it expires)

🚧 Beware! This repo is heavily under construction and a lot of things may change.

Experimental dynamic 2D global illumination system for Bevy, based on SDF ray-marching and screen space irradiance cache probes.

Demo

cargo run --example minimal
cargo run --example krypta
cargo run --example movement

Bevy Magic Light 2D – Demo

Implementation is based on several approaches:

The main performance gain is coming from computing value of only 1 / 64 number of pixels (for 8x8 probe size). The rest of the pixels are interpolated from the nearest probes.

Usage

cargo run --example krypta

TODOs

Optimizations

Features

Address limitations

Others

License

Copyright 2022, 2023 Vladimir Zaytsev <vladimir@xyzw.io>

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.