Anda di halaman 1dari 25

Implementing Methods for Antiliasing

Aliasing in Computer Graphics


Digital technology can only approximate analog signals through a process known as sampling The distortion of information due to low-frequency sampling (undersampling) Choosing an appropriate sampling rate depends on data size restraints, need for accuracy, the cost per sample Errors caused by aliasing are called artefacts. Common aliasing artefacts in computer graphics include jagged profiles, disappearing or improperly rendered fine detail, and disintegrating textures.

Antialiasing Examples

A Razdan and Peter Wonka

Photography

Scanning

Display

Analog Image

Digital Image

Analog Image

Graphics

Rendering

Display

Symbolic Image

Digital Image

Analog Image

Sampling and Reconstruction

Continuous Image

Sampling

Discrete Samples

Reconstruction

Continuous Image

p Sampling Function

p Reconstruction Kernel

Antialiasing Strategies
Aliasing, jagged edges or staircasing can be reduced by: Higher screen resolution Need a huge frame buffer Antialiasing techniques Vary pixel intensities along boundaries to smooth the edge
Super Sampling (postfiltering) Compute intensities at sub-pixel grid positions and combine the results to obtain the pixel intensity. Area Sampling (prefiltering) Find pixel intensity by calculating the areas of overlap of each pixel within the objects to be displayed.

Antialiasing Strategies
Pixel phasing Shifting the display location of pixel areas Weighting Masks Predefined table values for each subpixel Filtering Techniques Includes neighbouring pixels Filter Functions Optimal filters are computationally more expensive. Cone filters are a very reasonable compromise between cost and quality

What is a poor sampling frequency?


Nyquist Sampling Frequency: fs = 2 fmax xs = xcycle / 2 fs : Nyquist Sampling Frequency fmax : maximum frequency component in signal xs : Nyquist Sampling Interval xcycle : Cycle interval To avoid losing information we need to set sampling frequency to at least twice the highest frequency component of signal.
amplitude

x, f = 1/x t, f = 1/t

space or time

supersampling straight-line segments subpixel weighting masks area sampling straight-line segments filtering techniques compensating for line-intensity differences antialiasing area boundaries
(adjusting boundary pixel positions) adjusting boundary pixel intensity

Antialiasing Strategies

10

Supersampling straight-line segments


Divide each pixel into a number of subpixels Count the number of the subpixels that overlap the line path Intensity is applied proportional to the subpixel count Subpixels are selected by bresenham s algorithm Pixels divided into 9 subpixels The number of subpixelsthat can be selected within any pixel is 3, 2, or 1 Thus, there are three level of intensity (level 3, 2, and 1) Pixel (10, 20) set to maximum intensity (level 3) Pixels (11, 21) and (12, 21) set to level 2 Pixels (11, 20) and (12, 22) set to level 1

Supersampling straight-line segments


Pixel intensity is set proportional to the number of subpixels inside the polygon representing the line area. The subpixel is inside the line if its lower-left corner is inside the polygon boundaries Advantage: number of intensity level = number of subpixels The background colors can be taken into account For example: if 5 subpixels are inside a red line and 4 subpixels are fall in the blue background then: pixelcolor = (5.red + 4.blue)/9

Antialiasing: Supersampling Lines

0 0 1 0 2 2 3 1 0
thin line 3 = max. intensity ... 0 = min. intensity

0 0 4 1 6 8 8 5 0
line of finite width 9 = max. intensity ... 0 = min. intensity
13

Antialiasing

Antialiasing: Area Sampling Lines


calculate the pixel coverage exactly can be done with incremental schemes

0% 0% 43 15 71 84 90 52 3%

15

Antialiasing: Pixel Weighting Masks

more weight for center subpixels must be divided by sum of weights subpixel grids can also include some neighboring pixels relative weights for a grid of 3x3 subpixels
16

Pixel phasing On raster systems that can address subpixel positions, pixel facing can be used to antialiasing A line is smoothed by moving pixel position closer to the line path The electron beam can be shifted by a fraction of pixel diameter The fraction may be , , or of pixel diameter

Antialiasing: Filtering Techniques


More accurate method Similar to weighted pixel but we imagine a continuous weighting surface (or filter function) covering the pixel We integrate over the pixel surface to obtain the weighted average pixel

Antialiasing: Compensating for Intensity Differences


unequal line lengths displayed with the same number of pixels in each line/row have different intensities proper antialiasing compensates for that!

Antialiasing area boundaries


Area boundaries can be smoothed by adjusting pixel intensity at a boundary position according to the percent of the pixel area that is interior to the object pixel(x, y) about half of its area is inside the polygon, therefore, the intensity would be of the maximum intensity pixel (x+1, y+1) intensity is adjusted to about 1/3 of the maximum

Antialiasing area boundaries


Supersampling can be applied by determining the number of the subpixels in the interior 4X4 grid of pixel can be turned into 8X8 grid . 8 scan-lines are processed instead of 4 scan lines Along the two scan-lines there are three sub pixel inside the boundary, so the pixel intensity is 75% of maximum intensity

Antialiasing area boundaries


Pitteway and Watkinson algorithm based on midpoint algorithm The next pixel is selected by testing the midpoint between two pixels The parameter p is setup, whose sign determine which of the two pixels is closer to line path Modifying p gives the percentage of the current pixel area

Antialiasing Area Boundaries p = y ymid = [m(xk + 1) + b] (yk + 0.5) p<0 y closer to yk p>0 y closer to yk+1 y ymid p = p+ (1m) p<1m y closer to yk p>1m y closer to yk+1 ( and p [0,1] )
23

Antialiasing Area Boundaries


p = p+(1-m) = [m(xk + 1) + b] (yk + 0.5) + (1 m) = = mxk + b yk + 0.5

24

Figure 6-69 Overlap area of a pixel rectangle, centered at position (xk, yk), with the interior of a polygon fill area.

Anda mungkin juga menyukai