KTX texture resolution drop

Hi!

I change my gltf model with 1024X1024 textures with awesome Tool, [gltf-transform].(GitHub - donmccurdy/glTF-Transform: glTF 2.0 SDK for JavaScript, TypeScript, and Node.js.)

I success fully change my texture with CLI. I checked with gltf viewer and gltf-reporter. I found that the texture resolution goes very low.

The original texture looks,

And after etc1s transform

I found that uastc converts makes low resolution drop, but still I think it is low resolution.

I felt any resolution drop with 4k texture.

Should I don’t use the ktx compress with 1k texture?

If than I want to know what is the recommendations texture size for compress with ktx!

Thanks!

There are a lot of settings on the KTX2 encoder, could you share exactly what settings you’re using? Ideally if you can share the model or textures that also helps so we don’t have to guess. And what types of textures do you have? Base color, normal maps, anything else?

There’s a guide here that might help choose the right settings:

KTX Artist Guide

Sometimes using higher resolution may be reasonable too though.

1 Like

Thanks for the advise :slight_smile:

I’ll upload
compactTestglb.glb (3.1 MB)
file but just compact version.

I just used CLI with this command

gltf-transform uastc compactTestglb.glb compactTestglb2.glb

I didn’t know that there are extra option about the CLI! I tested with --level 4
But still the resolution goes bad.

The model has only Bas color and map.

  • Is there any way to change non NPOT texture dimensions to near NPOT?

I think i have to change them with code but, idon’t have any idea or module to deal with them.

The dimensions on these textures are already powers of two. But if you needed to do that there’s a --power-of-two flag on the tool you can use. Full help printout with:

gltf-transform uastc --help

It’s important to understand than PNG is a lossless compression format. Basis UASTC or ETC1S are lossy and will probably add some visible loss to the image, it’s a balance of getting a visual result that looks good enough, while also reducing memory and performance cost enough that you can use more textures and/or get better performance with the textures you have.

I don’t know whether the settings of the UASTC encoder will improve this particular image or not, you may have to play around with that, or perhaps others can answer. One thing I did notice is that some of the UVs are not parallel, like the slanted rectangle on the left-hand side here:

Screen Shot 2022-11-03 at 3.18.41 PM

Because KTX2 (and all GPU compatible texture formats) use block-based compression, things will probably look better if you can keep horizontal and vertical lines aligned with the UVs. You can see more noise in the compressed image in those areas. There’s a lot of empty space in the UV layouts too, which could be used to increase UV resolution assigned to surfaces, without increasing texture resolution.

Other than that, it’s OK to increase resolution a bit if needed, your total memory may still be smaller.


Finally, if this is your whole scene and it only uses 25 MB of memory… I wouldn’t feel too bad about that. If you don’t have a performance problem, then it may be fine as-is?

Thanks! I’ve learn alot, I just look the manual of the gltf-transform but I wasn’t able to find power-of-two flag

The model was just the piece of my model, so it looks too small to transform to ktx.

I expected just little frame drop but now I know that ktx tranform cause noticeable frame drop on some condition.

Now I have to decide and research how large files have to be ktx transformed and how small files don’t need to be transformed.