-
-
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: Use ETC2 for ETC1 textures. #28021
Conversation
📦 Bundle sizeFull ESM build, minified and gzipped.
🌳 Bundle size after tree-shakingMinimal build including a renderer, camera, empty scene, and dependencies.
|
@donmccurdy I'm afraid I'm not sure how to test this change since on my devices the KTX examples do not output ETC1. Do you have an idea how we can verify if this PR actually works? |
@@ -703,7 +703,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils, | |||
let mipmap; | |||
const mipmaps = texture.mipmaps; | |||
|
|||
const useTexStorage = ( texture.isVideoTexture !== true && glInternalFormat !== RGB_ETC1_Format ); |
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.
To clarify: This is the bit (the RGB_ETC1_Format
check) I want to get rid of^^.
@Mugen87 the override in KTX2Loader can be removed with this PR: three.js/examples/jsm/loaders/KTX2Loader.js Lines 163 to 164 in a03a74a
If your devices are still not producing ETC1 after that, I think I could test this on my devices this weekend. Thank you! |
Thanks! After removing the override I still get The PR seems to work but it would be good if you could test this change, too! |
Confirmed – ETC1 is working in WebGL 2 on my iPhone 11. I believe if you use a KTX2 file encoded with ETC1S / "Basis LZ" (rather than UASTC) then the first transcoding choices, if available, will be ETC2 or ETC1. |
Related issue: #27162 (comment)
Description
The idea of this PR is to stop use
WEBGL_compressed_texture_etc1
and always rely onWEBGL_compressed_texture_etc
by treating ETC1 as ETC2 textures. According to https://www.khronos.org/assets/uploads/developers/library/2012-siggraph-opengl-es-bof/Ericsson-ETC2-SIGGRAPH_Aug12.pdf, slide 10, that should work:The motivation behind this change is to remove the dependency of
RGB_ETC1_Format
togl. compressedTexImage2D()
so we can eventually usegl.texStorage*()
for ETC1 textures.This change also includes the WebGL backend of
WebGPURenderer
.