Jump to content

KTX textures loading, missing files and HDR environmentTexture are in a boat


V!nc3r
 Share

Recommended Posts

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?

Link to comment
Share on other sites

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.
Link to comment
Share on other sites

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

gBLSyyO.png

wood-dxt.ktx doesn't exist, error is normal

UrnUaFK.png

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

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

8Zavtcg.png

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:

botmMFz.jpg

Link to comment
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...
 Share

  • Recently Browsing   0 members

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