33
Anti-aliasing Lecture notes provided by Chris Handley

Anti-aliasing · 2012. 2. 21. · • Typically results improve as complexity of the function increases. • Law of Diminishing Returns. L21:30 What do you notice about this picture?

  • Upload
    others

  • View
    0

  • Download
    0

Embed Size (px)

Citation preview

  • Anti-aliasing

    Lecture notes provided byChris Handley

  • L21: 2

    What is going on here?

  • L21: 3

    … and here?

  • L21: 4

    JPEG

    • Lossy compression format.• What do we mean by ‘lossy’?• Lose detail, i.e. high spatial frequencies.• What do we mean by ‘high spatial

    frequencies’.

  • L21: 5

  • L21: 6

  • L21: 7

    What is happening

  • L21: 8

    Remember this?

  • L21: 9

    and this?

  • L21:10

    Aliasing

    • Ray tracing gives a colour for every pixel in the image

  • L21:11

    Aliasing

    • Ray tracing gives a colour for every pixel in the image, but …

  • L21:12

    Aliasing

    • Ray tracing gives a colour for every pixel in the image, but …

    • … a pixel contains an infinite number of points.

  • L21:13

    Aliasing

    • Ray tracing gives a colour for every pixel in the image, but …

    • … a pixel contains an infinite number of points.

    • These points may not all map to the same colour in the scene.

  • L21:14

    So what is Aliasing?

    • Technically, it is any one of several different effects that arise when we under-sample a signal.

    • Easiest example (and known to all of you) is the ‘staircase’ effect of a line on a pixelised display.

    • Commonly referred to as the jaggies.

  • L21:15

    Antialiasing

    • Antialiasing is the name given to a group of techniques which attempt to remove or mitigate the jagged effect of aliasing.

    • Techniques include supersampling, area sampling and various filtering techniques.

  • L21:16

    Jaggies

  • L21:17

    Supersampling

    • Divide each pixel into a number of smaller (subpixel) elements.

    • Determine the colour and/or intensity of each subpixel and sum to determine the resulting colour/intensity.

    • Has the effect of increasing screen resolution.

  • L21:18

    Supersampling

  • L21:19

    Supersampling

  • L21:20

    Supersampling

  • L21:21

    Supersampling with finite width

    • This presupposes a ‘mathematical’ line, i.e. infinitesimally narrow. However, all lines on the screen must be at least one pixel wide.

    • We get a better result if we take the width into account and colour pixels accordingly.

  • L21:22

    Supersampling with finite width

  • L21:23

    Supersampling with finite width

  • L21:24

    Things to think about

    • What do we do if the background is not white and/or the line is not black?

    • How do we determine if a subpixel is within the boundary of the line and by how much?

  • L21:25

    Area Sampling

    • Supersampling a line of finite width is really just an approximation to area sampling.

    • We can calculate the area of overlap analytically — at the cost of increased complexity.

    • This will allow us even more intensity levels which should result in a better line.

  • L21:26

    Area Sampling

    A

    A2

    A1

  • L21:27

    Filtering

    • Can reduce effects of aliasing.• Common filters include:

    –Box (mean) filter, i.e. area sampling,–Subpixel weighted filters, i.e. weighted

    supersampling, –Weighted function filters.

  • L21:28

    Subpixel weighted filters

    • Each sub-pixel is given a different weight depending on how close it is to the centre of the pixel, e.g.:

    1 2 12 4 21 2 1

  • L21:29

    Weighted function filters

    • Can think of area sampling (box filter) as using a cube as the function.

    • Other functions include the cone, quadratic(?), Gaussian, etc.

    • Typically results improve as complexity of the function increases.

    • Law of Diminishing Returns.

  • L21:30

    What do you notice about this picture?

  • L21:31

    Line Intensity Differences

    • The length (and hence the area) of a line depends on its orientation.

    • Diagonal lines are 40% (√2 ≈ 1.414) longer than horizontal or vertical lines.

    • However they contain the same number of pixels, so they display at a lower intensity.

    • Antialiasing automatically adjusts for these intensity differences.

  • L21:32

    Antialiasing Area Boundaries

    • All that we have said for lines applies to area boundaries.

    • Supersampling or overlap area estimation works the best.

    • Care needs to be taken if polygons are small enough that more than one edge passes through a pixel.

  • L21:33

    Next LectureOpenGL™ and the

    GL pipeline