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

Support KTX2 texture #4771

Closed
0k1019 opened this issue Oct 27, 2021 · 9 comments
Closed

Support KTX2 texture #4771

0k1019 opened this issue Oct 27, 2021 · 9 comments
Assignees
Labels
enhancement New feature or request gltf Specific to glTF support

Comments

@0k1019
Copy link

0k1019 commented Oct 27, 2021

Is your feature request related to a problem? Please describe.

Filament can't render GLB/GLTB file containing KTX2 texture.
The explanation of KTX2 is in Khronos group website.
Examples GLB files containing KTX2.

Describe the solution you'd like
I wish filament supports to render KTX2 texture. KTX2 is really nice for rendering quality and compression 3D file.

Describe alternatives you've considered
cgltf.h: This line means GLB with ktx2 texture convert to basisu_image not image.

AssetLoader.cpp: This line means basisu_image can't load to render.

Accept basisu_image in AssetLoader.

Testing in filament viewer between GLB(with png) and GLB(with KTX2)
image

OS and backend
macOS Big Sur 11.6
Chrome 95.0.4638.54 (x86_64)

Thank you for @codpot's help.

@romainguy romainguy added enhancement New feature or request gltf Specific to glTF support labels Oct 27, 2021
@August1996
Copy link

May I ask which version of the features of ktx2 is planned to support?😊

@prideout
Copy link
Contributor

We intend to fully support KHR_texture_basisu and use that as the driving force for our ktx2 support. The only reason we would drop features would be to reduce binary size.

@August1996
Copy link

We intend to fully support KHR_texture_basisu and use that as the driving force for our ktx2 support. The only reason we would drop features would be to reduce binary size.

very good feature👍. have you started developing this feature?

@simonsland
Copy link

We intend to fully support KHR_texture_basisu and use that as the driving force for our ktx2 support. The only reason we would drop features would be to reduce binary size.

Looking forward to the support of ktx2. Recently, we are also try to using ktx2 texture in our project through filament.

@zhazhaxia
Copy link

Looking forward to the support of ktx2. +1s

prideout added a commit that referenced this issue Apr 13, 2022
mipgen can now emit basis-encoded KTX2 files. Both the desktop and
web "suzanne" samples use this as a test for compressed textures.

This PR does not add KTX2 support to glTF, but it's on the way.

`BasisEncoder` has a builder style API that calls the basis encoder to
create KTX2 files. This hides some low-level BasisU features that we are
not using, like file I/O and mipmap generation.

`Ktx2Reader` is an easy-to-use API for creating Filament textures from
KTX2 files. Its API primarily consists of these two methods:

    bool requestFormat(Texture::InternalFormat format);
    Filament::Texture* load(const uint8_t* data, size_t size);

The first method is used to build an ordered list of formats that are
supported by your hardware. The second method consumes the contents of a
basis-encoded KTX2 file and attempts to produce a Filament texture with
a preferred format.

IMPORTANT: Our tools still let you use KTX1 for non-compressed images
because it is useful for HDR, but you can no longer use KTX1 for
block-compressed data.

Partial fix for #4771.
prideout added a commit that referenced this issue Apr 13, 2022
mipgen can now emit basis-encoded KTX2 files. Both the desktop and
web "suzanne" samples use this as a test for compressed textures.

This PR does not add KTX2 support to glTF, but it's on the way.

`BasisEncoder` has a builder style API that calls the basis encoder to
create KTX2 files. This hides some low-level BasisU features that we are
not using, like file I/O and mipmap generation.

`Ktx2Reader` is an easy-to-use API for creating Filament textures from
KTX2 files. Its API primarily consists of these two methods:

    bool requestFormat(Texture::InternalFormat format);
    Filament::Texture* load(const uint8_t* data, size_t size);

The first method is used to build an ordered list of formats that are
supported by your hardware. The second method consumes the contents of a
basis-encoded KTX2 file and attempts to produce a Filament texture with
a preferred format.

IMPORTANT: Our tools still let you use KTX1 for non-compressed images
because it is useful for HDR, but you can no longer use KTX1 for
block-compressed data.

Partial fix for #4771.
prideout added a commit that referenced this issue Apr 13, 2022
mipgen can now emit basis-encoded KTX2 files. Both the desktop and
web "suzanne" samples use this as a test for compressed textures.

This PR does not add KTX2 support to glTF, but it's on the way.

`BasisEncoder` has a builder style API that calls the basis encoder to
create KTX2 files. This hides some low-level BasisU features that we are
not using, like file I/O and mipmap generation.

`Ktx2Reader` is an easy-to-use API for creating Filament textures from
KTX2 files. Its API primarily consists of these two methods:

    bool requestFormat(Texture::InternalFormat format);
    Filament::Texture* load(const uint8_t* data, size_t size);

The first method is used to build an ordered list of formats that are
supported by your hardware. The second method consumes the contents of a
basis-encoded KTX2 file and attempts to produce a Filament texture with
a preferred format.

IMPORTANT: Our tools still let you use KTX1 for non-compressed images
because it is useful for HDR, but you can no longer use KTX1 for
block-compressed data.

Partial fix for #4771.
prideout added a commit that referenced this issue Apr 15, 2022
mipgen can now emit basis-encoded KTX2 files. Both the desktop and
web "suzanne" samples use this as a test for compressed textures.

This PR does not add KTX2 support to glTF, but it's on the way.

`BasisEncoder` has a builder style API that calls the basis encoder to
create KTX2 files. This hides some low-level BasisU features that we are
not using, like file I/O and mipmap generation.

`Ktx2Reader` is an easy-to-use API for creating Filament textures from
KTX2 files. Its API primarily consists of these two methods:

    bool requestFormat(Texture::InternalFormat format);
    Filament::Texture* load(const uint8_t* data, size_t size);

The first method is used to build an ordered list of formats that are
supported by your hardware. The second method consumes the contents of a
basis-encoded KTX2 file and attempts to produce a Filament texture with
a preferred format.

IMPORTANT: Our tools still let you use KTX1 for non-compressed images
because it is useful for HDR, but you can no longer use KTX1 for
block-compressed data.

Partial fix for #4771.
prideout added a commit that referenced this issue Apr 15, 2022
mipgen can now emit basis-encoded KTX2 files. Both the desktop and
web "suzanne" samples use this as a test for compressed textures.

This PR does not add KTX2 support to glTF, but it's on the way.

`BasisEncoder` has a builder style API that calls the basis encoder to
create KTX2 files. This hides some low-level BasisU features that we are
not using, like file I/O and mipmap generation.

`Ktx2Reader` is an easy-to-use API for creating Filament textures from
KTX2 files. Its API primarily consists of these two methods:

    bool requestFormat(Texture::InternalFormat format);
    Filament::Texture* load(const uint8_t* data, size_t size);

The first method is used to build an ordered list of formats that are
supported by your hardware. The second method consumes the contents of a
basis-encoded KTX2 file and attempts to produce a Filament texture with
a preferred format.

IMPORTANT: Our tools still let you use KTX1 for non-compressed images
because it is useful for HDR, but you can no longer use KTX1 for
block-compressed data.

Partial fix for #4771.
@prideout
Copy link
Contributor

This was fixed a few weeks ago, forgot to close the ticket.

@0k1019
Copy link
Author

0k1019 commented May 16, 2022

@prideout Thank you for support KTX2

But I found that it is not working in filament 1.22.0

Not working in gltf_viewer
image
image

Not working in filament web viewer

스크린샷 2022-05-16 오후 5 02 41

macOS Monterey 12.3.1(21E258)
Chrome 101.0.4951.64 (x86_64)

@prideout
Copy link
Contributor

Correct, it is supported on main only. The final commit for this feature landed on May 2 with f035655, so it should arrive with v1.22.1

@0k1019
Copy link
Author

0k1019 commented May 18, 2022

Thank you for supporting this feature.
It works in filament viewer.
스크린샷 2022-05-18 오후 2 49 05
Web viewer is not working because it is v1.22.0 filament.js. I think it working soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request gltf Specific to glTF support
Projects
None yet
Development

No branches or pull requests

7 participants