Write .dds-file with custom mipmaps - possible?

Questions and postings pertaining to the development of ImageMagick, feature enhancements, and ImageMagick internals. ImageMagick source code and algorithms are discussed here. Usage questions which are too arcane for the normal user list should also be posted here.
User avatar
HansCz
Posts: 10
Joined: 2016-08-03T19:43:12-07:00
Authentication code: 1151

Re: Write .dds-file with custom mipmaps - possible?

Post by HansCz » 2016-08-05T20:37:51-07:00

dlemstra wrote:
snibgo wrote:Wouldn't it be more logical to take all the images in the current list, with a simpler define? Like this:

Code: Select all

convert image1.png image2.png image3.png -define dds:fromlist image1.dds
I also though about using this but I had the idea that this would be bad if you wanted to write multiple files in the same command. But now thinking about it that shouldn't be an issue. I'll talk with magick and see if he also thinks this is a good idea and then add it.
For what it's worth, snibgo's suggestion seems the simplest.

Also, how to handle the current -define dds:mipmaps=n, where n = the number of autogenerated mipmaps?

My initial thought is that autogeneration and manual specification of mipmaps should be mutually exclusive with dds:fromlist taking precedence over dds:mipmaps=n

What do you think?

User avatar
HansCz
Posts: 10
Joined: 2016-08-03T19:43:12-07:00
Authentication code: 1151

Re: Write .dds-file with custom mipmaps - possible?

Post by HansCz » 2016-08-05T20:46:30-07:00

Maybe a better name than dds:fromlist would be dds:mipmaps_from_list

since dds:mipmaps_from_list is more coherent with the current dds:mipmaps

but then again, this might confuse the user as to whether dds:mipmaps has anything to do with dds:mipmaps_from_list

Hmmm... ambiguity is not good.

snibgo
Posts: 9382
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Write .dds-file with custom mipmaps - possible?

Post by snibgo » 2016-08-05T21:07:50-07:00

I'm not fussed about the name of the define. My point was merely that IM already has a mechanism for creating image lists, rearranging them, processing them and so on. So a new method of specifying a list (probably with no methods for any manipulation) is a superfluous addition to product complexity.
snibgo's IM pages: im.snibgo.com

User avatar
HansCz
Posts: 10
Joined: 2016-08-03T19:43:12-07:00
Authentication code: 1151

Re: Write .dds-file with custom mipmaps - possible?

Post by HansCz » 2016-08-06T08:03:04-07:00

You're right. It would be a shame not to reuse the list capability here.

stefan_kubicek
Posts: 2
Joined: 2017-02-16T03:37:10-07:00
Authentication code: 1151

Re: Write .dds-file with custom mipmaps - possible?

Post by stefan_kubicek » 2017-02-16T06:10:38-07:00

Hi guys,

first post here!
I've been working in games for half my life but was only recently becoming aware of the possibilities per mip map control has to offer.
So far I was always using additional shading code to control certain distance-based effects, until the point where I had to optimize performance
more than usual, which lead me to searching the web for solutions, hence to this thread.

The closest working solution is currently NVidias DDS Photoshop plugin, which allows for per mip map control of an overlay color,
e.g. to have a texture fade towards a solid color over the row of the MipMaps, which is probably the most common application,
however it's really limited to just that, and often you need more artistic control.

Ultimately, I just wanted to know if there is any news on this topic as far as it's implementation into Image Magick is concerned,
it sounds like it could be the first truly versatile solution to this problem.

Cheers,

Stefan

User avatar
dlemstra
Posts: 1382
Joined: 2013-05-04T15:28:54-07:00
Authentication code: 6789
Contact:

Re: Write .dds-file with custom mipmaps - possible?

Post by dlemstra » 2017-02-16T13:44:50-07:00

Do you want custom mipmaps or the default ones that are created in the dds writer?
.NET + ImageMagick = Magick.NET https://github.com/dlemstra/Magick.NET, @MagickNET, Donate

User avatar
fmw42
Posts: 22087
Joined: 2007-07-02T17:14:51-07:00
Location: Sunnyvale, California, USA

Re: Write .dds-file with custom mipmaps - possible?

Post by fmw42 » 2017-02-16T14:06:58-07:00

Good point Dirk. I had forgotten about DDS. See http://www.imagemagick.org/script/formats.php where it says
DDS RW Microsoft Direct Draw Surface Use -define to specify the compression (e.g. -define dds:compression={dxt1, dxt5, none}). Other defines include dds:cluster-fit={true,false}, dds:weight-by-alpha={true,false}, and use dds:mipmaps to set the number of mipmaps.

stefan_kubicek
Posts: 2
Joined: 2017-02-16T03:37:10-07:00
Authentication code: 1151

Re: Write .dds-file with custom mipmaps - possible?

Post by stefan_kubicek » 2017-02-16T15:28:51-07:00

dlemstra wrote:
2017-02-16T13:44:50-07:00
Do you want custom mipmaps or the default ones that are created in the dds writer?
There are many tools that create DDS files with default mipmaps. The novelty would be to allow for the definition of arbitrary images per mipmap.
Not sure how to handle different image resolutions for specified mipmpaps, i.e. whether the writer should enforce (read: automatically scale to fit) that each successive mipmap is only a quarter of the size of the previous one, or to just blindly take the supplied mipmap and write it out to the dds file in hope it has the correct resolution. Either way: Not the default ones.

User avatar
dlemstra
Posts: 1382
Joined: 2013-05-04T15:28:54-07:00
Authentication code: 6789
Contact:

Re: Write .dds-file with custom mipmaps - possible?

Post by dlemstra » 2017-08-12T04:29:24-07:00

The next version of ImageMagick 7 will finally include this feature. With -define dds:mipmaps=fromlist you can use the other images in the list:

Code: Select all

convert image1.png image2.png image3.png -define dds:mipmaps=fromlist image1.dds
The encoder also checks if the image2.png and image3.png have the correct dimensions and it will throw an exception if the dimensions are incorrect.
.NET + ImageMagick = Magick.NET https://github.com/dlemstra/Magick.NET, @MagickNET, Donate

Post Reply