bevy/examples/3d
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
..
3d_scene.rs Migrate cameras to required components (#15641) 2024-10-05 01:59:52 +00:00
3d_shapes.rs Merge Style properties into Node. Use ComputedNode for computed properties. (#15975) 2024-10-18 22:25:33 +00:00
3d_viewport_to_world.rs Make Query::single (and friends) return a Result (#18082) 2025-03-02 19:51:56 +00:00
animated_material.rs
anisotropy.rs Add a Sphere to anisotropy example (#17676) 2025-02-05 20:23:43 +00:00
anti_aliasing.rs
atmosphere.rs Procedural atmospheric scattering (#16314) 2025-01-23 22:52:46 +00:00
atmospheric_fog.rs
auto_exposure.rs Replace Ambient Lights with Environment Map Lights (#17482) 2025-03-04 07:40:53 +00:00
blend_modes.rs Allow clippy::too_many_arguments to lint without warnings (#17249) 2025-01-09 07:26:15 +00:00
bloom_3d.rs Anamorphic Bloom (#17096) 2025-01-06 18:43:21 +00:00
camera_sub_view.rs
clearcoat.rs
clustered_decals.rs Disable clustered decals on Metal. (#17554) 2025-01-27 05:39:07 +00:00
color_grading.rs Relationships (non-fragmenting, one-to-many) (#17398) 2025-01-18 22:20:30 +00:00
decal.rs Upgrade to Rust Edition 2024 (#17967) 2025-02-24 03:54:47 +00:00
deferred_rendering.rs Allow clippy::too_many_arguments to lint without warnings (#17249) 2025-01-09 07:26:15 +00:00
depth_of_field.rs
edit_material_on_gltf.rs Add edit_material_on_gltf example (#17677) 2025-02-05 22:45:20 +00:00
fog_volumes.rs Replace Ambient Lights with Environment Map Lights (#17482) 2025-03-04 07:40:53 +00:00
fog.rs Replace Ambient Lights with Environment Map Lights (#17482) 2025-03-04 07:40:53 +00:00
generate_custom_mesh.rs Make Query::single (and friends) return a Result (#18082) 2025-03-02 19:51:56 +00:00
irradiance_volumes.rs Replace Ambient Lights with Environment Map Lights (#17482) 2025-03-04 07:40:53 +00:00
lighting.rs Replace Ambient Lights with Environment Map Lights (#17482) 2025-03-04 07:40:53 +00:00
lightmaps.rs Replace Ambient Lights with Environment Map Lights (#17482) 2025-03-04 07:40:53 +00:00
lines.rs
load_gltf_extras.rs
load_gltf.rs
mesh_ray_cast.rs Rename RayCastSettings to MeshRayCastSettings (#16703) 2024-12-10 03:27:42 +00:00
meshlet.rs Add external assets to .gitignore (#17388) 2025-01-17 01:20:14 +00:00
mixed_lighting.rs Replace Ambient Lights with Environment Map Lights (#17482) 2025-03-04 07:40:53 +00:00
motion_blur.rs Replace Ambient Lights with Environment Map Lights (#17482) 2025-03-04 07:40:53 +00:00
occlusion_culling.rs Split out the IndirectParametersMetadata into CPU-populated and GPU-populated buffers. (#17863) 2025-02-18 00:53:44 +00:00
order_independent_transparency.rs Relationships (non-fragmenting, one-to-many) (#17398) 2025-01-18 22:20:30 +00:00
orthographic.rs
parallax_mapping.rs
parenting.rs
pbr.rs Fix confusing comment in pbr example (#16996) 2024-12-29 22:45:17 +00:00
pcss.rs
post_processing.rs
query_gltf_primitives.rs
reflection_probes.rs
render_to_texture.rs
rotate_environment_map.rs
scrolling_fog.rs
shadow_biases.rs
shadow_caster_receiver.rs
skybox.rs Replace Ambient Lights with Environment Map Lights (#17482) 2025-03-04 07:40:53 +00:00
specular_tint.rs Replace Ambient Lights with Environment Map Lights (#17482) 2025-03-04 07:40:53 +00:00
spherical_area_lights.rs Replace Ambient Lights with Environment Map Lights (#17482) 2025-03-04 07:40:53 +00:00
split_screen.rs Store UI render target info locally per node (#17579) 2025-02-10 07:27:58 +00:00
spotlight.rs Replace Ambient Lights with Environment Map Lights (#17482) 2025-03-04 07:40:53 +00:00
ssao.rs Replace Ambient Lights with Environment Map Lights (#17482) 2025-03-04 07:40:53 +00:00
ssr.rs Allow clippy::too_many_arguments to lint without warnings (#17249) 2025-01-09 07:26:15 +00:00
texture.rs
tonemapping.rs Make Query::single (and friends) return a Result (#18082) 2025-03-02 19:51:56 +00:00
transmission.rs Replace Ambient Lights with Environment Map Lights (#17482) 2025-03-04 07:40:53 +00:00
transparency_3d.rs Upgrade to Rust Edition 2024 (#17967) 2025-02-24 03:54:47 +00:00
two_passes.rs
update_gltf_scene.rs
vertex_colors.rs
visibility_range.rs Change ChildOf to Childof { parent: Entity} and support deriving Relationship and RelationshipTarget with named structs (#17905) 2025-02-27 19:22:17 +00:00
volumetric_fog.rs Replace Ambient Lights with Environment Map Lights (#17482) 2025-03-04 07:40:53 +00:00
wireframe.rs