computergraphics

10
Computer Graphics Spring 2007, #4 Anti-aliasing

Upload: rajyalakshmi-jammalamadaka

Post on 01-Feb-2016

212 views

Category:

Documents


0 download

DESCRIPTION

matl

TRANSCRIPT

Page 1: ComputerGraphics

Computer Graphics

Spring 2007, #4Anti-aliasing

Page 2: ComputerGraphics

Sampling problem

• For chosen technical reasons a computer screen today consists of finite area pixels with constant properties over the pixel area

• Any mathematically exact object is approximated on the screen by a set of pixels

• Any object is thus undersampled and pixels are not where they should be: aliasing

Page 3: ComputerGraphics

Anti-aliasing

• Typical appearance of aliasing: a straight line or edge is jagged

• Is there any way to improve the result by changing the sampling?

• In principle no: we are often truely losing information when undersampling

• Often expressed as Nyqvist’s theorem: A continuous time signal containing frequencies f ≤ B can be exactly reproduced from samples taken at sampling frequency fS > 2B.

Page 4: ComputerGraphics

Anti-aliasing

• Two basic principles of improving the appearance by slightly blurring the drawing: change the intensities of Bresenham pixels and neighbouring pixels– supersampling (postfiltering)

• we calculate subpixels and then integrate to obtain original pixels

– area sampling (prefiltering)• we calculate pixel intensities without pixellated

quantities

Page 5: ComputerGraphics

Supersampling

• Choose a finer subgrid, 2x2, 3x3, ...• Run your normal line drawing algorithm on

this finer grid.• From the result, calculate the intensity for

the original pixel

20

10 11 12

21

22

X

Y

Page 6: ComputerGraphics

Supersampling

• For each original pixel divided into NxN subpixels, 0 or 1 or 2 or ,.. , or N subpixels will be drawn by the line drawing algorithm. This gives us a natural choice of intensity level [0,N] for each pixel.

• We can also give a relative weight to the subpixel, eg. 2 corresponds to 2/16 = 1/8

1

2 4 2

1 2 1

12

Page 7: ComputerGraphics

Area sampling

• We try to estimate the area of the pixel covered by a rectangle of width one pixel

• Normalizing the area of a pixel to 1.0: the estimated area = the pixel intensity

20

10 11 12

21

22

X

Y

Page 8: ComputerGraphics

Area sampling

• Area estimation: Calcualte the number of subpixels within the rectangle. A subpixel is inside if its lower lefthand corner is inside the rectangle.

Page 9: ComputerGraphics

Anti-aliasing Area Boundaries

• Area boundaries are notoroius for their jaggedness

• Estimate pixel intensities at area boundaries from the fraction of the pixel inside the boundary

• Do this concurrently with scan-line algorithms

Page 10: ComputerGraphics

Anti-aliasing Area Boundaries

• The pixel area covered by the interior of a polygon can sometimes be calculated accurately very quickly: mxk+b-yk+m/2

y = mx + b

xk xk+1

yk

yk+1