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
ktx-batch

That seems to have correctly generated the compressed files.

59c3dd5fb679c_ScreenShot2017-09-21at10_37_32AM.thumb.png.f81bb3b0cfbcf37dc8168ba834aa040d.png

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);
scene.createDefaultSkybox(skyboxTexture);

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

59c3dee7899bd_ScreenShot2017-09-21at10_44_15AM.png.ccf598180c59cfb2e2a153f63960264d.png

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.

uncompressed.thumb.png.e31dd84361b8f2349d73b145211ee0cb.png

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

59c421bc35009_usingktx.thumb.png.f60cd0aeda1fc874832f054f509c4d4d.png

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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

  • Recently Browsing   0 members

    No registered users viewing this page.