Jump to content

Issues when using compressed Textures [using setTextureFormatToUse]


gamefan
 Share

Recommended Posts

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.




 

Link to comment
Share on other sites

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.
 

Link to comment
Share on other sites

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 :))

Link to comment
Share on other sites

@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).

Link to comment
Share on other sites

  • 3 weeks later...

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...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...