-
-
Notifications
You must be signed in to change notification settings - Fork 35.5k
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
Editor: Make IOR configurable. #28028
Conversation
@@ -111,6 +111,11 @@ function SidebarMaterial( editor ) { | |||
const materialReflectivity = new SidebarMaterialNumberProperty( editor, 'reflectivity', strings.getKey( 'sidebar/material/reflectivity' ) ); | |||
container.add( materialReflectivity ); | |||
|
|||
// ior | |||
|
|||
const materialIOR = new SidebarMaterialNumberProperty( editor, 'ior', strings.getKey( 'sidebar/material/ior' ), [ 1, 2.333 ], 3 ); |
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.
The documentation states that MeshPhysicalMaterial.ior
has a range of [1, 2.333]
. However, there are glTF assets with a higher IOR value. E.g. https://github.com/KhronosGroup/glTF-Sample-Assets/tree/main/Models/DispersionTest uses 2.42
. Should we allow a higher range in the editor e.g. [ 1, 3 ]
?
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.
Do we know where that range come from? The glTF docs don't seem to specify an upper bound:
Valid values for ior are numbers greater than or equal to 1. In addition, a value of 0 is allowed.
But I agree that a max of something like 3 is good enough.
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.
glTF allows IOR values of 0, disallows values between 0 and 1 (exclusive), and allows 1 to infinity (inclusive).
2.42 is a typical value for diamonds according the KHR_materials_ior spec, but values >2 are otherwise physically unusual. Occasionally I see glTF files containing ior=0 or ior=1000+, these are not physically-plausible but are occasionally useful to give ...
"...full weight to layer, i.e., the Fresnel term evaluates to 1 independent of the view or light direction. It is useful in combination with KHR_materials_specular to seamlessly support the specular-glossiness workflow."
In other words, it's a trick that is very useful when converting materials from the spec/gloss PBR workflow to the metal/rough workflow.
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.
Thanks for the feedback. I'll merge the PR with the current settings so it aligns to the documentation. But it seems we should reconsider the current IOR range and think about adapting the glTF policy.
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.
If we need an example with higher IOR, a good way to test is to start with this model:
It shows two bottles, one metal/rough and one spec/gloss. We don't support spec/gloss, so the latter will appear white in the editor:
If you convert the second bottle to metal/rough...
gltf-transform metalrough input.glb output.glb
... then the second bottle will include a material with ior=1000, and both bottles should appear identical:
Related issue: -
Description
This PR makes sure the
ior
property ofMeshPhysicalMaterial
can directly be configured and not just indirectly viareflectivity
.