Use IOR to parameterize dielectrics specular reflectance#24552
Open
goodartistscopy wants to merge 2 commits into
Open
Use IOR to parameterize dielectrics specular reflectance#24552goodartistscopy wants to merge 2 commits into
goodartistscopy wants to merge 2 commits into
Conversation
20d5ad4 to
d78e0c5
Compare
d78e0c5 to
3bba25f
Compare
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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
Currently
StandardMaterialspecifies F0 (the reflectance at normal incidence) through thereflectancefield. This provides artistic control of the color of highlights, but is disconnected from theiorparameter, which is also linked to F0 for dielectrics. The Filament doc acknowledges thatreflectanceandiorshould be used mutually exclusively.Standard glTF defines a fixed F0 = 4% which corresponds to IOR = 1.5, but brings further control over F0 through extensions KHR_materials_ior and KHR_materials_specular. Initial support for the latter folded both the
specular_tintartistic control and thespecularstrength/weight intoreflectance(multiplicating both). This is not the same as multiplying the specular response separately withspecular, because it does not touch grazing reflections (F90).The changes proposed here align Bevy's standard material parameters more closely to glTF. The model itself, having its root in Filament formulation, is still a bit different from the glTF formulation.
This addresses #17382.
Solution
reflectanceparameter and useioras the driving parameter for F0specular_tintspecularparameter is used to non-physically "extinguish" specular highlights, including e.g. for simulating specular occlusion.StandardMaterialUniformgrows by one floatKHR_materials_specularto the letter, wherespecularalso modifies the compensation term. This is just for clarification, this PR does not change the current behavior in that respect. This might explain why Bevy renders some settings less bright than glTF reference renderer (see second showcase below).Testing
I tested 2 relevant assets from the glTF samples SpecularTest and IORTestGrid
rendered using
scene_viewer(settingAmbientLightto 0.0 to better see the differences):Showcase
IOR
Before:


After:
Specular control
F0, meaning that the color factors > 1 are artificially inflated. This is confirmed with the last image which is main but with the reflectance formula changed toF0 = 0.08 * reflectancefromF0 = 0.16 * reflectance * reflectance.Before:



After:
Before, linear reflectance ramp