-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
KHR_materials_Specular #7564
base: main
Are you sure you want to change the base?
KHR_materials_Specular #7564
Conversation
…ure due to 8 texture upper limits.
…nable disable feature due to limitation.
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
I have pushed change in google/draco so not sure if I still need to sign the form again? |
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 great contribution! I left a bunch of comments, mostly naming/formatting nitpicks, but a couple of actual issues with IOR/reflectance.
libs/filamat/src/Enums.cpp
Outdated
@@ -47,6 +47,8 @@ std::unordered_map<std::string, Property> Enums::mStringToProperty = { | |||
{ "ior", Property::IOR }, | |||
{ "microThickness", Property::MICRO_THICKNESS }, | |||
{ "bentNormal", Property::BENT_NORMAL }, | |||
{"specularFactor", Property::SPECULAR_FACTOR }, | |||
{"specularColorFactor", Property::SPECULAR_COLOR_FACTOR } |
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.
Just call it specularColor
, we don't use glTF naming conventions in our core material models.
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.
Cannot. The reason call this is because SpecularColor is already used above by the specularRoughness extension.
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 properties defined in Filament are not glTF specific. The glTF material can combine the properties into one or use one over the other.
@@ -88,6 +88,15 @@ struct MaterialInputs { | |||
#endif | |||
#endif | |||
#endif | |||
|
|||
#if defined(MATERIAL_HAS_SPECULAR_FACTOR) | |||
float specularFactor; |
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.
See comments above about naming for those two inputs
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.
Will work on next.
shaders/src/shading_lit.fs
Outdated
vec3 dielectricSpecularF0 = vec3(0.0); | ||
float dielectricSpecularF90 = 0.0; | ||
#if defined(MATERIAL_HAS_SPECULAR_COLOR_FACTOR) | ||
dielectricSpecularF0 = min(0.04 * material.specularColorFactor, vec3(1.0)); |
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.
When the extension KHR_materials_ior
is used, 0.04 must be replaced with the value computed from the IOR. See https://github.com/KhronosGroup/glTF/blob/main/extensions/2.0/Khronos/KHR_materials_specular/README.md#interaction-with-other-extensions
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.
0.04 also needs to be changed when reflectance
is set
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.
seems like reflectance is a good replace of 0.04 since it is default to 0.04 and calculated correctly in IOR case.
Fix some left issues.
@PsycoTodd would you be able to update the branch? I would like to try and get this PR in again. thanks! |
Trying this weekend. Will let u know how it goes
…On Wed, May 29, 2024 at 12:11 PM Mathias Agopian ***@***.***> wrote:
@PsycoTodd <https://github.com/PsycoTodd> would you be able to update the
branch? I would like to try and get this PR in again. thanks!
—
Reply to this email directly, view it on GitHub
<#7564 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACCQBDW2VPZONSAMV3TPHGLZEYR4VAVCNFSM6AAAAABDAO4VI6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMZYGA4DSMJWGY>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Merged my change from the current mainline and have the pull request. |
This branch contains the change for KHR_materials_specular support. Tested on test model and some edtited models.
For android, due to level support, we force material changes as below: