First-class support for Basis textures in glTF
See original GitHub issueI’m looking into adding support for encoding textures using BasisU to gltfpack and wondering what the plan is for Basis support in glTF.
Right now three.js can load Basis encoded textures from glTF if:
- The texture is specified as a URI with .basis extension
- BasisTextureLoader is added as a handler for .basis extension
However, there does not seem to be any way to do this if the image is embedded - mimeType is effectively ignored as far as I can tell when loading embedded images, so you can’t specify a handler.
There is an upcoming KHR_image_ktx2
extension that will allow including Basis files wrapped in a KTX2 header, however if the image is embedded then it will have a MIME type of image/ktx2
and, again, some special logic will be necessary to load this.
Just wondering what the plan for supporting all of this is, and if I can help in some way.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Basis Universal Texture Format in Unity - Unity Forum
Basis supports texture arrays, and texture arrays are now (finally) a first class citizen with Unity 2020.2, so it's plausible it could be ......
Read more >Support Other Textures in GLTFLoader - Questions - Babylon.js
I use Basis texture compression format to replace all png textures, and replace all '.png' to '.basis' inside gltf file. glTFLoader.js.
Read more >Khronos Ratifies KTX 2.0 - Phoronix
KTX 2.0 adds support for Basis Universal compression to the specification. These KTX 2.0 compressed textures can then be used by OpenGL, Vulkan, ......
Read more >Magnum 2019.10 released
The new release brings Python bindings, Basis Universal texture compression, improved STL interoperability, better Unicode experience for ...
Read more >GLTF Exporter for SolidEdge - ProtoTech Solutions
GLTF format 2.0; Both part and assembly models Export; Supports GLB file. Supports Partial Texture export; Control the visibility of nodes ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
The plan for glTF is https://github.com/KhronosGroup/glTF/pull/1612. That was recently updated, see
KHR_texture_basisu
. The extension specification is stable enough for prototyping, although I don’t have any example KTX2 assets yet.I expect the changes required for three.js will be relatively minor, similar to the current
MSFT_texture_dds
extension – which I think we should remove support for, actually, since it is really for Microsoft tools. The API might be:For now this will require a bit of Basis-aware logic in GLTFLoader, like:
https://github.com/mrdoob/three.js/blob/d3808533e8fc7fe23937b3bb8819bd44f7263f8e/examples/js/loaders/GLTFLoader.js#L1972-L1980
https://github.com/mrdoob/three.js/blob/d3808533e8fc7fe23937b3bb8819bd44f7263f8e/examples/js/loaders/GLTFLoader.js#L2004-L2012
With the proposal in https://github.com/mrdoob/three.js/issues/11682, this could be done through a plugin system, but that’s probably a longer-term direction and not necessary for this.
Correct, I don’t believe a glTF extension will reference
.basis
files or mime types directly. Only within a KTX2 container. Feedback on https://github.com/KhronosGroup/glTF/pull/1612 is welcome if you have any concerns about that!