bevy/crates/bevy_pbr/src
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
..
prepass Move prepass functions to prepass_utils (#7354) 2023-01-24 20:36:40 +00:00
render Add Distance and Atmospheric Fog support (#6412) 2023-01-29 15:28:56 +00:00
alpha.rs Standard Material Blend Modes (#6644) 2023-01-21 21:46:53 +00:00
bundle.rs Cascaded shadow maps. (#7064) 2023-01-25 12:35:39 +00:00
fog.rs Add Distance and Atmospheric Fog support (#6412) 2023-01-29 15:28:56 +00:00
lib.rs Add Distance and Atmospheric Fog support (#6412) 2023-01-29 15:28:56 +00:00
light.rs Fix minor typos in code and docs (#7378) 2023-01-27 12:12:53 +00:00
material.rs Standard Material Blend Modes (#6644) 2023-01-21 21:46:53 +00:00
pbr_material.rs Add Distance and Atmospheric Fog support (#6412) 2023-01-29 15:28:56 +00:00
wireframe.rs Changed Msaa to Enum (#7292) 2023-01-20 14:25:21 +00:00