Skip to content

Latest commit

 

History

History
94 lines (64 loc) · 3.9 KB

README.md

File metadata and controls

94 lines (64 loc) · 3.9 KB

bevy-baked-gi

Tooling to support precomputed global illumination for the Bevy game engine.

Introduction

This crate, bevy-baked-gi, provides a workflow for baked global illumination in Bevy, using three well-established techniques: lightmapping, irradiance volumes, and reflection probes. Global illumination enhances the realism of rendered scenes by modeling the effects of multiple light bounces; as a simple example, GI allows objects next to a red wall to appear red. Generally, GI is expensive to simulate, so a popular technique is to precompute the lighting for static elements of a scene to allow for fast approximation of global illumination at runtime. This crate provides straightforward Bevy tooling to support these three common methods.

It's important to note that neither this crate nor Bevy itself provides any built-in lightmapper. You'll need to precompute the lightmaps for your scenes using a tool external to Bevy. Fortunately, bevy-baked-gi provides a convenient tool, export-blender-gi, that allows for the use of Blender (optionally with The Lightmapper addon) to bake global illumination.

Tooling

The following tools may be useful for baking global illumination.

The export-blender-gi CLI tool

bevy-baked-gi comes with a command-line tool called export-blender-gi that you can apply to a Blender .blend file to convert baked irradiance volumes and cube reflection probes from Blender's native format into a native Bevy .scn.ron asset. For cubemap reflection probes, the tool uses a fork of the glTF IBL Sampler to preprocess the cubemap images into diffuse and specular parts, so they can be used just as environment maps are used in Bevy.

Note that you must bake the light probes before the tool is able to export them. In the Eevee renderer, use the button "Render → Indirect Lighting → Bake Indirect Lighting".

The "Bevy Global Illumination Export" Blender add-on

An artist-friendly UI wrapping the above export-blender-gi tool is available as a Blender add-on. To install it, navigate to "Preferences → Add-ons → Install…" and open the BlenderAddons/export-bevy-gi/export-bevy-gi.py script. In the add-on preferences, locate the pre-built export-blender-gi or export-blender-gi.exe. You can then export baked irradiance volumes and cube reflection probes with the "File → Export → Bevy Global Illumination (.scn.ron)" menu item. You'll need to bake the light probes (in Eevee, "Render → Indirect Lighting → Bake Indirect Lighting") and save the .blend file first.

glTF Unity Lightmapper

Within the UnityAssets directory there is an experimental Unity plugin to allow for using Unity's Progressive Lightmapper (or another tool, like Bakery) to bake the lighting for scenes. Please note that this plugin is highly experimental.

Other tools

In case you want to bake the lightmaps using a tool other than Blender and Unity, a detailed description of the lightmap and irradiance volume format is available in the Bevy documentation.

License

Dual-licensed under the MIT and Apache 2.0 license. See the LICENSE-MIT and LICENSE-APACHE2 files.

Code of conduct

bevy-baked-gi follows the same code of conduct as Rust itself. Reports can be made to the project authors.