-
-
Notifications
You must be signed in to change notification settings - Fork 35.5k
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: Make use of SRGB8_ALPHA8. #22551
Conversation
Fascinating... |
// JPEGs can't have an alpha channel, so memory can be saved by storing them as RGB. | ||
const isJPEG = url.search( /\.jpe?g($|\?)/i ) > 0 || url.search( /^data\:image\/jpeg/ ) === 0; | ||
|
||
texture.format = isJPEG ? RGBFormat : RGBAFormat; |
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.
@Oletus FYI
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.
This seems like an acceptable compromise to ensure generateMipmap works, devices tend to have a lot more memory these days compared to when this change was made.
Is this expected? /cc @WestLangley Edit: False alarm. |
I had some problems with generating the E2E screenshots so I had to remove The light probe example indeed renders differently. |
Uh oh, force-pushing messes with the Pull Request conversation.. 😶 |
Sorry, I push additional commits from now on 👍 . |
Hmm, which extensions? |
I mean |
Oh, so SwiftShader doesn't support |
At least I could not get it to work on my iMac. But it seems the GitHub backend has no problems with it. |
Have you tried doing |
I'll give it a try. |
@Mugen87 Oh well. Thanks for testing 🙏 |
Although I wonder if this is related to this PR or if it was a previous change and the E2E didn't catch it. @Mugen87 Could you include the builds in the PR so we can compare raw.githack links with current dev? |
Another thing that would help is... Instead of updating all the screenshots, can you update only the screenshots that fail in the E2E? Edit: I'm saying this because I don't see a different between these two: https://raw.githack.com/Mugen87/three.js/dev17/examples/index.html?q=car#webgl_materials_car But the screenshots are different. |
This reverts commit 9f7c6cb.
It seems the SSR examples look wrong now. However, they do something which is not expected in the post-processing demos.
When using post-processing, sRGB should be normally applied via |
Okay, I've just updated the screenshots that failed. Although I'm not understand the logic why some test fail and others not. E.g. https://raw.githack.com/Mugen87/three.js/dev17/examples/webgl_loader_gltf_variants.html |
I've updated the PR with the respective change. |
Yes, that is its own issue. Better not to go into that rabbit hole right now. I've been there 😬 |
That was indeed a bug in |
I think that is unrelated to this PR. I can see the hue shift already happening in https://raw.githack.com/mrdoob/three.js/dev/examples/webgl_loader_gltf_variants.html My guess is this was due the HDR clamping fix: #22451 |
Okay, I've gone through the examples and everything looks good!👌 Can you remove the builds so this can be merged? |
I have reverted the build commits 👍 |
Thanks! |
Related issue: Fixed #22483
Description
This PR introduces the usage of
SRGB8_ALPHA8
. That means sRGB encoded RGBA textures are now decoded via the WebGL API and not in the shader anymore. Now the decode into linear color space happens first and then the texture filtering is applied which produces more correct renderings.The engine only uses
SRGB8_ALPHA8
with WebGL 2 and only with RGBA textures. This combination ensures mipmaps can be generated. Since RGBA is required and RGB textures are often emulated by WebGL and are in fact RGBA textures (#22293 (comment)), RGBA is now always used in various loaders.It was necessary to update some screenshots since the visuals are a bit different than before in some cases. A good example is
webgl_loader_gltf_variants
.