V!nc3r Posted November 5, 2018 Share Posted November 5, 2018 I can't get console error into playground, but the bug is still here: if I want to use KTX compressed textures, BJS don't fallback to source texture if the ktx file isn't found. So inevitably the use of a scene HDR envTexture cancel the scene loading. line 16, set the value to true: https://www.babylonjs-playground.com/#F70HUY (texture files comes from here) In a more gobal way, if a texture miss its KTX version, it could be very convenient to use source texture instead (when you have hundreds of texture, you can't convert files each time you update them). Here an example with a jpg texture which doesn't have its corresponding ktx file: https://www.babylonjs-playground.com/#F70HUY#1 If I well remember (not sure), a few (long?) time ago, BJS was doing this source-texture fallback, am I wrong? Quote Link to comment Share on other sites More sharing options...
Guest Posted November 5, 2018 Share Posted November 5, 2018 Yeah this should work! Can you create an issue? Quote Link to comment Share on other sites More sharing options...
V!nc3r Posted November 5, 2018 Author Share Posted November 5, 2018 done: https://github.com/BabylonJS/Babylon.js/issues/5466 GameMonetize 1 Quote Link to comment Share on other sites More sharing options...
trevordev Posted November 8, 2018 Share Posted November 8, 2018 @V!nc3r This should work now in your PG: https://www.babylonjs-playground.com/#F70HUY let me know if you have any issues with the new behavior. V!nc3r 1 Quote Link to comment Share on other sites More sharing options...
V!nc3r Posted November 8, 2018 Author Share Posted November 8, 2018 Thanks it seems to works well! 'will test that on more complex scenes soon Quote Link to comment Share on other sites More sharing options...
V!nc3r Posted November 9, 2018 Author Share Posted November 9, 2018 After some tests it looks like OK. I made a test scene if people are interested https://www.dropbox.com/s/1ut7f5e63ju6wpn/ktx-test.zip?dl=0 with ktx loading at launch but also when a new texture is created on the fly. Also, this can help someone, I put it here: in the doc it says ktx files have to be Y flipped (and the bat files provided are OK about that) >>> I've lost an hour 'cause PVRTexToolCLI version 4.17 wasn't doing the flip... updating to 4.2 solved the issue. Note that in the gltf scene I had to set albedoTexture.vScale = -1 to get my texture in the right symmetry. Quote Link to comment Share on other sites More sharing options...
V!nc3r Posted November 9, 2018 Author Share Posted November 9, 2018 @trevordev actually I maybe spot a bug, when dealing with gltf file, but I have no idea from where this come from, I've made a video capture about that: https://dl.dropboxusercontent.com/s/j42kkodjxnz68nr/ktx-loading.mp4 and my zip test file is updated. Don't know how to reproduce on playground 'cause dropbox doesn't really share folder (which is an issue when you want find files with same name as the engine when dealing with ktx). It looks like not all ktx files are detected in gltf loading. wood-dxt.ktx doesn't exist, error is normal environment-dxt.ktx doesn't exist, error is normal, but no error for wood, and checker-arrow is not loaded as ktx while this ktx file exists Quote Link to comment Share on other sites More sharing options...
trevordev Posted November 13, 2018 Share Posted November 13, 2018 @V!nc3r this should be fixed once this PR is merged https://github.com/BabylonJS/Babylon.js/pull/5492 Quote Link to comment Share on other sites More sharing options...
V!nc3r Posted November 13, 2018 Author Share Posted November 13, 2018 you roxx, thanks :) Quote Link to comment Share on other sites More sharing options...
MarianG Posted November 20, 2018 Share Posted November 20, 2018 Hi. Sory to reopen this discution, but I think I missunderstood something. So basicaly these compressed textures should work with a gltf file, right? I mean, yes, if I'm adding a new texture from code to an imported gltf file then it is working. But if I'm loading a gltf file I would like that its textures to be loaded as compressed if they exist. What do you think about this? Quote Link to comment Share on other sites More sharing options...
V!nc3r Posted November 20, 2018 Author Share Posted November 20, 2018 (I haven't redo tests since the last fix, 'have to do that) @MarianG if you load a file (fbx, babylon, gltf, etc) with materials using textures (with their usual format - jpg, png, etc), the engine should load them as ktx is the file exist. And you just have to use this bit of code: var available = ['-astc.ktx', '-dxt.ktx', '-pvrtc.ktx', '-etc1.ktx', '-etc2.ktx']; var formatUsed = engine.setTextureFormatToUse(available); (no need to transform your textures url with .ktx) Quote Link to comment Share on other sites More sharing options...
MarianG Posted November 20, 2018 Share Posted November 20, 2018 6 hours ago, V!nc3r said: (I haven't redo tests since the last fix, 'have to do that) @MarianG if you load a file (fbx, babylon, gltf, etc) with materials using textures (with their usual format - jpg, png, etc), the engine should load them as ktx is the file exist. And you just have to use this bit of code: var available = ['-astc.ktx', '-dxt.ktx', '-pvrtc.ktx', '-etc1.ktx', '-etc2.ktx']; var formatUsed = engine.setTextureFormatToUse(available); (no need to transform your textures url with .ktx) @V!nc3r I'm already doing this, but they load as usual textures, and not ktx. And I'm haveing the lines above too. I got a warning about hdr texture, but nothing about internal png, jpg images. @trevordev later edit: I'm using v4.0.0-alpha.8 and it is not working Quote Link to comment Share on other sites More sharing options...
Sebavan Posted November 20, 2018 Share Posted November 20, 2018 Ping @trevordev to double check ? Quote Link to comment Share on other sites More sharing options...
trevordev Posted November 20, 2018 Share Posted November 20, 2018 @MarianG how are your files setup? I believe its working for me. If you look at this playground: https://playground.babylonjs.com/#QKJQUN#1 and reference vincers gltf from here https://dl.dropbox.com/s/1ut7f5e63ju6wpn/ktx-test.zip it should be loading the ktx files if they exist and if not it falls back to the regular file. Quote Link to comment Share on other sites More sharing options...
MarianG Posted November 20, 2018 Share Posted November 20, 2018 Problem solved I was an idiot and forgot to update gltf loader too, I updated only babylonjs file. Thank you so much. Only a small observation. Here is a texture which is loaded twice. I don't know why. I hope I saw it clear and it is not a different :)) Quote Link to comment Share on other sites More sharing options...
V!nc3r Posted November 21, 2018 Author Share Posted November 21, 2018 @trevordev I thought I was spotted a bug on my currently pro-project and was'nt get the time trying to reproduce it on the playground, but @MarianG playground show the issue: ktx textures when used have to be invertY (but not the source texture if fallbacked) as the ktx standard says. MarianG textures looks like fine: Quote Link to comment Share on other sites More sharing options...
Sebavan Posted November 21, 2018 Share Posted November 21, 2018 Ping @trevordev to double check ? Quote Link to comment Share on other sites More sharing options...
trevordev Posted November 22, 2018 Share Posted November 22, 2018 Thanks for catching this, working on a fix with this PR: https://github.com/BabylonJS/Babylon.js/pull/5545, this will invert all ktx textures, one issue was that inverting via webgl's UNPACK_FLIP_Y_WEBGL is not supported for compressed textures for the vScale will be inverted instead to get the same effect V!nc3r 1 Quote Link to comment Share on other sites More sharing options...
MarianG Posted November 27, 2018 Share Posted November 27, 2018 Well done @trevordev, thanks.? It is perfect now and memory used drop from 600-700mb in some scenes till 50-60mb. trevordev 1 Quote Link to comment Share on other sites More sharing options...
V!nc3r Posted November 27, 2018 Author Share Posted November 27, 2018 Well done! trevordev 1 Quote Link to comment Share on other sites More sharing options...
trevordev Posted November 27, 2018 Share Posted November 27, 2018 Glad its working now, the codepath for this was a bit tricky so let me know if you find any other issues. 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.