You are on page 1of 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. By an Anti-aliasing process:   Display two or more pixels around the computed location at varying intensities. ½ or ¾ in a recently discovered technique called pixel phasing. or by Dithering rather than a single pixel at the rounded off locations. to make the steps small and many so that the staircase begins to look more like sloping ramp. Shift the pixel by a fraction of the dimension. . ¼. but each jag is half as large in x and y direction.  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.

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

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 .

Perfect bandpass Aliased example 159.235 Graphics 11 . How do we remove aliasing with ? Perfect solution .prefilter perfect bandpass filter. No aliasing.

.

Ideal rasterized line should be 1 pixel wide •Choosing best y for each x (or visa versa) produces aliased raster lines .   Aliasing is caused by finite addressability of the display. Approximation of lines and circles with discrete points often gives a staircase appearance or "Jaggies".

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

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

quantize to many shades but what sampling algorithm is used? .Line Segments   instead.

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

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 .

e. These techniques compute the shades of gray based on how much a pixel’s area is covered by an object.Anti-Aliasing   Two general approaches: Area sampling and supersampling Area sampling approaches sample primitives with a box (or Gaussian. and computes pixel color based on the overlap of the scene’s objects with the pixel’s area i. pixel intensity is determined by calculating the area of overlap of each pixel with the object to be displayed. . 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.

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.Super-sampling  Super-sampling samples at higher resolution.  Supersampling considering zero line width   . 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.

The total line intensity is distributed over more pixels. we can extend the method to take back ground colors into account.Supersampling Considering Finite Line Width    Most of the times line width is equal to the size of pixel instead if zero width. In color displays. we can perform supersampling by setting each pixel intensity proportional to the number of subpixels inside the polygon representing the line area. Advantages :    The number of possible intensity levels for each pixels is equal to the total number of subpixels within the pixel area. A subpixel can be considered to be inside the line if its lower left corner is inside the polygon boundaries. If we take this finite width of line into account. .

Masks can be extended to included contributions from subpixels belonging to neighbouring pixels. An array of values specifying the relative weights of subpixels is sometimes referred to as a mask of subpixel weights. so that intensities can be averaged over adjacent pixels. 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. Such pixel-weighting mask can be set up for larger subpixel grids.Supersampling with pixel-weighting mask     Giving more weight to subpixels near the center of a pixel area.

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

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

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 0 0 .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 0 1/8 .

914 1/8 .Alpha-based Anti-Aliasing  Rather than setting the intensity according to coverage. but with <=1 .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 0  Draw back to front. and composite each primitive over the existing image Only some hidden surface removal algorithms support it . set the   0 0 0 0 0 0 0 1/4 1/4 1/8 0 The pixel gets the line color.

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

Unweighted Area Sampling     primitive cannot affect intensity of pixel if it does not intersect the pixel equal areas cause equal intensity. pixel cut through the center should be more heavily weighted than one cut along corner . 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.

y) x .y)  specifies the contribution of primitive passing through the point (x. y) from pixel center Intensity W(x. W(x.Weighted Area Sampling  weighting function.

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. We integrate over the pixel surface to obtain the weighted average intensity. . but here we consider a continous weighting surface covering the pixel. Pixel Phasing : To shift the display location of the pixel areas.Filtering Techniques     Similar to applying a weighted pixel mask.