PNG >> DDS Conversion Pixellated

Post any defects you find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here.
Post Reply
Bighead
Posts: 11
Joined: 2015-03-09T23:45:55-07:00
Authentication code: 6789

PNG >> DDS Conversion Pixellated

Post 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. :(
tastive
Posts: 3
Joined: 2015-07-20T19:32:36-07:00
Authentication code: 1151

Re: PNG >> DDS Conversion Pixellated

Post 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.)
tastive
Posts: 3
Joined: 2015-07-20T19:32:36-07:00
Authentication code: 1151

Re: PNG >> DDS Conversion Pixellated

Post 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.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: PNG >> DDS Conversion Pixellated

Post 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.
User avatar
glennrp
Posts: 1147
Joined: 2006-04-01T08:16:32-07:00
Location: Maryland 39.26.30N 76.16.01W

Re: PNG >> DDS Conversion Pixellated

Post 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)?
tastive
Posts: 3
Joined: 2015-07-20T19:32:36-07:00
Authentication code: 1151

Re: PNG >> DDS Conversion Pixellated

Post 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.)
User avatar
dlemstra
Posts: 1570
Joined: 2013-05-04T15:28:54-07:00
Authentication code: 6789
Contact:

Re: PNG >> DDS Conversion Pixellated

Post 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.
.NET + ImageMagick = Magick.NET https://github.com/dlemstra/Magick.NET, @MagickNET, Donate
svengineer99
Posts: 24
Joined: 2016-01-09T10:38:11-07:00
Authentication code: 1151

Re: PNG >> DDS Conversion Pixellated

Post 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!
Hrnchamd
Posts: 1
Joined: 2016-02-23T04:40:57-07:00
Authentication code: 1151

Re: PNG >> DDS Conversion Pixellated

Post 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
svengineer99
Posts: 24
Joined: 2016-01-09T10:38:11-07:00
Authentication code: 1151

Re: PNG >> DDS Conversion Pixellated

Post 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.
svengineer99
Posts: 24
Joined: 2016-01-09T10:38:11-07:00
Authentication code: 1151

Re: PNG >> DDS Conversion Pixellated

Post 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.
Post Reply