KTX texture problem


#1

Hi @trevordev
I just noticed that on clone a material, the textures are still invert. Can you please take a look?

previous link: KTX textures loading, missing files and HDR environmentTexture are in a boat - Bugs - HTML5 Game Devs Forum


#2

Do you have a repro playground? Cloning the mesh looks to work here https://www.babylonjs-playground.com/#8IMNBM#10 or do you mean just a specific material?


#3

Yes, sorry, I forgot :slight_smile:
without ktx textures
https://www.babylonjs-playground.com/#8IMNBM#11

with
https://www.babylonjs-playground.com/#8IMNBM#12


#4

Thx, I think this PR will fix it support material cloning with ktx by TrevorDev · Pull Request #5667 · BabylonJS/Babylon.js · GitHub


#5

Great. Thanks. I’m waiting for it :wink:


#6

It is perfect now.
Thank you and happy holidays!


#7

KTX guy hit again! GG :slight_smile:


#8

Thread re-up :smiley:

First just an information: as you can see some ktx are now available directly from the playground! (playground texture doc page will be update soon) + an addition of a cubemap dedicated to debugging or understanding how axys works. All ktx have been generated from the tools quoted in the doc.

Here an example which works perfectly for both Standard & PBR materials: https://www.babylonjs-playground.com/#86DHVJ#1

Now here comes the issue :slight_smile:
Are cubeTexture supposed to be available in ktx format? I think so but it seems not working:


#9

Thanks for reporting, I think it should work, Ill take a look :grin:


#10

After investigating, it looks that multiple file loading isn’t supported by the ktx loader.

/**
 * Defines wether the loader supports cascade loading the different faces.
 */
public readonly supportCascades = false;

I added an error message to catch this. It looks cubemap is only supported by a single ktx file (not multiple) @JCPalmer might have more insight here.


#11

Erf, shame. But I don’t get how to create a cubeTexture using a single file. Is it something like instead of having this multiple fileset
classic

you’ll set something like this, in one file?

what


#12

This has been a while for me. Things are not in the same place as when I added them. For sure a .ktx container can have 1 or 6 faces. I see in the last big section of createCubeTexture that the engine is basically drawing a cube texture from the 6 textures, using the CPU.

While the CPU might be able to draw an uncompressed cube texture from 6 compressed sides, it simply not going to be possible to ensure it is a compressed cube texture without special software for each internal format, eg. dtx, astf, pvrtc, etc (like the double use of etc :grin:).

The PVRTexTool can save cube textures from one format to the next, how does one get it in the first format? The manual says:

Blockquote
Create a Cube MapTo create a cube map texture, clickFile -> Create Cubemap…(Figure 2). This will open a dialog box which allows the specification of image files for the six faces of the cube (seeSection2.5.2).

compose%20cubemap

Think that batch tool is not going to work here, but that was meant to do entire directories. You can just save it N different ways in the tool.


#13

'will definitely give a try to that tool, thanks!


#14

I tried this tool but I really don’t get how to use this single file once saved…

Here the BC1 encoding use to generate my .ktx file:

generated file: cubemapDebug-dxt.zip (145.5 KB)

Theoretically you have to set up the original file (png, jpg, etc) and if you have enable ktx formats and if ktx file equivalent is available, then the engine switch to the ktx file.

So (based on my playground above) I still have to write new BABYLON.CubeTexture("textures/cubemapDebug/", scene); to get my cubemap.

Now, as soon as I write
var formatUsed = engine.setTextureFormatToUse(["-dxt.ktx"]);
all I get is the scene clearColor, and even no error messages :scream:

Note that I haven’t any idea about how to name this single ktx file:

I also tried by simply naming it -dxt.ktx, doesn’t work too

Here my testing folder: testing-ktx.zip (557.0 KB)


#15

When using compressed textures, by calling setTextureFormatToUse(), the original url is not actually attempted to be read. I would try textures/cubemapDebug/cubemapDebug.jpg.

The exception being a falling back. In that case probably stripping everything after the last / is probably the answer, but I know I did not code that.


#16

Same issue using new BABYLON.CubeTexture("cubemapDebug/cubemapDebug", scene); (after renaming cubemap files like this pattern cubemapDebug_nx.jpg of course).


#17

Why _nx? You want to load the ktx.


#18

Nope, I want to load the original texture file, BUT the ktx if it exists, in that order. 'cause in a project using thousand of textures, you can’t be sure they all have ktx version.
(and I was talking just about the filenames)