bevy/examples/3d
JMS55 dd4299bcf9 EnvironmentMapLight, BRDF Improvements (#7051)
(Before)
![image](https://user-images.githubusercontent.com/47158642/213946111-15ec758f-1f1d-443c-b196-1fdcd4ae49da.png)
(After)
![image](https://user-images.githubusercontent.com/47158642/217051179-67381e73-dd44-461b-a2c7-87b0440ef8de.png)
![image](https://user-images.githubusercontent.com/47158642/212492404-524e4ad3-7837-4ed4-8b20-2abc276aa8e8.png)

# Objective
- Improve lighting; especially reflections.
- Closes https://github.com/bevyengine/bevy/issues/4581.

## Solution
- Implement environment maps, providing better ambient light.
- Add microfacet multibounce approximation for specular highlights from Filament.
- Occlusion is no longer incorrectly applied to direct lighting. It now only applies to diffuse indirect light. Unsure if it's also supposed to apply to specular indirect light - the glTF specification just says "indirect light". In the case of ambient occlusion, for instance, that's usually only calculated as diffuse though. For now, I'm choosing to apply this just to indirect diffuse light, and not specular.
- Modified the PBR example to use an environment map, and have labels.
- Added `FallbackImageCubemap`.

## Implementation
- IBL technique references can be found in environment_map.wgsl.
- It's more accurate to use a LUT for the scale/bias. Filament has a good reference on generating this LUT. For now, I just used an analytic approximation.
 - For now, environment maps must first be prefiltered outside of bevy using a 3rd party tool. See the `EnvironmentMap` documentation.
- Eventually, we should have our own prefiltering code, so that we can have dynamically changing environment maps, as well as let users drop in an HDR image and use asset preprocessing to create the needed textures using only bevy. 

---

## Changelog
- Added an `EnvironmentMapLight` camera component that adds additional ambient light to a scene.
- StandardMaterials will now appear brighter and more saturated at high roughness, due to internal material changes. This is more physically correct.
- Fixed StandardMaterial occlusion being incorrectly applied to direct lighting.
- Added `FallbackImageCubemap`.

Co-authored-by: IceSentry <c.giguere42@gmail.com>
Co-authored-by: James Liu <contact@jamessliu.com>
Co-authored-by: Rob Parrett <robparrett@gmail.com>
2023-02-09 16:46:32 +00:00
..
3d_scene.rs Spawn now takes a Bundle (#6054) 2022-09-23 19:55:54 +00:00
3d_shapes.rs Base Sets (#7466) 2023-02-06 03:10:08 +00:00
atmospheric_fog.rs Better cascades config defaults + builder, tweak example configs (#7456) 2023-02-05 08:06:32 +00:00
blend_modes.rs Base Sets (#7466) 2023-02-06 03:10:08 +00:00
bloom.rs Base Sets (#7466) 2023-02-06 03:10:08 +00:00
fog.rs Add Distance and Atmospheric Fog support (#6412) 2023-01-29 15:28:56 +00:00
fxaa.rs Better cascades config defaults + builder, tweak example configs (#7456) 2023-02-05 08:06:32 +00:00
lighting.rs Base Sets (#7466) 2023-02-06 03:10:08 +00:00
lines.rs Allow passing glam vector types as vertex attributes (#6442) 2022-11-04 03:45:17 +00:00
load_gltf.rs EnvironmentMapLight, BRDF Improvements (#7051) 2023-02-09 16:46:32 +00:00
msaa.rs Base Sets (#7466) 2023-02-06 03:10:08 +00:00
orthographic.rs Spawn now takes a Bundle (#6054) 2022-09-23 19:55:54 +00:00
parenting.rs Base Sets (#7466) 2023-02-06 03:10:08 +00:00
pbr.rs EnvironmentMapLight, BRDF Improvements (#7051) 2023-02-09 16:46:32 +00:00
render_to_texture.rs Base Sets (#7466) 2023-02-06 03:10:08 +00:00
shadow_biases.rs Base Sets (#7466) 2023-02-06 03:10:08 +00:00
shadow_caster_receiver.rs Better cascades config defaults + builder, tweak example configs (#7456) 2023-02-05 08:06:32 +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 Base Sets (#7466) 2023-02-06 03:10:08 +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 Base Sets (#7466) 2023-02-06 03:10:08 +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