grendizerufo / nvidia-texture-tools

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

artifacts due to OptimalCompress::compressDXT1 #85

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
Convert sky.tga (attached) in BC1 format using nvcompress.exe (attached
sky_error.dds) (I used highest quality, changing nvcompress code)
Convert sky.tga (attached) in BC1 format using nvcompress.exe and enable
dithering (attached sky_dither.dds).

What is the expected output? What do you see instead?
Watch the resulting DDS in a 3d application like 3dsmax (attached
sky_screenshot_1.png). d3d or opengl is the same. The problem is not
visible in a standard paint application.
Using sky_dither.dds the artifacts in the 3d application disapears.

What version of the product are you using? On what operating system?
Last svn code (pre 2.1 release)

Please provide any additional information below.
These artifacts are generated by OptimalCompress::compressDXT1 in
nv::SlowCompressor::compressDXT1. Look at the modified version in the
attached compressDXT1.cpp. If the block has the same color I simply swapped
the least significant bit of the first pixel and used the normal
compression. The problem can be solved too by using dithering.

Original issue reported on code.google.com by marcoalt...@gmail.com on 7 Mar 2009 at 10:59

Attachments:

GoogleCodeExporter commented 9 years ago
Thanks for the bug report. This should be easy to fix.

Original comment by cast...@gmail.com on 9 Mar 2009 at 9:16

GoogleCodeExporter commented 9 years ago
Marco, I'm afraid the problem may be in the DXT decompression code of 3dsmax. 
The
files produced by NVTT seem to be correct. Your proposed fix lowers the 
compression
quality in all other applications. The feature proposed in Issue 53 would solve 
the
problem for you, so I'm gonna close this bug as duplicate and add a note to the 
other
bug about the bug in the 3dsmax decoder.

Original comment by cast...@gmail.com on 18 Mar 2009 at 5:07

GoogleCodeExporter commented 9 years ago
This issue is not strictly related to 3dsmax. The problem can be seen in our 
directx
game and in other applications. Try to load the sky_error.dds with a simple 
OpenGL
application like 
http://www.codesampler.com/oglsrc/oglsrc_4.htm#ogl_dds_texture_loader
Copy the sky_error.dds in the tool folder as lena.dds. You can see those 
artifacts.
Copy the sky_dither.dds now: the artifacts are gone. 
I did these tests on nVidia cards and Ati's ones: the artifacts are equally 
visible.
Probably I'm missing something...

Original comment by marcoalt...@gmail.com on 18 Mar 2009 at 9:21

GoogleCodeExporter commented 9 years ago
Ok, I'll investigate that further. I'm not sure what's going on here, there 
shouldn't
be any significant difference between the way the hardware decompressed the DXT
blocks and what the software does.

Original comment by cast...@gmail.com on 18 Mar 2009 at 7:19

GoogleCodeExporter commented 9 years ago
Ok, the problem is a difference between the actual hardware decompression 
algorithm
and the canonical approach. The error in the hardware decompression is 
proportional
to the distance between the end points. I've updated the single color 
compression
tables to take that into account.

I'd like to write an article about this issue. Could you provide two 
screenshots of
the texture before and after the fix? Thanks!

Original comment by cast...@gmail.com on 19 Mar 2009 at 10:05

GoogleCodeExporter commented 9 years ago
Here they are. Thanks!

Original comment by marcoalt...@gmail.com on 19 Mar 2009 at 2:02

Attachments:

GoogleCodeExporter commented 9 years ago
Thanks! Here's the article:
http://castano.ludicon.com/blog/2009/03/19/gpu-dxt-decompression/

Original comment by cast...@gmail.com on 19 Mar 2009 at 9:01