bevy/crates
Patrick Walton dd14f3a477
Implement lightmaps. (#10231)
![Screenshot](https://i.imgur.com/A4KzWFq.png)

# Objective

Lightmaps, textures that store baked global illumination, have been a
mainstay of real-time graphics for decades. Bevy currently has no
support for them, so this pull request implements them.

## Solution

The new `Lightmap` component can be attached to any entity that contains
a `Handle<Mesh>` and a `StandardMaterial`. When present, it will be
applied in the PBR shader. Because multiple lightmaps are frequently
packed into atlases, each lightmap may have its own UV boundaries within
its texture. An `exposure` field is also provided, to control the
brightness of the lightmap.

Note that this PR doesn't provide any way to bake the lightmaps. That
can be done with [The Lightmapper] or another solution, such as Unity's
Bakery.

---

## Changelog

### Added
* A new component, `Lightmap`, is available, for baked global
illumination. If your mesh has a second UV channel (UV1), and you attach
this component to the entity with that mesh, Bevy will apply the texture
referenced in the lightmap.

[The Lightmapper]: https://github.com/Naxela/The_Lightmapper

---------

Co-authored-by: Carter Anderson <mcanders1@gmail.com>
2024-01-02 20:38:47 +00:00
..
bevy_a11y Add [lints] table, fix adding #![allow(clippy::type_complexity)] everywhere (#10011) 2023-11-18 20:58:48 +00:00
bevy_animation support all types of animation interpolation from gltf (#10755) 2023-12-31 18:01:50 +00:00
bevy_app Replace or document ignored doctests (#11040) 2024-01-01 16:50:56 +00:00
bevy_asset Replace or document ignored doctests (#11040) 2024-01-01 16:50:56 +00:00
bevy_audio Reorder impl to be the same as the trait (#11076) 2023-12-24 17:43:55 +00:00
bevy_core Replace or document ignored doctests (#11040) 2024-01-01 16:50:56 +00:00
bevy_core_pipeline Keep track of when a texture is first cleared (#10325) 2023-12-31 00:37:37 +00:00
bevy_derive Reexport winit::platform::android::activity::* in bevy_winit (#11011) 2023-12-19 20:15:03 +00:00
bevy_diagnostic Replace or document ignored doctests (#11040) 2024-01-01 16:50:56 +00:00
bevy_dylib Add [lints] table, fix adding #![allow(clippy::type_complexity)] everywhere (#10011) 2023-11-18 20:58:48 +00:00
bevy_dynamic_plugin Add [lints] table, fix adding #![allow(clippy::type_complexity)] everywhere (#10011) 2023-11-18 20:58:48 +00:00
bevy_ecs impl ExclusiveSystemParam for SystemName (#11163) 2024-01-01 17:08:29 +00:00
bevy_ecs_compile_fail_tests Rename WorldQueryData & WorldQueryFilter to QueryData & QueryFilter (#10779) 2023-12-12 19:45:50 +00:00
bevy_encase_derive Add [lints] table, fix adding #![allow(clippy::type_complexity)] everywhere (#10011) 2023-11-18 20:58:48 +00:00
bevy_gilrs Remove unnecessary path prefixes (#10749) 2023-11-28 23:43:40 +00:00
bevy_gizmos Reorder impl to be the same as the trait (#11076) 2023-12-24 17:43:55 +00:00
bevy_gltf support all types of animation interpolation from gltf (#10755) 2023-12-31 18:01:50 +00:00
bevy_hierarchy Add bevy_hierarchy Crate and plugin documentation (#10951) 2024-01-02 19:40:14 +00:00
bevy_input Add window entity to TouchInput events (#11128) 2024-01-02 03:03:05 +00:00
bevy_internal Remove unnecessary path prefixes (#10749) 2023-11-28 23:43:40 +00:00
bevy_log Print to stderr from panic handler in LogPlugin (#11170) 2024-01-01 17:10:20 +00:00
bevy_macro_utils Replace or document ignored doctests (#11040) 2024-01-01 16:50:56 +00:00
bevy_macros_compile_fail_tests Standardize toml format with taplo (#10594) 2023-11-21 01:04:14 +00:00
bevy_math Add approx feature to bevy_math (#11176) 2024-01-02 18:10:44 +00:00
bevy_mikktspace Replace calculation with function call (#11077) 2023-12-23 17:32:26 +00:00
bevy_pbr Implement lightmaps. (#10231) 2024-01-02 20:38:47 +00:00
bevy_ptr Simplify equality assertions (#10988) 2023-12-16 23:58:41 +00:00
bevy_reflect Replace or document ignored doctests (#11040) 2024-01-01 16:50:56 +00:00
bevy_reflect_compile_fail_tests Fix nested generics in Reflect derive (#10791) 2023-11-29 01:46:09 +00:00
bevy_render Fix Mesh::ATTRIBUTE_UV_0 documentation (#11110) 2024-01-01 16:58:48 +00:00
bevy_scene Rename ArchetypeEntity::entity into ArchetypeEntity::id (#11118) 2024-01-01 16:12:24 +00:00
bevy_sprite Export tonemapping_pipeline_key (2d), alpha_mode_pipeline_key (#11166) 2024-01-01 23:57:12 +00:00
bevy_tasks Replace or document ignored doctests (#11040) 2024-01-01 16:50:56 +00:00
bevy_text Replace deprecated elements (#10999) 2023-12-16 23:24:49 +00:00
bevy_time Replace or document ignored doctests (#11040) 2024-01-01 16:50:56 +00:00
bevy_transform Add approx feature to bevy_math (#11176) 2024-01-02 18:10:44 +00:00
bevy_ui Keep track of when a texture is first cleared (#10325) 2023-12-31 00:37:37 +00:00
bevy_utils Enable cloning EntityHashMap and PreHashMap (#11178) 2024-01-02 18:11:47 +00:00
bevy_window Remove CanvasParentResizePlugin (#11057) 2023-12-21 20:01:22 +00:00
bevy_winit Add window entity to TouchInput events (#11128) 2024-01-02 03:03:05 +00:00