aliasing and anti aliasing

Upload: ph2in

Post on 04-Apr-2018

231 views

Category:

Documents


0 download

TRANSCRIPT

  • 7/30/2019 Aliasing and Anti Aliasing

    1/3

    1

    Computer Graphics & Visualization

    Lecture 3Anti-Aliasing

    PedherJohanssonDepartmentofComputingScience,UmeUniversityComputer Graphics & Visualization

    Overview

    Antialiasing Techniques

    Supersampling

    Areasampling

    - unweighted

    - weighted

    PedherJohanssonDepartmentofComputingScience,UmeUniversityComputer Graphics & Visualization

    Antialiasing

    Aliasing, jagged edges or staircasingcan be reduced by:

    Higherscreenresolution

    - Needahugeframebuffer

    Antialiasingtechniques

    - Varypixelintensitiesalongboundariestosmooththeedge.

    PedherJohanssonDepartmentofComputingScience,UmeUniversityComputer Graphics & Visualization

    Antialiasing Techniques

    Computeintensitiesatsub-pixelgridpositionsandcombinetheresultstoobtainthepixelintensity.

    Findpixelintensitybycalculatingtheareasofoverlapofeachpixelwithintheobjectstobedisplayed.

    Pixelintensityisproportionaltotheamountofareacovered.

    PedherJohanssonDepartmentofComputingScience,UmeUniversityComputer Graphics & Visualization

    Antialiasing Techniques

    Defineaweightingfunctionthatdeterminestheinfluenceontheintensityofthepixel.

    Linesaresmoothedbymovingtheelectronbeamtoacloserapproximateofthemathematicalline.

    PedherJohanssonDepartmentofComputingScience,UmeUniversityComputer Graphics & Visualization

    Supersampling(zero line width)

    Example:astraightlineonagrayscaledisplay

    Divideeachpixelintosub-pixels.

    Thenumberofintensitiesarethemaxnumberofsub-pixelsselectedonthelinesegmentwithinapixel.

  • 7/30/2019 Aliasing and Anti Aliasing

    2/3

    2

    PedherJohanssonDepartmentofComputingScience,UmeUniversityComputer Graphics & Visualization

    Supersamling(finite line width)

    Theintensitylevelforeachpixelis

    proportionaltothenumberofsub-pixelsinsidethepolygonrepresentingthelinearea.

    Lineintensityisdistributedovermorepixels.

    PedherJohanssonDepartmentofComputingScience,UmeUniversityComputer Graphics & Visualization

    Supersamling(finite line width)

    Disadvantages

    Morecalculationsinvolvedtoidentifyinteriorpixels.

    Positioningofthelinedependsontheslopeoftheline.

    - 45 - linecenteredinpolygon

    - Horizontalorverticallineline pathonpolygonboundary

    - |m|1linepathclosertoupperboundary

    PedherJohanssonDepartmentofComputingScience,UmeUniversityComputer Graphics & Visualization

    Unweigted Area Sampling

    Theintensityofapixeldecreasesasthedistancebetweenthepixelcentreandtheedgeincreases.

    Theprimitivemustintersectthepixeltohave

    someeffect. Equalareascontributeequallytothepixelintensity.

    Intensityofapixelisproportionaltoitsareacoveredbytheline

    PedherJohanssonDepartmentofComputingScience,UmeUniversityComputer Graphics & Visualization

    Weighted Area Sampling

    Equalareascancontributetounequalintensity.

    (Wechangeproperty3)

    Circularpixelgeometry.

    PedherJohanssonDepartmentofComputingScience,UmeUniversityComputer Graphics & Visualization

    Weighting (Filter) Function

    DeterminestheinfluenceontheintensityofapixelofagivensmallareadA ofaprimitive.

    Thisfunctionisconstantforunweightedanddecreaseswithincreasingdistanceforweighted.

    Totalintensityistheintegraloftheweighting(filter)functionovertheareaofoverlap.

    Wsisthevolume(alwaysbetween0and1)

    I = Imax

    Ws

    PedherJohanssonDepartmentofComputingScience,UmeUniversityComputer Graphics & Visualization

    Unweighted Area Sampling

    Box Filter:

    Wsisawedgeofthebox.

    Heightoftheboxnormalizesto1(boxvolume=1)

    Athicklinecoveringtheentirepixelhasintensity:

    I = Imax

    1 = Imax

  • 7/30/2019 Aliasing and Anti Aliasing

    3/3

    3

    PedherJohanssonDepartmentofComputingScience,UmeUniversityComputer Graphics & Visualization

    Weighted Area Sampling

    Cone Filter: Acircularcone,wherethebaseistheradiusoftheunitdistanceoftheintegergrid.

    Rotationalsymmetry.

    Lineardecreaseofthefunctionwithradialdistance.

    Normalizedto1(volumeunderentireconeis1)

    PedherJohanssonDepartmentofComputingScience,UmeUniversityComputer Graphics & Visualization

    Filter Functions

    Optimalfiltersarecomputationallymore

    expensive. Conefiltersareaveryreasonablecompromisebetweencostandquality.

    PedherJohanssonDepartmentofComputingScience,UmeUniversityComputer Graphics & Visualization

    Anti-Aliasing

    Pixel Phasing:

    Pixelpositionscanbeshiftedbyafractionofapixeldiameter(1/4,1/2,or3/4)toplotpointsclosertothemathematicalline.

    Line Intensity Differences:

    Thediagonallineappearslessbrightthanthehorizontal.(Thediagonallineislongerthanthehorizontallinebyafactorofsqrt(2)).

    - Totalintensityisproportionaltotheirlength.