Closed yomomano closed 2 years ago
We managed to fix the color/saturation problem i mention in previous: we didnt set the sRGB color space...
Now we are struggling with some weird smudge:
Uncompressed TGA file BASIS file (ignore the darkness)
We ran out of options having tried all sorts of basisu arguments.
Anyone has ideas please?
Hi - I think we can turn up some of the quality settings, which should help. Can you please circle what you mean by "smudge" though?
I see you're using the -q option: "basisu.exe -q 255 -y_flip somefile.jpg"
This tries to set the endpoint/selector codebook sizes for you. It's possible to set quality even higher, like this:
basisu.exe -comp_level 2 -max_endpoints 10000 -max_selectors 10000 somefile.jpg
You can set the comp level even higher, but that does slow down encoding. Also you can set the codebook sizes higher, up to 16,128 entries. Note that for ETC1S there will always be some block artifacts present, even at the highest quality settings.
I've messed around with compressing your original texture at various settings, and I think the smudges you're point out are due to ETC1S artifacts. Unfortunately, the underlying format that ETC1S uses is limited to only 5:5:5 base colors (per 4x4 texel block), which simplifies transcoding to various formats but does mean some textures will have artifacts.
thanks for looking into this! you say the ETC1S is the bottleneck. what alternative approach would you suggest in case the artifacts are unacceptable? would KTX2 be a better way?
@yomomano KTX has nothing to do with compression per se - it's a container format storing both data and meta-data of a texture which is either uncompressed, compressed with (and possibly super-compressed with zstandard).
A much higher quality mode is UASTC. I suggest you try the following command line as a starting point:
basisu.exe -uastc -uastc_level 0 -y_flip somefile.jpg
This deliberately chooses the lowest UASTC quality level to show you the difference to the highest quality ETC1S mode Rich pointed out above. I did a quick comparison on a very tough case (where even the highest possible quality achievable with astcenc is fairly modest, i.e. 37.5 db overall PSNR), and even the highest quality ETC1S mode doesn't hold a candle to -uatsc_level 0
.
The downside, however, is the increased size of the compressed result. In my test case 210KB vs. ~1MB for a 1024^2 source image. At least for transmission/distribution (i.e. download from the webs etc.), you can reduce the size of UASTC compressed files further with RDO and zstandard super-compression without sacrificing much quality (at least for color images, it depends for normal maps).
Please refer to the docs and basis_tool.cpp
for more info on options for tweaking quality.
P.S.: don't use source images compressed with JPEG or any other lossy compression format. If I'm not mistaken, further compression with basis (or astcenc or bc7enc etc.) will produce lower quality results compared to a losslessly compressed source image, especially with normal maps.
@thokra1 with KTX i meant UASTC, indeed. sorry. we continued the UASTC road and got some great image qualities but at a cost: file size 5Mb vs 500Kb. But still better than every other option we found so far.
We are now at this command:
basisu.exe -ktx2_zstandard_level 20 -uastc_rdo_l 0.2 -ktx2 -uastc -y_flip uncompressed_with_alpha.tga
We tried uastc_rdo_l =10 but the results were awful. With 0.2 the quality is great and file size only appr. 10% larger (5Mb with 10, 5.6MB with 0.2). So there we go.
Also ktx2_zstandard_level 20 gives a 10% reduction in size compared to default 6. Cool!
Thanks for helping out. We will stick to this!
Glad to help - let me know if you have any more assistance.
Hi, amazing project !! We managed to get big sized textures to work in Quest2 and that was just a life saver !
We struggle only with one thing: the colors from the jpg/png are not respected in basis file: they appear to saturated and dark.
Are there switches we can play with to make this look better?
We use the converter as like in:
basisu.exe -q 255 -y_flip somefile.jpg
Thanks for helping!