ItayGal2 / nvidia-texture-tools

Automatically exported from code.google.com/p/nvidia-texture-tools
Other
0 stars 0 forks source link

nvcompress: same errors particles in result texture if compress in dxt1a #178

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Hello.
1. Compress attached texture test_dxt1a_256.dds with command
nvcompress.exe -alpha -bc1a test_dxt1a_256.dds test_dxt1a_256_old.dds
2. see result in test_dxt1a_256_bad.dds - some small particles near the tree 
trunk (on picture)
3. right result in test_dxt1a_256_old.dds - i compress this with version 2.0.8.

I found this problem in last trunc commit (num 1352). After this, i search same 
commit before this problem. And found in 1179 - this problem is absent, and 
this problem present in 1180.

And this problem present in 1135 and solved between 1136-1179. 

I build debug/release win32, Visual studio 2008 on Windows Seven Pro x64.

Original issue reported on code.google.com by a_kelma...@wargaming.net on 17 Aug 2012 at 7:25

Attachments:

GoogleCodeExporter commented 8 years ago
Thanks for the detailed investigation! What you are seeing is a slight behavior 
change in the tools. Previously, when using DXT1a we used to round the alpha 
toward the nearest endpoint, either 0 or 255. Now we always round up, so if the 
input value is not 0 it becomes 255. In the input texture there are some texels 
that have small non-zero values, which is what causes the artifacts.

The solution is to enable alpha quantization prior to compression. It seems 
that nvcompress does that already, so I think there may be a bug there.

Original comment by cast...@gmail.com on 17 Aug 2012 at 6:45

GoogleCodeExporter commented 8 years ago
The code actually looks good, I think what you are seeing is the result of 
dithering. The alpha values on that area are very close to zero, but the error 
of approximating them with zero adds up and introduces an opaque pixel once in 
a while to compensate. The dithering algorithm is certainly not the best, but 
works OK in most cases. Fixing the input texture should solve your problems. If 
you would like to disable dithering, you can do so by setting the second 
argument of setQuantization to false:

compressionOptions.setQuantization(/*color dithering*/false, /*alpha 
dithering*/true, /*binary alpha*/true, 127);

Original comment by cast...@gmail.com on 17 Aug 2012 at 6:58

GoogleCodeExporter commented 8 years ago
Hello!

I'm set "alpha dithering" to false and same artifact in texture is disappear.
Thank you very match!

Original comment by a_kelma...@wargaming.net on 21 Aug 2012 at 6:56