Skip to content

Conversation

@MiiBond
Copy link
Contributor

@MiiBond MiiBond commented Aug 8, 2025

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_darkening parameter in OpenPBR.

Copy link
Contributor

@bghgary bghgary left a 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.

"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."
Copy link
Contributor

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?

Copy link
Contributor Author

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.


\(T = (1-R) / (1 + R + R² + R³ + ...)\)
\(T = (1-R) / (1/(1-R))\)
\(T = (1-R)²\)
Copy link
Contributor

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?

Copy link
Contributor Author

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.
Copy link
Contributor

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 $(1-R)/(1+R)$ mathematically equivalent to $(1-R)²$?

Copy link
Contributor Author

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.

Copy link
Contributor Author

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",
Copy link
Member

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@MiiBond MiiBond force-pushed the mbond/EXT_materials_clearcoat_darkening branch from a001fbe to 5c5e4ae Compare August 8, 2025 18:35
@MiiBond MiiBond changed the title EXT_materials_clearcoat_darkening KHR_materials_clearcoat_darkening Sep 15, 2025
@emackey emackey added the PBR Physically Based Rendering label Dec 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

PBR Physically Based Rendering

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants