-
Notifications
You must be signed in to change notification settings - Fork 1.2k
KHR_materials_clearcoat_darkening #2518
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
base: main
Are you sure you want to change the base?
KHR_materials_clearcoat_darkening #2518
Conversation
bghgary
left a comment
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.
Some minor issues. And again I don't know the math to review that part, but otherwise, LGTM.
extensions/2.0/Vendor/EXT_materials_clearcoat_darkening/README.md
Outdated
Show resolved
Hide resolved
| "clearcoatDarkeningTexture": { | ||
| "allOf": [ { "$ref": "textureInfo.schema.json" } ], | ||
| "description": "The clearcoat layer darkening texture.", | ||
| "gltf_detailedDescription": "The clearcoat layer darkening texture. The values are stored in sRGB. Assume white colour if no texture is supplied." |
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.
Is this correct? Should it be linear instead? We should also indicate the channel being used. Similar to this?
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.
It should definitely be linear. Copy-paste error, I think.
Thanks.
extensions/2.0/Vendor/EXT_materials_clearcoat_darkening/README.md
Outdated
Show resolved
Hide resolved
extensions/2.0/Vendor/EXT_materials_clearcoat_darkening/README.md
Outdated
Show resolved
Hide resolved
|
|
||
| \(T = (1-R) / (1 + R + R² + R³ + ...)\) | ||
| \(T = (1-R) / (1/(1-R))\) | ||
| \(T = (1-R)²\) |
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.
I don't think this formatted well. It's supposed to be 3 lines?
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.
Yeah. I'm using a markdown preview in VSCode and it's quite different from what GitHub seems to display.
| \(T = (1-R)²\) | ||
|
|
||
| The $(1-R)$ in the numerator represents the initial transmission of light through the coat and the denominator accounts for the infinite reflections within the coating. This converges to $1/(1-R)$. | ||
| Note that $(1-R)/(1+R)$ is mathematically equivalent to $(1-R)²$ but is more numerically stable as $R$ approaches 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.
I don't follow. How is
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.
Oops. Yeah, they aren't mathematically equivalent at all. This should have been mathematically "similar".
Also, the comment about the approximation being more numerically stable seems suspect too... I might remove this entirely.
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.
I've just removed this. I've tested (1-R)^2 and I don't see any issues with it. It matches our raytracer a bit better too.
| "allOf": [ { "$ref": "glTFProperty.schema.json" } ], | ||
| "properties": { | ||
| "clearcoatDarkeningFactor": { | ||
| "type": "array", |
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 it's just one value, consider making it a number instead of an array.
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.
Done
a001fbe to
5c5e4ae
Compare
This extension adds the ability to adjust the amount of physically correct darkening caused by interreflections within the coat.
It's designed to provide the same functionality as the
coat_darkeningparameter in OpenPBR.