| | | |
Anti-aliasing and Fractals
| | |
|
| | | |
ne
of the biggest problems with exploring
fractals is that fractal software must try to
represent an infinitely-detailed object (the
fractal) on a finitely-detailed grid (your
computer screen). Anti-aliasing is a technique
that has long been applied to rendering 3D
scenes and text; it has useful applications in
rendering fractals, too.
| | |
To explain this will require a little theory.
(Don't worry, I'll leave the math out of it.)
Converting a continuous object like a
fractal or a picture into a computer image
involves a process called sampling,
where each point in the computer image (a
pixel) is made from a sample of
the original, infinitely-detailed object.
This sample represents the color of the object
at that precise point.
The problem is what happens when you have
details in the image you're trying to sample
that are smaller than the space between your
samples. You can't accurately represent those
details in your sampled image. As an example,
let's use a checkerboard pattern. The image
at right shows five different checkerboards.
The largest checkerboard has
squares that are 17 pixels on a side; each
following checkerboard has smaller and smaller
squares. The last two have squares that are
just over 1 pixel, and just over half a pixel.
Notice how when the squares are just bigger than
one pixel, an extra "pattern" is visible, and
when the squares are much smaller than a pixel,
the sampling process messes up completely and
the squares actually look bigger! This
is known as aliasingwhere elements
(the small squares) with frequencies too high to
be shown in the sampling grid are misrepresented
instead as elements of lower frequency that can
be displayed (the bigger squares you see in the
last checkerboard).
Anti-aliasing is the process of eliminating
the aliasing.
| | |
| | |
The basic idea behind most anti-aliasing techniques
is to use more samples than you really need,
and mix the results together. In our checkerboard
example, this would be like sampling our checkerboard,
not once per pixel, but four or sixteen times, with
each sample coming from a slightly different location
within the pixel. Once all the extra samples are
taken, they are averaged together and this final
value is used. Now we shouldn't have aliasing until
detail sizes are smaller than our new sample size.
You can see the results at left; these are the same
size checkerboards as the original example, but this
time, anti-aliasing was used. The results are clearly
a lot better, especially at the smallest size, where
the squares in the checkerboard are less than one pixel
wide. You just see a grey slate. (Imagine you are
looking at such a checkerboard from far off; you
wouldn't see individual squares, but an overall grey
color, the average of light and dark squares.)
Plenty. Fractals are infinitely detailed.
That means that no matter how fine the sampling grid,
there will always be some aliasing, because
there are still details too small for the sampling
grid to represent. Sometimes, the aliasing can be
very distractingas a fractal explorer, I know
that a certain fractal has detail too fine to see, but
that detail just becomes "mush" because there's
no anti-aliasing.
| | |
Take, for example, the images at right. You can't
tell what's at the center of the spiral, because it
just turns to mush when the details get smaller
than a pixel. Underneath it is an anti-aliased
version; although you can't make out the finer
details at the center of the spiral, you can see
the overall details that are bigger. Not only is
this more pleasing to the eye, it is also a "truer"
representation of the fractal image, since it
removes the aliasing "artifacts".
One serendipitous side-effect to anti-aliasing is
that although it results in a 24-bit image (instead
of the original 8-bit image) it actually compresses
better as a JPEG than the originalnot
only is the file size smaller (20K instead of 53K)
but the anti-aliasing helps cut down on the
artifacting that you normally get when you save
a fractal in JPEG format.
It's easiest if your software does it for you.
Fractal eXtreme
and Ultra Fractal
will anti-alias when creating "poster" images.
Still, if your fractal software of choice won't
anti-alias for you, you're not completely out of
luck. To anti-alias, you need more samples; no
problem, just render the fractal bigger than you
really want it. For example, if you want to show
a 640x480 image, render it at twice that size or
more. (I often use 1600x1200 with FractInt.) If
you can't set your video display at that high a
resolution, see if your fractal software has a
render-to-disk option and use that. Then take
your large image, and use a graphics program like
Paint Shop Pro
to resize the image.
Here are two important tips to help you produce
good anti-aliased images with graphics software.
First, after loading the image, make sure you
convert it to 24-bit color before resizing.
Otherwise these programs won't use anti-aliasing
as they resize. Second, apply a slight sharpening
effect after the resize, to counteract some of the
softening the anti-aliasing produces.
| | |
Almost all of the images here at fractalus.com
were anti-aliased in this way. In case you're not
convinced this produces better images, here are
a few more examples. Aliased images are on the
left, anti-aliased images are on the right.
| |
|