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 »

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 »

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: 12159
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 »

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 »

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 »

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: 1570
Joined: 2013-05-04T15:28:54-07:00
Authentication code: 6789
Contact:

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

Post by dlemstra »

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

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

Post by fmw42 »

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 »

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: 1570
Joined: 2013-05-04T15:28:54-07:00
Authentication code: 6789
Contact:

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

Post by dlemstra »

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