bevy/examples/3d
Marco Buono 1a96d820fd Add Distance and Atmospheric Fog support (#6412)
<img width="1392" alt="image" src="https://user-images.githubusercontent.com/418473/203873533-44c029af-13b7-4740-8ea3-af96bd5867c9.png">
<img width="1392" alt="image" src="https://user-images.githubusercontent.com/418473/203873549-36be7a23-b341-42a2-8a9f-ceea8ac7a2b8.png">


# Objective

- Add support for the “classic” distance fog effect, as well as a more advanced atmospheric fog effect.

## Solution

This PR:

- Introduces a new `FogSettings` component that controls distance fog per-camera. 
- Adds support for three widely used “traditional” fog falloff modes: `Linear`, `Exponential` and `ExponentialSquared`, as well as a more advanced `Atmospheric` fog;
- Adds support for directional light influence over fog color;
- Extracts fog via `ExtractComponent`, then uses a prepare system that sets up a new dynamic uniform struct (`Fog`), similar to other mesh view types;
- Renders fog in PBR material shader, as a final adjustment to the `output_color`, after PBR is computed (but before tone mapping);
- Adds a new `StandardMaterial` flag to enable fog; (`fog_enabled`)
- Adds convenience methods for easier artistic control when creating non-linear fog types;
- Adds documentation around fog.

---

## Changelog

### Added

- Added support for distance-based fog effects for PBR materials, controllable per-camera via the new `FogSettings` component;
- Added `FogFalloff` enum for selecting between three widely used “traditional” fog falloff modes: `Linear`, `Exponential` and `ExponentialSquared`, as well as a more advanced `Atmospheric` fog;
2023-01-29 15:28:56 +00:00
..
3d_scene.rs Spawn now takes a Bundle (#6054) 2022-09-23 19:55:54 +00:00
3d_shapes.rs Add cylinder shape (#6809) 2022-12-11 18:22:05 +00:00
atmospheric_fog.rs Add Distance and Atmospheric Fog support (#6412) 2023-01-29 15:28:56 +00:00
blend_modes.rs Standard Material Blend Modes (#6644) 2023-01-21 21:46:53 +00:00
bloom.rs Change From<Icosphere> to TryFrom<Icosphere> (#6484) 2022-11-14 22:34:27 +00:00
fog.rs Add Distance and Atmospheric Fog support (#6412) 2023-01-29 15:28:56 +00:00
fxaa.rs Cascaded shadow maps. (#7064) 2023-01-25 12:35:39 +00:00
lighting.rs Cascaded shadow maps. (#7064) 2023-01-25 12:35:39 +00:00
lines.rs Allow passing glam vector types as vertex attributes (#6442) 2022-11-04 03:45:17 +00:00
load_gltf.rs Cascaded shadow maps. (#7064) 2023-01-25 12:35:39 +00:00
msaa.rs Changed Msaa to Enum (#7292) 2023-01-20 14:25:21 +00:00
orthographic.rs Spawn now takes a Bundle (#6054) 2022-09-23 19:55:54 +00:00
parenting.rs Spawn now takes a Bundle (#6054) 2022-09-23 19:55:54 +00:00
pbr.rs Add a more familiar hex color entry (#7060) 2023-01-04 23:40:42 +00:00
render_to_texture.rs Rename camera "priority" to "order" (#6908) 2022-12-25 00:39:30 +00:00
shadow_biases.rs Cascaded shadow maps. (#7064) 2023-01-25 12:35:39 +00:00
shadow_caster_receiver.rs Cascaded shadow maps. (#7064) 2023-01-25 12:35:39 +00:00
skybox.rs Make AsBindGroup unsized (#6937) 2022-12-16 01:40:15 +00:00
spherical_area_lights.rs Spawn now takes a Bundle (#6054) 2022-09-23 19:55:54 +00:00
split_screen.rs Windows as Entities (#5589) 2023-01-19 00:38:28 +00:00
spotlight.rs Add global time scaling (#5752) 2022-10-22 18:52:29 +00:00
texture.rs Spawn now takes a Bundle (#6054) 2022-09-23 19:55:54 +00:00
transparency_3d.rs Changed Msaa to Enum (#7292) 2023-01-20 14:25:21 +00:00
two_passes.rs Rename camera "priority" to "order" (#6908) 2022-12-25 00:39:30 +00:00
update_gltf_scene.rs Add methods to Query<&Children> and Query<&Parent> to iterate over descendants and ancestors (#6185) 2022-10-31 15:57:50 +00:00
vertex_colors.rs Spawn now takes a Bundle (#6054) 2022-09-23 19:55:54 +00:00
wireframe.rs Move 'startup' Resource WgpuSettings into the RenderPlugin (#6946) 2022-12-20 16:17:11 +00:00