Getting the most out of your DDS textures.

Getting the most out of your DDS textures.

Various things about Spring that do not fit in any of the other forums listed below, including forum rules.

Moderator: Moderators

Post Reply
User avatar
Beherith
Posts: 5145
Joined: 26 Oct 2007, 16:21

Getting the most out of your DDS textures.

Post 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.
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Re: Getting the most out of your DDS textures.

Post 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.
User avatar
Tribulex
A.N.T.S. Developer
Posts: 1894
Joined: 26 Sep 2009, 21:26

Re: Getting the most out of your DDS textures.

Post by Tribulex »

yeah well beherith IS a mapper :D
User avatar
hunterw
Posts: 1838
Joined: 14 May 2006, 12:22

Re: Getting the most out of your DDS textures.

Post by hunterw »

just make all this stuff default in the mapconv batch that comes with mapconv

this + no scanlines = win, should be default
User avatar
Caydr
Omnidouche
Posts: 7179
Joined: 16 Oct 2004, 19:40

Re: Getting the most out of your DDS textures.

Post 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
User avatar
BrainDamage
Lobby Developer
Posts: 1164
Joined: 25 Sep 2006, 13:56

Re: Getting the most out of your DDS textures.

Post 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
User avatar
Caydr
Omnidouche
Posts: 7179
Joined: 16 Oct 2004, 19:40

Re: Getting the most out of your DDS textures.

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

Return to “General Discussion”