bevy/crates/bevy_pbr/src
Rafał Harabień 51c70bc98c
Fix fog color being inaccurate (#10226)
# Objective

Fog color was passed to shaders without conversion from sRGB to linear
color space. Because shaders expect colors in linear space this resulted
in wrong color being used. This is most noticeable in open scenes with
dark fog color and clear color set to the same color. In such case
background/clear color (which is properly processed) is going to be
darker than very far objects.

Example:

![image](https://github.com/bevyengine/bevy/assets/160391/89b70d97-b2d0-4bc5-80f4-c9e8b8801c4c)

[bevy-fog-color-bug.zip](https://github.com/bevyengine/bevy/files/13063718/bevy-fog-color-bug.zip)

## Solution

Add missing conversion of fog color to linear color space.

---

## Changelog

* Fixed conversion of fog color

## Migration Guide

- Colors in `FogSettings` struct (`color` and `directional_light_color`)
are now sent to the GPU in linear space. If you were using
`Color::rgb()`/`Color::rgba()` and would like to retain the previous
colors, you can quickly fix it by switching to
`Color::rgb_linear()`/`Color::rgba_linear()`.
2023-10-23 12:45:18 +00:00
..
deferred Bind group entries (#9694) 2023-10-21 15:39:22 +00:00
environment_map Use “specular occlusion” term to consistently extinguish fresnel on Ambient and Environment Map lights (#10182) 2023-10-23 03:26:20 +00:00
prepass Bind group entries (#9694) 2023-10-21 15:39:22 +00:00
render Fix fog color being inaccurate (#10226) 2023-10-23 12:45:18 +00:00
ssao Bind group entries (#9694) 2023-10-21 15:39:22 +00:00
alpha.rs bevy_reflect: FromReflect Ergonomics Implementation (#6056) 2023-06-29 01:31:34 +00:00
bundle.rs Fix a typo in DirectionalLightBundle (#9861) 2023-09-20 04:44:56 +00:00
extended_material.rs allow extensions to StandardMaterial (#7820) 2023-10-17 21:28:08 +00:00
fog.rs chore: use ExtractComponent derive macro for EnvironmentMapLight and FogSettings (#10191) 2023-10-19 20:18:33 +00:00
lib.rs allow extensions to StandardMaterial (#7820) 2023-10-17 21:28:08 +00:00
light.rs fix orthographic cluster aabb for spotlight culling (#9614) 2023-10-08 22:53:09 +00:00
material.rs allow extensions to StandardMaterial (#7820) 2023-10-17 21:28:08 +00:00
parallax.rs bevy_reflect: FromReflect Ergonomics Implementation (#6056) 2023-06-29 01:31:34 +00:00
pbr_material.rs Deferred Renderer (#9258) 2023-10-12 22:10:38 +00:00
wireframe.rs Configurable colors for wireframe (#5303) 2023-10-13 00:06:24 +00:00