March 16, 2005
Filter Differences between FLAM3 and Apophysis
A few days ago I got a
bug report
on FLAM3 from
Robert Joy. He had
done a render with
FLAM3 and with
Apophysis, and the FLAM3 render came out noisier.
Today I had a chance to look into it. I rendered 8 images using a
genome Heaven 20 from Robert. I ran 4 different filter
settings with each of FLAM3 and Apophysis.
- The first pair with oversample 3 and filter radius of 0.2 shows the
difference reported by Robert: the FLAM3 image is grainier.
- In the second pair with oversample 3 and filter 1.0 both have low
noise level, but the FLAM3 image is a bit sharper.
- In the third pair with oversample 1 and filter 1.0 have similar noise
levels, but again the FLAM3 image is sharper. Comparing them with the
2nd pair you can see the effect of the oversampling in reducing the
staircase on the bright white curves.
- The last pair has oversample 1 and filter 0.2 and they look nearly
identical.
So what's happening? The fast answer is yes they differ but
Apophysis is wrong. The filter setting of 0.2 is so narrow that with
oversample 3 it amounts to using only the center one of the nine subpixels.
Ignoring most of your samples makes for more noise. The solution:
use a larger filter!
Why doesn't Apophysis have the same result? I see 3 differences in
the filter code:
- When the FLAM3 code was transliterated from C into Pascal to
create Apophysis, a change was introduced into how the filter is
calculated. Instead of being truncated to an integer it was rounded.
Compare the definition of filter_width in Apophysis
and an old
version of FLAM3. This results in Apophysis sometimes using
larger filters and hence producing blurrier images.
- FILTER_CUTOFF changed from 2.5 to 1.8 in v1.10 on 3/4/2004 and
this change wasn't picked up by Apophysis. This should be just a
performance optimization (smaller filters with less zeroes).
- v1.13 on 3/26/2004 fixed the deficiency where the size of the
filter was truncated to an integer number of subpixels before the
filter weights are calculated. Apophysis didn't pick this one up either.
The bottom line: of all 8 images the one that looks best was rendered
with FLAM3. It also completed about 2x faster than Apophysis. Our
long-range plan is to ditch the apo renderer and have it call a FLAM3
library. In the meantime it wouldn't be hard to update Apophysis and
improve its results. Though I must admit the more I think about it the
more I believe the Right Thing is to rewrite Apophysis in python...
I think it would be reasonable for FLAM3 to print a warning when the
filter radius is "too small". And perhaps to enforce a minimum so
that information is not lost. I'll think about this.
Posted by spot at March 16, 2005 12:57 AM
Thanks Scott for checking into this. I really appreciate your effort. Your explanation makes sense and provides insight into why there are differences. Is it safe to assume that sustantial increases to FR would be a reasonable workaround for this issue (at least with larger oversample values)? You elude to that but don't make a definitive statement about it. If so, would the FR need to be proportionally increased as the image is scaled to larger sizes?
Thanks again,
Robert Joy
well, that sounds like fun scott, i just hope that if you guys do decide to ditch the internal renderer, you make flam3 at least accept the limitvibrancy false script.
just a hope.
Robert: no the filter radius should not be
scaled with the image size.
Just don't use such a small value.
And don't expect the filtering
from apophysis and flam3 to match.