Sie sind auf Seite 1von 31

Antialiasing

Samples

most things in the real world are continuous everything in a computer is discrete the process of mapping a continuous function to a discrete one is called sampling the process of mapping a discrete function to a continuous one is called reconstruction the process of mapping a continuous variable to a discrete one is called discretization rendering an image requires sampling and discretization displaying an image involves reconstruction

What is Anti-aliasing

Anti-aliasing is a method of fooling the eye that a jagged edge is really smooth. Anti-aliasing bring a much more pleasing image to the eye. The aliasing effect can be minimized by increasing resolution of the raster display.

Approaches

To increase the resolution to such an extent that more pixels become available to coincide with the computed values, to make the steps small and many so that the staircase begins to look more like sloping ramp. By an Anti-aliasing process:

Display two or more pixels around the computed location at varying intensities, or by Dithering rather than a single pixel at the rounded off locations. Shift the pixel by a fraction of the dimension, , or in a recently discovered technique called pixel phasing.

By increasing resolution and making it twice the original one, the line passes through twice as many column of pixels and therefore has twice as many jags, but each jag is half as large in x and y direction.

Images

an image is a 2D function I(x, y) that specifies intensity for each point (x, y)

Continuous Luminosity Signal

Slide Rosalee Nerheim-Wolfe

Sampled Luminosity

Slide Rosalee Nerheim-Wolfe

Reconstructed Luminosity

Slide Rosalee Nerheim-Wolfe

Reconstruction Artefact

Slide Rosalee Nerheim-Wolfe

Aliasing in the space domain


Original signal

Aliased result

Summary : Aliasing is the appearance of spurious signals when the frequency of the input signal goes above the Nyquist limit.
159.235 Graphics 10

How do we remove aliasing with ? Perfect solution - prefilter perfect bandpass filter.

No aliasing.

Perfect bandpass

Aliased example

159.235

Graphics

11

Aliasing is caused by finite addressability of the display. Approximation of lines and circles with discrete points often gives a staircase appearance or "Jaggies". Ideal rasterized line should be 1 pixel wide

Choosing best y for each x (or visa versa) produces aliased raster lines

Antialiasing by Area Averaging Color multiple pixels for each x depending on coverage by ideal line

Line Segments

If we tried to sample a line segment so it would map to a 2D raster display we would see stair steps, or jaggies since we quantized the pixel values to 0 or 1.

Line Segments

instead, quantize to many shades but what sampling algorithm is used?

Aliasing

The effect created when rasterization is performed over a discrete series of pixels. In particular, when lines or edges do not necessarily align directly with a row or column of pixels, that line may appear unsmooth and have a stair-step edge appearance. Antialiasing utilizes blending techniques to blur the edges of the lines and provide the viewer with the illusion of a smoother line. Points, lines or polygons can be antialiased.

Classification of antialiasing methods

Antialiasing methods

Super sampling or Post filtering

Area sampling or pre filtering

Filtering Techniques

Pixel Phasing

Considering zero line width

Considering finite line width

With pixel weighing mask

Unweighted

Weighted

Anti-Aliasing

Two general approaches: Area sampling and supersampling Area sampling approaches sample primitives with a box (or Gaussian, or whatever) rather than spikes

Requires primitives that have area (lines with width) Sometimes referred to as pre-filtering Treats a pixel as an area, and computes pixel color based on the overlap of the scenes objects with the pixels area i.e. pixel intensity is determined by calculating the area of overlap of each pixel with the object to be displayed. These techniques compute the shades of gray based on how much a pixels area is covered by an object.

Super-sampling

Super-sampling samples at higher resolution, then filters down the resulting image

Sometimes called post-filtering The prevalent form of anti-aliasing in hardware More than one sample is sampled per pixel. Every pixel area on the display surface is assumed to be subdivided into a grid of the sub pixels. Divide each pixel into a number of subpixels and count the number of subpixel that are along the line path. Intensity level for each pixel is set to a value that is proportional to this subpixel count.

Supersampling considering zero line width

Supersampling Considering Finite Line Width

Most of the times line width is equal to the size of pixel instead if zero width. If we take this finite width of line into account, we can perform supersampling by setting each pixel intensity proportional to the number of subpixels inside the polygon representing the line area. A subpixel can be considered to be inside the line if its lower left corner is inside the polygon boundaries. Advantages :

The number of possible intensity levels for each pixels is equal to the total number of subpixels within the pixel area. The total line intensity is distributed over more pixels. In color displays, we can extend the method to take back ground colors into account.

Supersampling with pixel-weighting mask

Giving more weight to subpixels near the center of a pixel area, since we consider these subpixels to be more important in determining the overall intensity of a pixel. Center subpixel has four time weight that of the corner subpixels and twice that of remaining pixel. An array of values specifying the relative weights of subpixels is sometimes referred to as a mask of subpixel weights. Such pixel-weighting mask can be set up for larger subpixel grids. Masks can be extended to included contributions from subpixels belonging to neighbouring pixels, so that intensities can be averaged over adjacent pixels.

Unweighted Area Sampling

In line drawing algorithm selects the pixel which is closer to the true line. So in this method instead of picking closest pixel both pixels can be highlighted. However their intensity values may differ. Intensity of pixel is proportional to the amount of line area occupied by the pixel. Produces better results than does setting pixels either to full intensity or to zero intensity.

Weighted area sampling

Equal areas contributed in weighted i.e. a small area closer to the pixel center has greater intensity than does one at a greater distance. Intensity of the pixel is dependent on the line area occupied and the distance of area from the pixels center.

Unweighted Area Sampling

Consider a line as having thickness (all good drawing programs do this) Consider pixels as little squares Fill pixels according to the proportion of their square covered by the line Other variations weigh the contribution according to where in the square the primitive falls

0
0

0 1/8
.914 1/4

0
1/8

0 1/4
.914 1/4

0 1/4
1/8 .914 1/8

0 0 0

0 0

Alpha-based Anti-Aliasing

Rather than setting the intensity according to coverage, set the

0 0 0 0

0 0 0
1/4 1/4

1/8

The pixel gets the line color, but with <=1

.914 1/8

.914 1/4 0

This supports the correct drawing of primitives one on top of the other

1/8 .914 1/4 1/8

0 0

0 0

Draw back to front, and composite each primitive over the existing image Only some hidden surface removal algorithms support it

Super-sampling

Sample at a higher resolution than required for display, and filter image down Issues of which samples to take, and how to average them 4 to 16 samples per pixel is typical Samples might be on a uniform grid, or randomly positioned, or other variants Number of samples can be adapted

Unweighted Area Sampling

primitive cannot affect intensity of pixel if it does not intersect the pixel equal areas cause equal intensity, regardless of distance from pixel center to area unweighted sampling colors two pixels identically when the primitive cuts the same area through the two pixels intuitively, pixel cut through the center should be more heavily weighted than one cut along corner

Weighted Area Sampling

weighting function, W(x,y)

specifies the contribution of primitive passing through the point (x, y) from pixel center

Intensity W(x,y)

Filtering Techniques

Similar to applying a weighted pixel mask, but here we consider a continous weighting surface covering the pixel. We integrate over the pixel surface to obtain the weighted average intensity. Pixel Phasing : To shift the display location of the pixel areas. It is applied by micropositioning the electron beam in relation to object geometry. In this technique stairsteps along a line path or object boundary are smoothed out by moving the electron beam to mare nearly approximate positions specified by the object geometry.