Skip to content
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

Make Khronos PBR Neutral invertable #4716

Merged
merged 3 commits into from
Mar 15, 2024
Merged

Make Khronos PBR Neutral invertable #4716

merged 3 commits into from
Mar 15, 2024

Conversation

elalish
Copy link
Contributor

@elalish elalish commented Mar 15, 2024

Feedback from Autodesk was that the ability to analytically invert a tone mapping function has a lot of important use cases through the industry. It turns out my tone mapper was quite difficult to invert, but a very small and almost imperceptible change made it trivial to invert. The key is making the desaturation step not change the compressed brightness value, so instead of mixing toward pure white [1, 1, 1], instead go toward peak * [1, 1, 1]. Anywhere the mix is significant, peak is already very close to 1, so this is a minor change, but it helps enormously with invertibility since these asymptotes become so sensitive when inverted.

I've included an analytical inverse function in lut-writer.mjs and verified the round-trip relative error is less than 2e-10.

@elalish elalish self-assigned this Mar 15, 2024
@elalish
Copy link
Contributor Author

elalish commented Mar 15, 2024

See if you can tell the difference.
Previous:
image

Updated:
image

The largest output difference due to this change (not this image, but for all possible input colors) is less than 1%.

@elalish elalish merged commit abf849e into master Mar 15, 2024
6 checks passed
@elalish elalish deleted the invertToneMapper branch March 15, 2024 23:09
romainguy added a commit to google/filament that referenced this pull request Mar 18, 2024
Based on model-viewer's change at
google/model-viewer#4716
romainguy added a commit to google/filament that referenced this pull request Mar 19, 2024
JL-Vidinoti pushed a commit to vidinoti/model-viewer that referenced this pull request Apr 22, 2024
* verified inverse

* update Khronos PBR Neutral tone mapper

* update docs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant