-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use “specular occlusion” term to consistently extinguish fresnel on Ambient and Environment Map lights #10182
Merged
alice-i-cecile
merged 2 commits into
bevyengine:main
from
coreh:specular-occlusion-extinguish-fresnel
Oct 23, 2023
Merged
Use “specular occlusion” term to consistently extinguish fresnel on Ambient and Environment Map lights #10182
alice-i-cecile
merged 2 commits into
bevyengine:main
from
coreh:specular-occlusion-extinguish-fresnel
Oct 23, 2023
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Diddykonga
approved these changes
Oct 20, 2023
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, although I am no graphics wizard, just that it literally looks good to me.
JMS55
approved these changes
Oct 23, 2023
IceSentry
approved these changes
Oct 23, 2023
ameknite
pushed a commit
to ameknite/bevy
that referenced
this pull request
Nov 6, 2023
…mbient and Environment Map lights (bevyengine#10182) # Objective Even at `reflectance == 0.0`, our ambient and environment map light implementations still produce fresnel/specular highlights. Such a low `reflectance` value lies outside of the physically possible range and is already used by our directional, point and spot light implementations (via the `fresnel()` function) to enable artistic control, effectively disabling the fresnel "look" for non-physically realistic materials. Since ambient and environment lights use a different formulation, they were not honoring this same principle. This PR aims to bring consistency to all light types, offering the same fresnel extinguishing control to ambient and environment lights. Thanks to `@nathanf` for [pointing out](https://discord.com/channels/691052431525675048/743663924229963868/1164083373514440744) the [Filament docs section about this](https://google.github.io/filament/Filament.md.html#lighting/occlusion/specularocclusion). ## Solution - We use [the same formulation](https://github.com/bevyengine/bevy/blob/ffc572728fb7874996a13c31a82e86ef98515995/crates/bevy_pbr/src/render/pbr_lighting.wgsl#L99) already used by the `fresnel()` function in `bevy_pbr::lighting` to modulate the F90, to modulate the specular component of Ambient and Environment Map lights. ## Comparison⚠️ **Modified version of the PBR example for demo purposes, that shows reflectance (_NOT_ part of this PR)**⚠️ Also, keep in mind this is a very subtle difference (look for the fresnel highlights on the lower left spheres, you might need to zoom in. ### Before <img width="1392" alt="Screenshot 2023-10-18 at 23 02 25" src="https://github.com/bevyengine/bevy/assets/418473/ec0efb58-9a98-4377-87bc-726a1b0a3ff3"> ### After <img width="1392" alt="Screenshot 2023-10-18 at 23 01 43" src="https://github.com/bevyengine/bevy/assets/418473/a2809325-5728-405e-af02-9b5779767843"> --- ## Changelog - Ambient and Environment Map lights will now honor values of `reflectance` that are below the physically possible range (⪅ 0.35) by extinguishing their fresnel highlights. (Just like point, directional and spot lights already did.) This allows for more consistent artistic control and for non-physically realistic looks with all light types. ## Migration Guide - If Fresnel highlights from Ambient and Environment Map lights are no longer visible in your materials, make sure you're using a higher, physically plausible value of `reflectance` (⪆ 0.35).
rdrpenguin04
pushed a commit
to rdrpenguin04/bevy
that referenced
this pull request
Jan 9, 2024
…mbient and Environment Map lights (bevyengine#10182) # Objective Even at `reflectance == 0.0`, our ambient and environment map light implementations still produce fresnel/specular highlights. Such a low `reflectance` value lies outside of the physically possible range and is already used by our directional, point and spot light implementations (via the `fresnel()` function) to enable artistic control, effectively disabling the fresnel "look" for non-physically realistic materials. Since ambient and environment lights use a different formulation, they were not honoring this same principle. This PR aims to bring consistency to all light types, offering the same fresnel extinguishing control to ambient and environment lights. Thanks to `@nathanf` for [pointing out](https://discord.com/channels/691052431525675048/743663924229963868/1164083373514440744) the [Filament docs section about this](https://google.github.io/filament/Filament.md.html#lighting/occlusion/specularocclusion). ## Solution - We use [the same formulation](https://github.com/bevyengine/bevy/blob/ffc572728fb7874996a13c31a82e86ef98515995/crates/bevy_pbr/src/render/pbr_lighting.wgsl#L99) already used by the `fresnel()` function in `bevy_pbr::lighting` to modulate the F90, to modulate the specular component of Ambient and Environment Map lights. ## Comparison⚠️ **Modified version of the PBR example for demo purposes, that shows reflectance (_NOT_ part of this PR)**⚠️ Also, keep in mind this is a very subtle difference (look for the fresnel highlights on the lower left spheres, you might need to zoom in. ### Before <img width="1392" alt="Screenshot 2023-10-18 at 23 02 25" src="https://github.com/bevyengine/bevy/assets/418473/ec0efb58-9a98-4377-87bc-726a1b0a3ff3"> ### After <img width="1392" alt="Screenshot 2023-10-18 at 23 01 43" src="https://github.com/bevyengine/bevy/assets/418473/a2809325-5728-405e-af02-9b5779767843"> --- ## Changelog - Ambient and Environment Map lights will now honor values of `reflectance` that are below the physically possible range (⪅ 0.35) by extinguishing their fresnel highlights. (Just like point, directional and spot lights already did.) This allows for more consistent artistic control and for non-physically realistic looks with all light types. ## Migration Guide - If Fresnel highlights from Ambient and Environment Map lights are no longer visible in your materials, make sure you're using a higher, physically plausible value of `reflectance` (⪆ 0.35).
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
A-Rendering
Drawing game state to the screen
C-Bug
An unexpected or incorrect behavior
C-Usability
A targeted quality-of-life change that makes Bevy easier to use
S-Ready-For-Final-Review
This PR has been approved by the community. It's ready for a maintainer to consider merging it
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Objective
Even at
reflectance == 0.0
, our ambient and environment map light implementations still produce fresnel/specular highlights.Such a low
reflectance
value lies outside of the physically possible range and is already used by our directional, point and spot light implementations (via thefresnel()
function) to enable artistic control, effectively disabling the fresnel "look" for non-physically realistic materials. Since ambient and environment lights use a different formulation, they were not honoring this same principle.This PR aims to bring consistency to all light types, offering the same fresnel extinguishing control to ambient and environment lights.
Thanks to
@nathanf
for pointing out the Filament docs section about this.Solution
fresnel()
function inbevy_pbr::lighting
to modulate the F90, to modulate the specular component of Ambient and Environment Map lights.Comparison
Also, keep in mind this is a very subtle difference (look for the fresnel highlights on the lower left spheres, you might need to zoom in.
Before
After
Changelog
reflectance
that are below the physically possible range (⪅ 0.35) by extinguishing their fresnel highlights. (Just like point, directional and spot lights already did.) This allows for more consistent artistic control and for non-physically realistic looks with all light types.Migration Guide
reflectance
(⪆ 0.35).