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

WebGLBackground: Don't tone map sRGB backgrounds. #25134

Merged
merged 3 commits into from
Dec 14, 2022

Conversation

elalish
Copy link
Contributor

@elalish elalish commented Dec 13, 2022

Related issue: google/model-viewer#3953 (reply in thread)

Description

An eagle-eyed user correctly identified that we were applying tone mapping to the background image (see screenshots in the link above). I've fixed this by disabling tone mapping for the background material when the texture's encoding is sRGBEncoding. My rationale for this is that an sRGB texture is expected to be displayed 1:1 (as is already true for background colors), while tone mapping only makes sense for colors that go past 1, for which LinearEncoding is always used.

Verified locally with model-viewer and the user-supplied background.

@donmccurdy
Copy link
Collaborator

donmccurdy commented Dec 13, 2022

What advice should we give users about post-processing, where tone mapping must still affect the background? It's necessary to use a background that is not constrained to the closed domain [0,1] then?

@donmccurdy
Copy link
Collaborator

I think I would be in favor of this PR's changes, in any case. It's a better default, unless/until we want to expose a backgroundToneMapping property.

@WestLangley
Copy link
Collaborator

I would implement it like this, however:

boxMesh.material.toneMapped = ( background.encoding === sRGBEncoding ) ? false: true;

@elalish
Copy link
Contributor Author

elalish commented Dec 13, 2022

Your wish is my command, @WestLangley 😄

@Mugen87 Mugen87 added this to the r148 milestone Dec 14, 2022
@Mugen87 Mugen87 changed the title don't tone map sRGB backgrounds WebGLBackground: Don't tone map sRGB backgrounds. Dec 14, 2022
@Mugen87 Mugen87 merged commit 75db52a into mrdoob:dev Dec 14, 2022
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.

4 participants