KTX Files and DDS Environment Files

I think there is a possible bug in the implementation of the compressed texture array, although I may just be missing something.

I have created compressed versions of my textures. However, when I set my engine to use them, I get an error finding the compressed version of the environment.dds file.

babylon.js:16 BJS - [15:47:13]: e failed when trying to load https://www.babylonjs-playground.com/textures/environment.dds, falling back to the next supported loader

It’s looking for this:
Instead of this:

Is there a way to exclude certain files or file types from the setTextureFormatToUse method?

ETA: Here’s a Playground in which you can see the issue. Watch the network tab:


Unfortunately you once you set the engine to use ktx it is expecting to use it for all textures at the moment.

@Deltakosh should we smthg to autorize excluding some format to be checked as ktx ???

Yeah, when I did ktx, I don’t think there even was an environment texture. Babylon.js is now a little too complicated for me to work directly in Engine.

Loading environment first should go through, blissfully unaware of what is to come.

1 Like

Oh yeah that is a nice one :slight_smile: just call setTextureFormat after creating the env :slight_smile: I love it !!!

I see! For some reason that wasn’t working for me but maybe I was just not paying close enough attention. But can you point me in the direction of where that code lives? I wonder if I can take a stab at it by adding an exclusion array?

1 Like

right here: Babylon.js/thinEngine.ts at master · BabylonJS/Babylon.js · GitHub

You could add a global exclusion list as well ?

Yeah, I’ve got it working. Just figuring out how to get all the linting and tests to pass. Hopefully I’ll have a PR ready this weekend :slight_smile:

1 Like

Nice !!! The easiest to run tests and so on is to create a PR so that we could help you with your errors if needed :slight_smile:

Thanks, it’s passing all tests now, but when I run it in the local test bed it doesn’t see a new method I’ve created. I assume that’s because the d.ts files aren’t being updated somehow?

that is strange it should all work if you do npm run build from the tools/gulp folder as it updates the .d.ts before going through the tests.

If you do this, please do not add the dist/* files as part of your PR :slight_smile:

Yeah, this code works:

var available = ['-astc.ktx', '-dxt.ktx', '-pvrtc.ktx', '-etc1.ktx', '-etc2.ktx'];
            var formatUsed = engine.setTextureFormatToUse(available);


So the method is there, it just doesn’t see it in the editor.

oh in the editor this is possible, you should try to create the PR and we ll be able to look into it

Will do. Thanksgiving cooking awaits for now…

1 Like

Have a wonderfull thanksgiving !!!

1 Like

First pass at the PR. All suggestions for improvements are very welcome!

Also, I’m not sure why there are formatting changes. Maybe my fork got outdated by a recent commit?

@sebavan thanks for helping me! Now that we’ve merged, should I see that method on the Playground? It’s in the master branch but the editor throws an error when I try and use it.

It will be in the next nightly in a couple of hours

this will be up in 15 minutes, just pushed it :wink:


And here it is working :slight_smile: