You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Three.js supports a number of ASTC formats, but not the complete set (ctrl+f "0x93D7"). The omission of the *_SRGB8_ALPHA8_* formats means that Three.js won't load properly-encoded sRGB ASTCs. This is because ASTC can encode RGB data as either linear or sRGB, but it can only encode the alpha channel as linear. When using sRGB encoding, the RGB and the Alpha channels are distinct and a different format, and thus enum, is used.
If line 50 calls getBase64ImgL(), it loads the KTX file containing the linearly-encoded ASTC. If your device doesn't support ASTC, you'll get the following, expected warnings:
I also print out the texture object, and we can see that the texture's internal format is 37815, the enum for an RGBA 8x8 ASTC. (If your device does support the format, it should show up as the texture on the plane)
If line 50 instead calls getBase64ImgS() to load the sRGB texture, the error is different:
The texture's format is 37847, which is the enum for an SRGB8_ALPHA8 8x8 ASTC but isn't defined as such by Three. Because Three.js doesn't even realize it's looking at an ASTC texture, there is also no warning about device compatibility (and it will still fail even if your device supports ASTC)
If #12939 is good indication, implementing these formats may be as easy as adding the appropriate enums to constants.js and WebGLUtils.js, but I don't have easy means to tinker with it myself.
I'm including the ASTC (actually, KTX) files I'm using, generated with PVRtexTool as a GUI for ASTCEnc.exe: ASTCTestSet.zip
Description of the problem:
Three.js supports a number of ASTC formats, but not the complete set (ctrl+f "0x93D7"). The omission of the *_SRGB8_ALPHA8_* formats means that Three.js won't load properly-encoded sRGB ASTCs. This is because ASTC can encode RGB data as either linear or sRGB, but it can only encode the alpha channel as linear. When using sRGB encoding, the RGB and the Alpha channels are distinct and a different format, and thus enum, is used.
I've put together a somewhat crude example.
If line 50 calls getBase64ImgL(), it loads the KTX file containing the linearly-encoded ASTC. If your device doesn't support ASTC, you'll get the following, expected warnings:
I also print out the texture object, and we can see that the texture's internal format is 37815, the enum for an RGBA 8x8 ASTC. (If your device does support the format, it should show up as the texture on the plane)
If line 50 instead calls getBase64ImgS() to load the sRGB texture, the error is different:
The texture's format is 37847, which is the enum for an SRGB8_ALPHA8 8x8 ASTC but isn't defined as such by Three. Because Three.js doesn't even realize it's looking at an ASTC texture, there is also no warning about device compatibility (and it will still fail even if your device supports ASTC)
If #12939 is good indication, implementing these formats may be as easy as adding the appropriate enums to constants.js and WebGLUtils.js, but I don't have easy means to tinker with it myself.
I'm including the ASTC (actually, KTX) files I'm using, generated with PVRtexTool as a GUI for ASTCEnc.exe: ASTCTestSet.zip
Three.js version
Browser
OS
Hardware Requirements (graphics card, VR Device, ...)
ASTCs ought to work on Oculus Quest and most Android phones, but JSFiddle doesn't so if you want to see for yourself, it'll take some work.
The text was updated successfully, but these errors were encountered: