Page 1 of 1

PNG >> DDS Conversion Pixellated

Posted: 2015-03-10T00:24:08-07:00
by Bighead
Hi there I'm trying to batch process conversion of PNG to DDS format using ImageMagick but it does not seem to handle fading edges very well.

The PNG image is this:
Image
The result I get is this (PNG > DDS):
Image

Happens with just basic options:
convert.exe -define dds:compression=dxt5

I tried DXT1 (loses alpha), DXT3 and DXT5 both generate the bubble with large blocks. I tried the other 2 DDS options to no avail.

What's also strange is that images fail to open with GIMP using the DDS Plugin with this error message, but images generated with Aorta or The Compressonator can be opened fine. They can however, be opened with Photoshop and the Nvidia DDS Plugin.

I also noticed that ALL programs require generating DDS textures with dimensions that are a multiple of 4, but ImageMagick allows generation of strange resolutions (such as 135x135) which is not valid as DDS. I'm not sure if DDS support is still in its infancy, or are if these are bugs, but I can't help but be saddened by these issues. :(

Re: PNG >> DDS Conversion Pixellated

Posted: 2015-07-20T19:35:32-07:00
by tastive
Having the same issue. Have a ton of textures for our game that I'm trying to get into DXT5 on the filesystem. (I'm also converting from png.)

Re: PNG >> DDS Conversion Pixellated

Posted: 2015-07-20T19:43:39-07:00
by tastive
I also can't actually open my dds files with anything -- GIMP and Imdisplay report "unexpected EOF", but they appear to load into our game (albeit with artifacts).

Worth noting that I also tried to convert the PNGs to BMP first (on the off chance that it'd have any effect) -- no dice.

Re: PNG >> DDS Conversion Pixellated

Posted: 2015-07-20T20:09:56-07:00
by fmw42
What version of IM and what platform? Please always provide that information.

There were some recent versions of IM that had trouble processing transparency. That might be the case.

Re: PNG >> DDS Conversion Pixellated

Posted: 2015-07-20T20:30:43-07:00
by glennrp
tastive wrote: Worth noting that I also tried to convert the PNGs to BMP first (on the off chance that it'd have any effect) -- no dice.
Does that mean the BMP was the same as the PNG (looking good) or the same as the DDS (blocky)?

Re: PNG >> DDS Conversion Pixellated

Posted: 2015-07-21T06:56:50-07:00
by tastive
Whoops! Sorry to provide such lacking information.

The above happens in 6.9.1-9 Q16 x64, version dated 2015-07-18. I'm on Windows 7.

Going to BMP first did not fix my problem; still had high pixelation in game. (I can only test vs what's in game, since I can't open the DDS files anywhere else due to the EOF error. I'm pretty sure the devs are aware of/have fixed the EOF error for the next version, though, based on this thread.)

(edit: the BMP itself was fine -- no pixelation issues.)

Re: PNG >> DDS Conversion Pixellated

Posted: 2015-07-21T07:15:41-07:00
by dlemstra
Bighead wrote:I also noticed that ALL programs require generating DDS textures with dimensions that are a multiple of 4, but ImageMagick allows generation of strange resolutions (such as 135x135) which is not valid as DDS. I'm not sure if DDS support is still in its infancy, or are if these are bugs, but I can't help but be saddened by these issues. :(
As far as I know it is not disallowed to create dds images with strange resolutions. But mmipmaps dimensions should be a power of two and we protect against that.

Re: PNG >> DDS Conversion Pixellated

Posted: 2016-01-09T10:58:58-07:00
by svengineer99
ImageMagick 6.9.2-10 Q16 x64 2015-12-20:

Similar to reported here, I observed slightly pixilated/blocky (but still noticeable) results after imagemagick DDS compose or convert operations as simple as "convert tx_sky_rainy1.dds tx_sky_rainy.dds". It's a 4096x4096 game sky texture file that I want to perform various image operations on for in-game "sky diversity". After some reading and experimentation I believe the default compression method is dxt5 with cluster-fit=false. The images I am working on include transparency so I think dxt5 is correct.

Trying "convert tx_sky_rainy1.dds -define dds:cluster-fit=true tx_sky_rainy.dds" improved the quality but there was still noticeable blocky-ness. Trying "convert tx_sky_rainy1.dds -define dds:compression=none tx_sky_rainy.dds" worked as needed. I guess it's not surprising in the end that the compression was causing the pixilation.

Unfortunately with compression=none I am unable to open the file in either paint.net or gimp but it's not totally necessary for my usage so I'm happy for now.

Thanks to imagemagick team for creating and supporting this amazing tool!

Re: PNG >> DDS Conversion Pixellated

Posted: 2016-02-23T05:12:17-07:00
by Hrnchamd
I've isolated the problems mentioned here - DXT5 alpha blockiness and DDS files not opening in GIMP, and submitted a patch to fix them.

https://github.com/ImageMagick/ImageMagick/pull/137

Re: PNG >> DDS Conversion Pixellated

Posted: 2016-02-23T22:00:36-07:00
by svengineer99
Thanks. Much appreciated. In the meantime I found that -define dds:compression=a8r8g8b8 works to preserve detail (no blockiness) while being openable in paint.net.

Re: PNG >> DDS Conversion Pixellated

Posted: 2016-05-02T16:11:48-07:00
by svengineer99
Follow up on this - Hrnchamd's patch released with IM 6.9.3-9 completely fixed the dds compression=dxt5 alpha blocky-ness and compression=none file recognition (with paint.net).

Thank you Hrnchamd!

One note for future reference - cluster-fit=true was required in some of my test cases to avoid alpha blocky-ness; depending on the 4096x4096 image content it could take an additional +10s to +40s computation time compared with -cluster-fit=false. For comparison Nvdia nxcompress and AMD thecompresonator took <2s.