KTX Texture Arrays

I have been reading about the KTX (v2) specification and found some information about storing image sequences (video or animation frames) as a texture array within the container. Is this functionality available in the Babylon implementation?

I found numberOfArrayElements in the documentation, and it sounds like what I am looking for, but there were no playground examples showing how to access the array contents.

Thanks for any help you might lend, and to the team for implementing the format,

It is available :wink:

Adding @Evgeni_Popov who wrote the code

Radical. Standing by.

The doc you linked to is for KTX, not KTX2.

KTX2 loader does not support arrays, cube or video textures (yet?).

Note that the KTX loader does not support texture array neither:

Hey Evgeni, and thanks for the reply.

The last commit to that file is from Feb 2020. Is there a roadmap for the type that includes reading in the array or using CubeMaps? And should I assume when loading KTX files that they are always using the v1 loader?

Looks like the v2 was worked on more recently. :slight_smile:

I don’t think the ktx loader will undergo a lot of changes now that ktx2 is on track and is supported by gltf…

@bghgary will know more for sure.

We don’t have any plans to update the KTX v1 loader, though contributions would be okay.

The implementation is currently driven by glTF. glTF only needs single layer 2d textures at the moment for KHR_texture_basisu.

For cubemaps, yes. For single layer 2d textures, the loader will check the KTX header and use v1 or v2 depending on which one it is. Also, note that the file extension for KTX v2 is .ktx2.

Hey @bghgary, and I would be interested to help move this project forward. I will look deeper into the code and see what fits within the scope of my programming ability.

I am looking at using ktx2 containers to hold animation sequences which I will use in a vertex animation shader, and would like to be able to scrub back and forth in the sequence. Is it possible that LOD levels can be tricked into this purpose?

Thanks again, and please let me know if there is an existing feature map to align work to.

1 Like

I’m not sure. It seems like we have support for 2d texture arrays (InternalTexture.is2DArray) but there doesn’t seem to be a contract for loading texture arrays. Maybe that isn’t necessary though.