Set the timeout value on BABYLON.Texture?

I’m not sure what you mean by fallback PNG versions. Maybe you are talking about something different. Can you elaborate or create a repro on the playground?

Are you loading .ktx or .ktx2?

We are loading KTX not KTX2

The Texture class looks for DXT files and then falls back to PNG:

I don’t see any code that does this, so if you can provide a repro, I’ll debug and see why it’s doing it.

We’re still on a slightly older version, but this shows the code we’re using:

You can see it falling back to PNG but we’d like to skip that.

Ok, I see. It is falling back to the original url passed to the texture constructor. There does not seem to be a way to not fallback to the original url. We can add a flag but you will need to take a new version.

Perhaps another option is to not use the texture selector. Select the texture yourself based on engine capabilities and then load the ktx directly.

Use engine.getCaps(), then check which to use:

const caps = engine.getCaps();
if (caps.astc) {
} else if (caps.s3tc) {
} else if (caps.pvrtc) {
} else if (caps.etc2) {
} else if (caps.etc1) {
}
1 Like

Basically something like this: https://playground.babylonjs.com/#1SCH7H#140

2 Likes

Ok, that works! It now skips the fallback. So is there a way to differentiate between a failed request and just a texture update that is hanging for any other reason, such as a GPU issue? We want to rule things out so we can get clear on what’s happening.

That’s why I was thinking that axios/raw texture could help to separate the concerns there…

Texture constructor has an onError callback you can use to know when it fails. GPU issues will not fire this callback.

There should be no reason for the texture to hang besides the network. It would be a bug otherwise I think.

That was our assumption, but the logs on the services don’t show these long wait times, so the delay is hiding somewhere, and we want to be able to sniff it out.

Sorry for the wait, here’s an example using fetch: Test read KTX | Babylon.js Playground (babylonjs.com)

Very important of note is line 38 where you have to set the forcedExtension parameter to let the loader know which format it’s using :slight_smile:

4 Likes

Thanks, that works perfectly!

2 Likes