Hi,
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!
Hi,
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!
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: https://github.com/mrdoob/three.js/issues/16524#issuecomment-498929924
// format = _BASIS_FORMAT.cTFPVRTC1_4_OPAQUE_ONLY;
}else if (config.supportedCompressionFormats.etc2) {
format = _BASIS_FORMAT.cTFETC2;
}
}
return format;
}
See the TODO. Pinging @bghgary
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
.