bevy/examples/2d
Shaye Garg 0b5302d96a
Replace Ambient Lights with Environment Map Lights (#17482)
# Objective

Transparently uses simple `EnvironmentMapLight`s to mimic
`AmbientLight`s. Implements the first part of #17468, but I can
implement hemispherical lights in this PR too if needed.

## Solution

- A function `EnvironmentMapLight::solid_color(&mut Assets<Image>,
Color)` is provided to make an environment light with a solid color.
- A new system is added to `SimulationLightSystems` that maps
`AmbientLight`s on views or the world to a corresponding
`EnvironmentMapLight`.

I have never worked with (or on) Bevy before, so nitpicky comments on
how I did things are appreciated :).

## Testing

Testing was done on a modified version of the `3d/lighting` example,
where I removed all lights except the ambient light. I have not included
the example, but can if required.

## Migration
`bevy_pbr::AmbientLight` has been deprecated, so all usages of it should
be replaced by a `bevy_pbr::EnvironmentMapLight` created with
`EnvironmentMapLight::solid_color` placed on the camera. There is no
alternative to ambient lights as resources.
2025-03-04 07:40:53 +00:00
..
2d_shapes.rs Merge Style properties into Node. Use ComputedNode for computed properties. (#15975) 2024-10-18 22:25:33 +00:00
2d_viewport_to_world.rs Make Query::single (and friends) return a Result (#18082) 2025-03-02 19:51:56 +00:00
bloom_2d.rs Add tonemapping switch to bloom 2d example (#17789) 2025-02-11 22:21:04 +00:00
cpu_draw.rs Upgrade to Rust Edition 2024 (#17967) 2025-02-24 03:54:47 +00:00
custom_gltf_vertex_attribute.rs Replace Ambient Lights with Environment Map Lights (#17482) 2025-03-04 07:40:53 +00:00
mesh2d_alpha_mode.rs Add uv_transform to ColorMaterial (#17879) 2025-02-24 21:17:26 +00:00
mesh2d_arcs.rs Updated the 2D examples to make them uniform (#17237) 2025-01-23 16:46:58 +00:00
mesh2d_manual.rs Add user supplied mesh tag (#17648) 2025-02-10 22:38:13 +00:00
mesh2d_repeated_texture.rs Add uv_transform to ColorMaterial (#17879) 2025-02-24 21:17:26 +00:00
mesh2d_vertex_color_texture.rs Updated the 2D examples to make them uniform (#17237) 2025-01-23 16:46:58 +00:00
mesh2d.rs Updated the 2D examples to make them uniform (#17237) 2025-01-23 16:46:58 +00:00
move_sprite.rs Updated the 2D examples to make them uniform (#17237) 2025-01-23 16:46:58 +00:00
pixel_grid_snap.rs Updated the 2D examples to make them uniform (#17237) 2025-01-23 16:46:58 +00:00
rotation.rs Updated the 2D examples to make them uniform (#17237) 2025-01-23 16:46:58 +00:00
sprite_animation.rs Updated the 2D examples to make them uniform (#17237) 2025-01-23 16:46:58 +00:00
sprite_flipping.rs Updated the 2D examples to make them uniform (#17237) 2025-01-23 16:46:58 +00:00
sprite_scale.rs Proportional scaling for the sprite's texture. (#17258) 2025-01-24 18:24:02 +00:00
sprite_sheet.rs Updated the 2D examples to make them uniform (#17237) 2025-01-23 16:46:58 +00:00
sprite_slice.rs Updated the 2D examples to make them uniform (#17237) 2025-01-23 16:46:58 +00:00
sprite_tile.rs Updated the 2D examples to make them uniform (#17237) 2025-01-23 16:46:58 +00:00
sprite.rs Updated the 2D examples to make them uniform (#17237) 2025-01-23 16:46:58 +00:00
text2d.rs Updated the 2D examples to make them uniform (#17237) 2025-01-23 16:46:58 +00:00
texture_atlas.rs Updated the 2D examples to make them uniform (#17237) 2025-01-23 16:46:58 +00:00
transparency_2d.rs Updated the 2D examples to make them uniform (#17237) 2025-01-23 16:46:58 +00:00
wireframe_2d.rs Updated the 2D examples to make them uniform (#17237) 2025-01-23 16:46:58 +00:00