Pixel filters with negative weights - is there a solution?

Practical and theoretical implementation discussion.
spectral
Posts: 382
Joined: Wed Nov 30, 2011 2:27 pm
Contact:

Re: Pixel filters with negative weights - is there a solutio

Post by spectral » Tue May 08, 2012 12:07 pm

Here is a discussion about your problem : http://www.luxrender.net/forum/viewtopi ... =16&t=7816

They suggest to reduce the sharpness of the filter, because it seems that high-contrast (even with undesired effect) is the filter purpose.
Spectral
OMPF 2 global moderator

davepermen
Posts: 48
Joined: Fri Dec 02, 2011 12:21 pm

Re: Pixel filters with negative weights - is there a solutio

Post by davepermen » Tue May 08, 2012 12:53 pm

filtering after hdr -> ldr is not an option, i guess?

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

Re: Pixel filters with negative weights - is there a solutio

Post by ingenious » Tue May 08, 2012 1:32 pm

spectral wrote:Have you try to "reject" the sample, instead of clamping the color ?

Honnestly I don't understand the meaning of a negative weight !
You cannot reject evey sample that is weighed negatively - this would defeat the purpose of the filter. There's a motivation for negative weighting in PBRT and i Mitchel's original paper from around the 1990. In short, such kernels with negative weights act both as blurring and as sharpening (Laplacian) filters, which prevents over-smoothing of sharp features.
spectral wrote:Here is a discussion about your problem : http://www.luxrender.net/forum/viewtopi ... =16&t=7816

They suggest to reduce the sharpness of the filter, because it seems that high-contrast (even with undesired effect) is the filter purpose.
But this is not a real solution, as it will increase blurring.
davepermen wrote:filtering after hdr -> ldr is not an option, i guess?
This would mean to apply tone mapping on the raw image plane samples. This is theoretically possible, but this means you have to store and process them individually, which might be intractable, especially if you have more than a dozen per pixel.
Image Click here. You'll thank me later.

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

Re: Pixel filters with negative weights - is there a solutio

Post by spectral » Tue May 08, 2012 1:58 pm

You're right :-P

But the mitchell filter work this way... by definition. I'm not sure that there is a way to "know" when this "sharp effect" is desired or not !
For sure, working in LDR should help... to test use the first pass of your renderer and apply the mitchell-filter in GIMP !

So, maybe it will be better to use a gaussian filter... or a cubic one to keep the kernel size to 2 !

Or maybe you have to "intelligently clamp" your negative value (filter*color) to avoid too high negative values ! (I don't like this !!!)
Spectral
OMPF 2 global moderator

madd
Posts: 8
Joined: Mon Nov 28, 2011 12:51 pm

Re: Pixel filters with negative weights - is there a solutio

Post by madd » Tue May 08, 2012 2:32 pm

Why not just stick with filters with non-negative weights, eg. box or cook? Are the other filters really that much better in practice?

According to http://randomcontrol.com/forum/showthre ... -revisited, fryrender has switched from mitchell to box filtering. Also, see last post by "chema" on that page.

Serendipity
Posts: 37
Joined: Mon Dec 19, 2011 9:50 pm

Re: Pixel filters with negative weights - is there a solutio

Post by Serendipity » Tue May 08, 2012 4:23 pm

A box filter is really the worst reconstruction filter and produces a lot of aliasing so it would really surprise me if they use that one. However, I second not to use any filters that use negative weights, in my opinion a triangle or gaussian filter is the best option.
If you really want to use these I would probably try to clamp negative values to a certain limit like -1.0 or -sqrt(number of samples) so you have a chance to get rid of negative values with enough samples and still have the sharpening on the image regions that are not so difficult.

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

Re: Pixel filters with negative weights - is there a solutio

Post by spectral » Tue May 08, 2012 6:45 pm

The problem with clamping is that you don't preserve the energy with this kind of filter... so for me it is better to avoid them... in some cases !

When you check the randomcontrol page, I don't really agree that they have improved their AA... in some cases you see more blur ! Anyway a filter is a question of taste... so it is always better to allow the use to choice by himself !

Does someone has already try some kind of 'adaptative filtering', so, based on the contrast (and other informations...) you choose a specific filter for each pixel ! Maybe be using a kind of 'bootstrap' phase (like mlt) to analyse the scene general 'style' and then you choose one !
Spectral
OMPF 2 global moderator

beason
Posts: 52
Joined: Sat Dec 10, 2011 1:58 am
Location: Los Angeles, CA

Re: Pixel filters with negative weights - is there a solutio

Post by beason » Tue May 08, 2012 7:16 pm

madd wrote:According to http://randomcontrol.com/forum/showthre ... -revisited, fryrender has switched from mitchell to box filtering. Also, see last post by "chema" on that page.
Hah, sounds like they do what I do. Render a higher-resolution image internally with whatever filter you want (in my case, triangle), tonemap, then downsample with boxfilter/averaging. Works beautifully. I'm not the first to do this though, I think this was suggested on the indigo blog.
spectral wrote: When you check the randomcontrol page, I don't really agree that they have improved their AA... in some cases you see more blur !
Where do you see more blur?

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

Re: Pixel filters with negative weights - is there a solutio

Post by ingenious » Tue May 08, 2012 9:57 pm

Well, I think rendering in higher resolution and downscaling after tone mapping is pretty much the standard solution to the high-energy aliasing problem.

But OK, what wanted to know was whether there's any good solution to the black halo problem with negative weights. So far, the bloom seems as the only reasonable option.
Image Click here. You'll thank me later.

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

Re: Pixel filters with negative weights - is there a solutio

Post by spectral » Wed May 09, 2012 6:35 am

beason wrote:Where do you see more blur?
In the guitar picture, on the right small picture, sometimes the "lines" looks larger... sometimes not !
It seems that sometimes the previous algorithm produce better results, sometimes not !
Spectral
OMPF 2 global moderator

Post Reply