SneakySnave Posted September 21, 2017 Share Posted September 21, 2017 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. 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. 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. Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted September 21, 2017 Share Posted September 21, 2017 Did you make sure to enable .ktx mime type in your wbe server? Quote Link to comment Share on other sites More sharing options...
SneakySnave Posted September 21, 2017 Author Share Posted September 21, 2017 Thanks for the lightning quick response, @Deltakosh! I believe so. I have this in my mime.types file image/ktx ktx Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted September 21, 2017 Share Posted September 21, 2017 so if you go to http://localhost:8888/-dxt.ktx there is an actual file ? Quote Link to comment Share on other sites More sharing options...
SneakySnave Posted September 21, 2017 Author Share Posted September 21, 2017 No, there is no file at http://localhost:8888/-dxt.ktx Quote Link to comment Share on other sites More sharing options...
JCPalmer Posted September 21, 2017 Share Posted September 21, 2017 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". Quote Link to comment Share on other sites More sharing options...
SneakySnave Posted September 21, 2017 Author Share Posted September 21, 2017 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? Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted September 22, 2017 Share Posted September 22, 2017 The basic reason is because it was initially built for dds which can contains cube texture. CascadeLoad uses html img object to load the faces unfortunately so it is not compatible with ktx SneakySnave 1 Quote Link to comment Share on other sites More sharing options...
SneakySnave Posted September 23, 2017 Author Share Posted September 23, 2017 Ah, I understand. So if you're going to support multi platform ktx textures in your project, you must also use that for your skybox. You cannot mix and match. Thanks, @Deltakosh! GameMonetize 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.