[net.graphics] Anti-aliasing

tc@amd.UUCP (Tom Crawford) (12/19/85)

*THIS BE FO' THE LINE-EATER*

One method of drawing anti-aliased lines into a bit map involves
linearly decreasing the intensity as you get further from the ideal
line.  I have heard that this produces an undesirable effect called
the "Barber-pole" or Barbed-Wire" effect.  Anybody know about this?
Got any references?

Please respond by e-mail and I will summarize.  Thanks, as they say,
in advance.

			Tom Crawford
			...amdcad!amd!tc

ken@turtlevax.UUCP (Ken Turkowski) (12/20/85)

In article <2046@amd.UUCP> tc@amd.UUCP (Tom Crawford) writes:
>One method of drawing anti-aliased lines into a bit map involves
>linearly decreasing the intensity as you get further from the ideal
>line.  I have heard that this produces an undesirable effect called
>the "Barber-pole" or Barbed-Wire" effect.  Anybody know about this?
>Got any references?

I call it the twisted-rope effect.  This is because you are using a
poor low-pass filter, which lets in a lot of high-frequency aliases.  I
would instead recommend something that doesn't have sharp
discontinuities in the first derivative like your tent-function does.
I'm particularly fond of a Gaussian that is half-amplitude at
one-pixel's distance from the line.

The class of anti-aliasing you are speaking of goes something like
this:  1) Calculate the perpendicular distance from the pixel to the
line; this NEEDS to be done to sub-pixel resolution.  2) Use this
distance as an argument to a function h() with the following
properties:

	h(0) = 1;
	h(oo) = 0;	(practically, though, h(x)=0, |x| > 1 to 3 pixels)
	h(-r) = h(r)
	h'(|r|) <= 0

If you know what kind of radially-symmetric impulse response g() you
want for your low-pass filter, you can use what I call the Radial Line
Transformation to derive a function that can be used for the lookup.

		 oo	   __________
	h(r) = intgrl  g(\/ r^2 + y^2) dy
		-oo

where g() is the desired radially-symmetric impulse response and h() is
the lookup function.

One of the reasons I like the Gaussian is that the Gaussian transforms
into itself.  I have not tried doing the inverse transform of the tent
function (triangular pulse), but I suspect it has real nasty frequency
characteristics.

Can anybody out there in math-land come up with a formula for the
inversion of this transform?  Is it one-to-one, onto, both or neither?

For more detail, including anti-aliasing for polygons, see:

Turkowski, K.  "Anti-aliasing through the Use of Coordinate
Transformations", ACM Transactions on Graphics, vol. 1, no. 3, July
1982, pp.215-234
-- 
Ken Turkowski @ CIMLINC, Menlo Park, CA
UUCP: {amd,decwrl,hplabs,seismo,spar}!turtlevax!ken
ARPA: turtlevax!ken@DECWRL.DEC.COM