texpresso icon indicating copy to clipboard operation
texpresso copied to clipboard

Weird issue with weighting?

Open Aerocatia opened this issue 1 year ago • 7 comments

When compressing this texture the cyan region encroaches into magenta. This happens even with color weights set to 1,1,1. This is compressing as DXT1A.

Here is with texpresso: texpresso

And here is with DirectXTex: dxtex

This is the input: marker color

Should this be happening?

Aerocatia avatar Oct 16 '24 14:10 Aerocatia

I should mention that libsquish did not do this.

Aerocatia avatar Oct 16 '24 15:10 Aerocatia

That should definitely not be happening, no. As a wild guess, could this be related to the image dimensions?

jansol avatar Oct 16 '24 15:10 jansol

Not sure, the image is 128x128. The split between the rows is exactly between a DXT block, so 2px each color.

Aerocatia avatar Oct 17 '24 12:10 Aerocatia

I can't seem to reproduce this. When running with texpresso compress -f BC1 input.png, I get Only images with 8 bits per channel are supported. When I convert the PNG with Gimp to 8bpc, I get the correct output with the above command.

Kriskras99 avatar May 20 '25 17:05 Kriskras99

I'm still getting the issue and this is the code that does it https://github.com/Aerocatia/ringhopper-old/blob/30867cb07468e454d4ff49841f24d31630662e41/src/ringhopper/src/bitmap/compression/mod.rs#L264

However I can confirm building texpresso standalone works correctly...... EDIT: it breaks on standalone if you use --profile quality

Aerocatia avatar May 21 '25 02:05 Aerocatia

Can reproduce with --profile quality. I was hoping this bug was introduced at some point, but it's been here as long as there has been a CLI. It did flip at some point (magenta encroaching on cyan, instead of the reverse). Unfortunately I don't understand the algorithm well enough to figure out what is wrong.

Kriskras99 avatar May 21 '25 16:05 Kriskras99

Oh, it happening only with quality profile is a great hint! Quality is basically the same algorithm as balanced but it does multiple iterations of numerical refinement. So it seems something goes wrong after the 1st iteration...

jansol avatar May 26 '25 21:05 jansol