Page 1 of 1

Getting the most out of your DDS textures.

Posted: 16 Dec 2009, 18:57
by Beherith
Ever since I was poking around with NVDXT for some better map compression options, Ive been wanting to share my findings.
Here are some examples of how different results can be obtained from nvdxt.exe by tweaking the mipmap filter parameters.

The method you choose for mipmap generation will matter very much in Spring, since more often than not the players will be seeing lower mips of your textures. So we must attempt to maximize the detail provided.

I recommend you dl the default texture viewer, WTV :
http://developer.nvidia.com/object/wind ... iewer.html
To see the different MIP levels in WTV, you must press the left and right arrows.

I chose a small bit of map terrain as an example, since it is crisp and high contrast:
Image

The default box filter is a nearest neighbour filter; let me show you miplevel 1:
Image
http://beherith.eat-peet.net/stuff/zbox.dds

Another common filter is a cubic filter, this also produces mildly washed out details on mips, much more washed out than box filter:
Image
http://beherith.eat-peet.net/stuff/zCubic0fadehq.dds

The best filter ive found is the Sinc filter, which is also known as the Lanczos filter. It is one of the most widely used resample filters. Slow but very good for reduction. Notice the great sharpness of details:
Image
http://beherith.eat-peet.net/stuff/zsinc0fadehq.dds

Here are also a few more, but they vary in sharpness between the previous three:
http://beherith.eat-peet.net/stuff/zhanning.dds
http://beherith.eat-peet.net/stuff/zkaiser.dds

The nxdxt command used is (for sinc)
nvdxt -file filename.bmp -dxt1a -nmips 5 -Sinc

TLDR;
Use SINC filter for it is nice.

Re: Getting the most out of your DDS textures.

Posted: 17 Dec 2009, 03:54
by Argh
Thanks, I'll definitely try it. I thought the Hamming filter looked good, with medium sharpening per mip, but I'll compare with SINC. Note that different mip filters interact with sharpen operations quite differently- that makes things a little tricky sometimes.

<tests>

Hmm. Personally, I still prefer Hamming with Sharpen Medium. Error-rate is lower, there's less artifacting. It's not as sharp, though- SINC is really sharp per mip, even without additional filter steps. I would probably use SINC for maps, but I think Hamming's better for stuff where you want to preserve lines and things.

I'll take a look at real-world differences when I have time.

Re: Getting the most out of your DDS textures.

Posted: 17 Dec 2009, 04:39
by Tribulex
yeah well beherith IS a mapper :D

Re: Getting the most out of your DDS textures.

Posted: 17 Dec 2009, 12:09
by hunterw
just make all this stuff default in the mapconv batch that comes with mapconv

this + no scanlines = win, should be default

Re: Getting the most out of your DDS textures.

Posted: 24 Dec 2009, 04:46
by Caydr
The best filter ive found is the Sinc filter, which is also known as the Lanczos filter.
Not according to FFDShow, which produces totally different results between these two options. Sinc, as Argh notes, produces a lot more sharpening artifacts and haloing, while Lanczos just looks like slightly-better bicubic (depending on how it's tweaked).

Sinc might be useful if you wanted to artificially oversharpen something to make it look like an OTA map, but that's all.

FFDShow overrules anything else on image enhancement, NVidia included.

edit: They are similar but Lanczos is a different animal http://en.wikipedia.org/wiki/Lanczos_resampling

edit 2: Examples of ringing/haloing artifacts half way down this page, where it says "overshoot": http://en.wikipedia.org/wiki/Ringing_artifacts

Re: Getting the most out of your DDS textures.

Posted: 24 Dec 2009, 14:39
by BrainDamage
according to math theory, sinc is the best possible for this pourpose, easy as that.
but, because of it's intrinsic nature ( the function extends from -inf to +inf ), it can't be implemented in practice, you can only have some approximations of it
lanzcros is one ( truncated and smoothed sinc )
even those filters that claims to be "sinc" are still something that approximates it

Re: Getting the most out of your DDS textures.

Posted: 25 Dec 2009, 02:56
by Caydr
They are different applications of the same principle and depending on how you tweak them or how they've been implemented, either one can be made to look similar to the other. However, what is regarded as "standard" sinc always results in artificial oversharpening as the pixels around dark areas become brighter than they actually should be. It's a good effect for dusty or sandy terrain where oversharpness could be considered a desirable effect, but it should not be said that it's "the best" for all situations, or even IMO the majority of them.