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

WebGLRenderer: Auto-detect sRGB compressed texture formats. #23124

Merged
merged 2 commits into from
Dec 31, 2021

Conversation

Mugen87
Copy link
Collaborator

@Mugen87 Mugen87 commented Dec 30, 2021

Related issue: see #23116 (comment)

Description

Second attempt of integrating sRGB compressed texture formats. Compared to #23116 this PR automatically detects based on Texture.format and Texture.encoding whether sRGB compressed texture formats should be used or not. E.g. a texture with this setup...

texture.format = THREE.RGBA_S3TC_DXT5_Format;
texture.encoding = THREE.sRGBEncoding;

... will be internally translated to COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT (instead of COMPRESSED_RGBA_S3TC_DXT5_EXT).

@Mugen87 Mugen87 requested a review from donmccurdy December 30, 2021 19:36
@Mugen87 Mugen87 marked this pull request as draft December 30, 2021 19:40
@Mugen87
Copy link
Collaborator Author

Mugen87 commented Dec 30, 2021

In order to prevent a double sRGB decode, WebGLPrograms was modified to disable the inline decode. This is something we have to do anyway so I guess this is a good opportunity.

@Mugen87 Mugen87 marked this pull request as ready for review December 30, 2021 19:48
Copy link
Collaborator

@donmccurdy donmccurdy left a comment

Choose a reason for hiding this comment

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

Thanks! I like this solution. I'm not sure I understood this part of your earlier comment:

We need an enhancement in WebGLTextures so we can translate the format for both WebGL1 and WebGL 2.

... do we still need some WebGL1-specific workaround here?

@Mugen87
Copy link
Collaborator Author

Mugen87 commented Dec 30, 2021

... do we still need some WebGL1-specific workaround here?

The idea is to handle the conversion in WebGLUtils. It works then for WebGL 1 and WebGL 2.

@Mugen87 Mugen87 added this to the r137 milestone Dec 30, 2021
@mrdoob mrdoob merged commit 2e47927 into mrdoob:dev Dec 31, 2021
@mrdoob
Copy link
Owner

mrdoob commented Dec 31, 2021

Thanks!

@joshuaellis joshuaellis mentioned this pull request Jan 3, 2022
20 tasks
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.

3 participants