Optimal combination of filters

Practical and theoretical implementation discussion.
Post Reply
Thammuz
Posts: 22
Joined: Mon Nov 28, 2011 8:36 am
Location: Stockholm

Optimal combination of filters

Post by Thammuz » Tue Dec 18, 2012 12:12 pm

By default, my renderer renders images at a higher resolution than the target resolution (2x by default but it's configurable). This helps a lot with the infamous hdr aliasing problems in visible lights and reflections of lights (given that you tonemap -> downsample). I currently use a gaussian filter for splatting samples onto the film, and a Mitchell filter for downsampling from off-screen resolution to the target resolution. I'm quite happy with the result as it's sharp, artifact-free and has minimal aliasing. This got me thinking though, is there a theoretically optimal combination of filters for splatting and downsampling? I mean, I've arrived at the combination I use now just by testing lots of combinations and visually inspecting the results, which isn't all that scientific. So yeah, what's your take on this?

ingenious
Posts: 282
Joined: Mon Nov 28, 2011 11:11 pm
Location: London, UK
Contact:

Re: Optimal combination of filters

Post by ingenious » Tue Dec 18, 2012 2:25 pm

That's a very good question indeed. My understanding, however, is that the filtering used in practice is not really based on solid math, but rather on what's visually pleasing, which is not really well quantified. I vaguely remember reading Mitchell's paper introducing the filter, where he talks about the trade-offs. One of the biggest issues, I think, is that there's no optimal filtering theory for signal reconstruction from randomly placed samples, which is what we do in practice to turn the aliasing resulting from uniform sampling to uncorrelated noise. There is also a discussion in PBRT which also talks in this spirit.

As for the particular choice of filters, I remember there was a post on some renderer forum recently (was is Octane?) that discussed their improved anti-aliasing system, and they said they got best results with a simple box filter for the downsampling. Unfortunately the article was lacking technical details, as it was targeted toward users, I believe. Does anyone have the link?
Image Click here. You'll thank me later.

spectral
Posts: 382
Joined: Wed Nov 30, 2011 2:27 pm
Contact:

Re: Optimal combination of filters

Post by spectral » Tue Dec 18, 2012 2:45 pm

Hi,

I agree with Ingenious about the math...

The problem is not only related to mathematics... but also to the way the brain and the eye are working... and there it become more complex.

If you already use a kind of down-sampling, then I think that you're on the right way. Here is my own small article about that :
http://spectralbattle.wordpress.com/201 ... ng-system/

But, if you want to dig more into it, take a look at : http://www.iryoku.com/smaa/

As any domain in CG, there is a lot of research... so, it is up to you to learn and choose which one to implement.

;-)
Spectral
OMPF 2 global moderator

Thammuz
Posts: 22
Joined: Mon Nov 28, 2011 8:36 am
Location: Stockholm

Re: Optimal combination of filters

Post by Thammuz » Tue Dec 18, 2012 2:52 pm

Yes, I remember that article/blog post, and it was Fryrender. I just had a look at their current blog, but couldn't find that particular post (probably because Fryrender ceased to exist and now everything is Arion). I've tried using a box filter for downsampling, but I can't say that I liked the results as it still produced aliasing...so they must've been doing something else aswell.

Other examples IIRC:
Indigo: splat = gaussian or "fastbox", resample = bicubic (configurable, but these seem to be the defaults)
Luxrender: doesn't render at a higher resolution, but defaults to using a variation of a mitchell filter that is actually quite efficient at removing the aforementioned hdr aliasing, I actually tried it out in my own renderer. (Developed/invented by jeanphi?)
Thea: don't know, but by visual inspection it looks like the resampling filter has negative lobes, so mitchell/lanczos somethingorother for resampling
I also remember beason mentioning that he used a triangle filter for splatting and box filter for resampling.

I guess perhaps that it all just shows that it's pretty arbitrary in the context of rendering, and comes down to a matter of testing and taste. I'd be excited to be proven wrong though :)

ypoissant
Posts: 97
Joined: Wed Nov 30, 2011 12:44 pm

Re: Optimal combination of filters

Post by ypoissant » Tue Dec 18, 2012 6:01 pm

For downsampling, if the upsample is 2x2, then there is really no use of a triangle filter since all up-sample positions are the same distance from the downsampled pixel. A box filter will be as good as a triangle one. For larger doownsampling ratios, then the triangle filter can make a difference.

Personally, after many years of using Mitchell-Netravali, I finally ditched it. I now use a very simple triangle filter. It has very small support, is fast to compute and does not blur. Given the fine resolution of modern devices, I don't see the need for super reconstruction filters anymore. And I never had to render any of those fancy patterns that are used to show filter performance in any practical applications anyways.

Dade
Posts: 206
Joined: Fri Dec 02, 2011 8:00 am

Re: Optimal combination of filters

Post by Dade » Tue Dec 18, 2012 8:11 pm

ypoissant wrote:Given the fine resolution of modern devices, I don't see the need for super reconstruction filters anymore.
I'm starting to have the same feeling, not only because of modern resolution but also because the huge amount of samples per pixel used in today images (after 20,000 samples, are we really going to need pixel filters or advanced/complex texture maps filters ?).

spectral
Posts: 382
Joined: Wed Nov 30, 2011 2:27 pm
Contact:

Re: Optimal combination of filters

Post by spectral » Wed Dec 19, 2012 1:43 pm

I agree too...

And don't forget that most of the artists will also apply some post-processing to their images... ;-) There are some tools like Nuke etc...
Spectral
OMPF 2 global moderator

Post Reply