bevy/crates/bevy_pbr/src/render
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
..
clustered_forward.wgsl update shader imports (#10180) 2023-10-21 11:51:58 +00:00
fog.rs Fix fog color being inaccurate (#10226) 2023-10-23 12:45:18 +00:00
fog.wgsl update shader imports (#10180) 2023-10-21 11:51:58 +00:00
forward_io.wgsl Implement lightmaps. (#10231) 2024-01-02 20:38:47 +00:00
light.rs Keep track of when a texture is first cleared (#10325) 2023-12-31 00:37:37 +00:00
mesh_bindings.rs Implement lightmaps. (#10231) 2024-01-02 20:38:47 +00:00
mesh_bindings.wgsl Swap material and mesh bind groups (#10485) 2023-11-28 22:26:22 +00:00
mesh_functions.wgsl Normalize only nonzero normals for mikktspace normal maps (#10905) 2023-12-10 11:42:47 +00:00
mesh_types.wgsl Implement lightmaps. (#10231) 2024-01-02 20:38:47 +00:00
mesh_view_bindings.rs Remove unnecessary parens (#11075) 2023-12-24 17:43:01 +00:00
mesh_view_bindings.wgsl StandardMaterial Light Transmission (#8015) 2023-10-31 20:59:02 +00:00
mesh_view_types.wgsl light renderlayers (#10742) 2023-12-12 19:45:37 +00:00
mesh.rs Implement lightmaps. (#10231) 2024-01-02 20:38:47 +00:00
mesh.wgsl Implement lightmaps. (#10231) 2024-01-02 20:38:47 +00:00
mod.rs Variable MeshPipeline View Bind Group Layout (#10156) 2023-10-21 11:19:44 +00:00
morph.rs Use EntityHashMap<Entity, T> for render world entity storage for better performance (#9903) 2023-09-27 08:28:28 +00:00
morph.wgsl Swap material and mesh bind groups (#10485) 2023-11-28 22:26:22 +00:00
parallax_mapping.wgsl update shader imports (#10180) 2023-10-21 11:51:58 +00:00
pbr_ambient.wgsl Use “specular occlusion” term to consistently extinguish fresnel on Ambient and Environment Map lights (#10182) 2023-10-23 03:26:20 +00:00
pbr_bindings.wgsl Swap material and mesh bind groups (#10485) 2023-11-28 22:26:22 +00:00
pbr_fragment.wgsl Implement lightmaps. (#10231) 2024-01-02 20:38:47 +00:00
pbr_functions.wgsl Implement lightmaps. (#10231) 2024-01-02 20:38:47 +00:00
pbr_lighting.wgsl update shader imports (#10180) 2023-10-21 11:51:58 +00:00
pbr_prepass_functions.wgsl update shader imports (#10180) 2023-10-21 11:51:58 +00:00
pbr_prepass.wgsl double sided normals: fix apply_normal_mapping calls (#10330) 2023-11-01 16:40:25 +00:00
pbr_transmission.wgsl Non uniform transmission samples (#10674) 2023-11-22 18:54:45 +00:00
pbr_types.wgsl Implement lightmaps. (#10231) 2024-01-02 20:38:47 +00:00
pbr.wgsl update shader imports (#10180) 2023-10-21 11:51:58 +00:00
rgb9e5.wgsl Deferred Renderer (#9258) 2023-10-12 22:10:38 +00:00
shadow_sampling.wgsl StandardMaterial Light Transmission (#8015) 2023-10-31 20:59:02 +00:00
shadows.wgsl update shader imports (#10180) 2023-10-21 11:51:58 +00:00
skin.rs Use EntityHashMap<Entity, T> for render world entity storage for better performance (#9903) 2023-09-27 08:28:28 +00:00
skinning.wgsl Swap material and mesh bind groups (#10485) 2023-11-28 22:26:22 +00:00
utils.wgsl Update to wgpu 0.18 (#10266) 2023-12-14 02:45:47 +00:00
view_transformations.wgsl View Transformations (#9726) 2023-10-24 21:26:19 +00:00
wireframe.wgsl Swap material and mesh bind groups (#10485) 2023-11-28 22:26:22 +00:00