bevy/examples/3d
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
..
3d_gizmos.rs Update winit dependency to 0.29 (#10702) 2023-12-21 07:40:47 +00:00
3d_scene.rs Update default ClearColor to better match Bevy's branding (#10339) 2023-11-03 12:57:38 +00:00
3d_shapes.rs Schedule-First: the new and improved add_systems (#8079) 2023-03-18 01:45:34 +00:00
3d_viewport_to_world.rs Split Ray into Ray2d and Ray3d and simplify plane construction (#10856) 2023-12-06 14:09:04 +00:00
anti_aliasing.rs Update winit dependency to 0.29 (#10702) 2023-12-21 07:40:47 +00:00
atmospheric_fog.rs Update winit dependency to 0.29 (#10702) 2023-12-21 07:40:47 +00:00
blend_modes.rs Update winit dependency to 0.29 (#10702) 2023-12-21 07:40:47 +00:00
bloom_3d.rs Update winit dependency to 0.29 (#10702) 2023-12-21 07:40:47 +00:00
deferred_rendering.rs Update winit dependency to 0.29 (#10702) 2023-12-21 07:40:47 +00:00
fog.rs Update winit dependency to 0.29 (#10702) 2023-12-21 07:40:47 +00:00
generate_custom_mesh.rs Update winit dependency to 0.29 (#10702) 2023-12-21 07:40:47 +00:00
lighting.rs Update winit dependency to 0.29 (#10702) 2023-12-21 07:40:47 +00:00
lightmaps.rs Implement lightmaps. (#10231) 2024-01-02 20:38:47 +00:00
lines.rs Add consuming builder methods for more ergonomic Mesh creation (#10056) 2023-10-09 19:47:41 +00:00
load_gltf.rs Update default ClearColor to better match Bevy's branding (#10339) 2023-11-03 12:57:38 +00:00
orthographic.rs Simplify examples/3d/orthographic (#11045) 2024-01-02 19:27:22 +00:00
parallax_mapping.rs Update winit dependency to 0.29 (#10702) 2023-12-21 07:40:47 +00:00
parenting.rs Schedule-First: the new and improved add_systems (#8079) 2023-03-18 01:45:34 +00:00
pbr.rs Update default ClearColor to better match Bevy's branding (#10339) 2023-11-03 12:57:38 +00:00
render_to_texture.rs Keep track of when a texture is first cleared (#10325) 2023-12-31 00:37:37 +00:00
shadow_biases.rs Update winit dependency to 0.29 (#10702) 2023-12-21 07:40:47 +00:00
shadow_caster_receiver.rs Update winit dependency to 0.29 (#10702) 2023-12-21 07:40:47 +00:00
skybox.rs Update winit dependency to 0.29 (#10702) 2023-12-21 07:40:47 +00:00
spherical_area_lights.rs Update default ClearColor to better match Bevy's branding (#10339) 2023-11-03 12:57:38 +00:00
split_screen.rs Keep track of when a texture is first cleared (#10325) 2023-12-31 00:37:37 +00:00
spotlight.rs Update winit dependency to 0.29 (#10702) 2023-12-21 07:40:47 +00:00
ssao.rs Update winit dependency to 0.29 (#10702) 2023-12-21 07:40:47 +00:00
texture.rs Schedule-First: the new and improved add_systems (#8079) 2023-03-18 01:45:34 +00:00
tonemapping.rs Update winit dependency to 0.29 (#10702) 2023-12-21 07:40:47 +00:00
transmission.rs Fix ci xvfb (#11143) 2023-12-30 09:07:31 +00:00
transparency_3d.rs Fixed several missing links in docs. (#8117) 2023-04-23 17:28:36 +00:00
two_passes.rs Keep track of when a texture is first cleared (#10325) 2023-12-31 00:37:37 +00:00
update_gltf_scene.rs Update default ClearColor to better match Bevy's branding (#10339) 2023-11-03 12:57:38 +00:00
vertex_colors.rs Schedule-First: the new and improved add_systems (#8079) 2023-03-18 01:45:34 +00:00
wireframe.rs Update winit dependency to 0.29 (#10702) 2023-12-21 07:40:47 +00:00