Detect if Basis (.basis) format is supported


I have a couple of assets in my Babylon.js scene that is using Basis (.basis) format, but on some computers and iOS devices, they don’t render well.
Is there a way to detect with JS whether Basis format is supported or not?

Thanks in advance!

Adding @bghgary and @Evgeni_Popov our Basis heros.

The best format depending on the capabilities of the device is chosen when transcoding the basis data. For iOS devices I think it is PVRTC. However, I can see this in the code:

function GetSupportedTranscodeFormat(config: BasisTranscodeConfiguration, fileInfo: BasisFileInfo): Nullable<number> {
    var format = null;
    if (config.supportedCompressionFormats) {
        if (config.supportedCompressionFormats.etc1) {
            format = _BASIS_FORMAT.cTFETC1;
        }else if (config.supportedCompressionFormats.s3tc) {
            format = fileInfo.hasAlpha ? _BASIS_FORMAT.cTFBC3 : _BASIS_FORMAT.cTFBC1;
        }else if (config.supportedCompressionFormats.pvrtc) {
            // TODO uncomment this after pvrtc bug is fixed is basis transcoder
            // See discussion here:
            // format = _BASIS_FORMAT.cTFPVRTC1_4_OPAQUE_ONLY;
        }else if (config.supportedCompressionFormats.etc2) {
            format = _BASIS_FORMAT.cTFETC2;
    return format;

See the TODO. Pinging @bghgary

1 Like

I’m not sure I have the answers for this one as I wasn’t involved when this code was written. It seems like we need to fix the code as opposed to exposing a way for users to tell if Basis is supported or not. It is intended to be universal.

May I recommend that you use KTX instead which can contain the payload of .basis files in a different container .ktx2.

Thanks for your reply, will try using KTX @bghgary @Evgeni_Popov