Original Post
Hey folks, I've written my own DXT1 and DXT5 compressor for personal needs. To be more specific I need it because I'm programming with JOGL (Java OpenGL bindings) and I wanted to make my application completely independent from 3rd party tools like ATI Compressonator. The problem I face is noticeable quality loss. Well it is noticeable only in some cases - long gradient fields. I think I won't be able to explain it without images. Please have a look at the following two images. The first one is png - but it was derived from my own DXT1 compression. The second one is also png - but it was derived from DXT1 compression product of ATI Compressonator. PNG's should not confuse you - I've converted both dds's to png's just to let you inspect them.


Ok, on the first image I have marked areas, which do not satisfy me. As you can see (and compare) - after my DXT1 compression there is like "stair" effect where it is long gradient field, i. e. where it is implied that color should change smoothly in some area. ATI Compressonator somehow produces the same smooth area, so quality loss on ATI Compressonator products is almost unnoticeable. Mine also produces good results and all I need is to fix this problem with "stair" effect on long gradient fields.
I know why this happens - or at least here is my idea: this is because of color degradation from 8-8-8 to 5-6-5. I'm sure that this is the reason, because if you make simple color depth conversion (I mean without any compression - just a simple color depth conversion) from 8-8-8 image to 5-6-5 image you will see the same "stair" effect on long gradient fields, due to the color degradation. Therefore, to prevent this effect maybe I need something like dithering, or maybe something else? If dithering would help, could you please explain how to implement dithering, since I don't have a complete understanding of its purpose.
If anyone of you has ever done similar things or at least knows a good source of information on it - that would be great! Thank you.


Ok, on the first image I have marked areas, which do not satisfy me. As you can see (and compare) - after my DXT1 compression there is like "stair" effect where it is long gradient field, i. e. where it is implied that color should change smoothly in some area. ATI Compressonator somehow produces the same smooth area, so quality loss on ATI Compressonator products is almost unnoticeable. Mine also produces good results and all I need is to fix this problem with "stair" effect on long gradient fields.
I know why this happens - or at least here is my idea: this is because of color degradation from 8-8-8 to 5-6-5. I'm sure that this is the reason, because if you make simple color depth conversion (I mean without any compression - just a simple color depth conversion) from 8-8-8 image to 5-6-5 image you will see the same "stair" effect on long gradient fields, due to the color degradation. Therefore, to prevent this effect maybe I need something like dithering, or maybe something else? If dithering would help, could you please explain how to implement dithering, since I don't have a complete understanding of its purpose.
If anyone of you has ever done similar things or at least knows a good source of information on it - that would be great! Thank you.