gamefan Posted June 13, 2018 Share Posted June 13, 2018 Hi, Started using compressed textures in our projects. Came across three possible bugs, not sure about the last one. PG: https://www.babylonjs-playground.com/#RK0W5S#2 1 and 2 are demonstrated in the above PG. Comment line #5 to compare results when not using compressed textures. 1.) Incorrect texture returned when Engine is set to use a ktx format texture and Texture is made via Texture.CreateFromBase64String. Possibe fix: bypass textureFormatInUse when buffer is available in Engine.CreateTexture 2.) Callback passed to Texture is not fired when CreateTexture falls back to url passed on not finding its ktx counterparts. Need this to finish a "change texture" flow. Possible fix: Ignore fallback argument and create onLoadObserver in Engine.CreateTexture 3.) When engine is set to use ktx format , CubeTexture looks for one ktx file instead of 6. I don't know if the cubeTextures in ktx formats are to be composited into a single file. I use this gulp task to create compressed textures. Got a work around for 1 and 2 but 3 is beyond me. Want this to support 360 tours on low spec devices. Quote Link to comment Share on other sites More sharing options...
JCPalmer Posted June 13, 2018 Share Posted June 13, 2018 1) Compressed textures can only be url based. This is because the actual texture to use is not known at build time. An iOS system is going to want PVRTC or also ASTC in the future. A Win desktop is probably going to pick DXT. You only have one string, not 5. If you are only saying that you cannot use CreateFromBase64String while compressed textures are enabled, that is true. Whether it is a bug or not, do not know. If you can PR change that allows both at the same time, go for it. 2) When falling back due to a .ktx file not found, it looks like null is being passed when createTexture calls itself. Not sure if this can pass the value from the first call or not, but that is where you might make a change. I think I just did the same thing as a DDS container did. 3) Yes, I am pretty sure that cube textures in .ktx are all sides in one file, since facesExpectedis a constructor argument. Been a while since I wrote this, and never had the time to test cubes. Try using the interactive PVRTexTool for one of those. I did the bat version, but also think the node version only did one face textures too. gamefan 1 Quote Link to comment Share on other sites More sharing options...
Guest Posted June 13, 2018 Share Posted June 13, 2018 Please let me know if you need help fixing the engine: In this case pelase create an issue with repro for each case and I'll dig into it (not sure when as I'm swamped in the particles improvements :)) Quote Link to comment Share on other sites More sharing options...
gamefan Posted June 14, 2018 Author Share Posted June 14, 2018 @JCPalmer 1.) Yes, createFromBase64String not usable while compressed Textures being enabled. I will see if I can make a PR, will be my first. ?Exciting. 2.) Even when onload from original call is passed, onLoad is not added to the loaded observable in case of a fallback. But I am guessing allowing this is not straightforward, and could affect other cases. 3.) Will try the pvrTextTool. Actually I have the gulp task run through all my folders to make these compressed textures. This treated the cubeTextures the same way it treated other images. @Deltakosh I have 1 and 2 working with some changes (not sure if they are fool proof). Quote Link to comment Share on other sites More sharing options...
gamefan Posted June 14, 2018 Author Share Posted June 14, 2018 @JCPalmer @Deltakosh I made a PR ?. Fixed 1 and 2 with as little change as possible. Tested both cases, I hope this addresses the issues correctly. Quote Link to comment Share on other sites More sharing options...
Guest Posted June 14, 2018 Share Posted June 14, 2018 merged and thank you gamefan 1 Quote Link to comment Share on other sites More sharing options...
gamefan Posted June 15, 2018 Author Share Posted June 15, 2018 No!!!! Thank you, sir. Wow, ?Uncontainable happiness. Feels so nice. GameMonetize 1 Quote Link to comment Share on other sites More sharing options...
gamefan Posted June 21, 2018 Author Share Posted June 21, 2018 @JCPalmer Got CubeTextures to work with a small change. Interestingly they do not require y flipping. JCPalmer 1 Quote Link to comment Share on other sites More sharing options...
JCPalmer Posted June 22, 2018 Share Posted June 22, 2018 @gamefan, That's great! Must say, I do not remember writing this. Not Y flipping is good to know. However, only being in a post in the Bugs section is not ideal. Many people search at the "questions" sub-forum. That documentation repo is a monster. gamefan 1 Quote Link to comment Share on other sites More sharing options...
gamefan Posted July 13, 2018 Author Share Posted July 13, 2018 @JCPalmer I think I will get my hands on the doc repo. 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.