Recommended Posts

Hello. I'm having an issue creating a skybox with compressed ktx textures.

I've followed the instructions here, and have used the 2 bat scripts in conjunction with the PVRTexTool and ASTC tools. Note that I've used "D" for developer level quality.

cd my-directory-with-images
make-ktx-batch D

That seems to have correctly generated the compressed files.


I then create the default skybox.

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


var skyboxTexture = new BABYLON.CubeTexture("textures/skybox/gradient-sky/SkyGradient", scene);

Based on the console output, it seems to be attempting to load the texture format used "-dxt.ktx" at my root URL.


I'm testing in Chrome on a MacBook, but am getting the same error in Firefox and Safari "Error: Error status: 404 - Unable to load -dxt.ktx".

Any ideas?

Thanks for taking the time to read.

Share this post

Link to post
Share on other sites

I never had any cube textures to test.  I just made the same changes I did to 2d textures.  I think the reason might have something to do with that there is no "SkyGradient" file, maybe try a real file (which will be the fallback) like "SkyGradient_ng.jpg".

Share this post

Link to post
Share on other sites

Thanks for the clue! I think I found the problem. It looks like you cannot cascade load separate sides of a cube texture if you're using a compressed texture format.

I followed the call stack from my line "var skyboxTexture = new BABYLON.CubeTexture("textures/skybox/gradient-sky/SkyGradient", scene);".

Not using a compressed texture format leads to Engine.prototype.createCubeTexture, and the function call cascadeLoad at line 10578 below.


Using a ktx texture format leads to Engine.prototype.createCubeTexture, and the function call BABYLON.Tools.LoadFile at line 10535 below.


At line 10528 the rootUrl is changed to the engine.textureFormatInUse, which is "-dxt.ktx". Then BJS tries to load a file "-dxt.ktx", which doesn't exist.

Is there a reason you cannot load all the sides of a cube texture separately when using a compressed texture format?

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.