Top Banner

of 40

2007.10.02 CS248-03 Sampling and Aliasing

Apr 14, 2018

Download

Documents

Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
  • 7/30/2019 2007.10.02 CS248-03 Sampling and Aliasing

    1/40

    Sampling and Aliasing

    Kurt Akeley

    CS248 Lecture 3

    2 October 2007

    http://graphics.stanford.edu/courses/cs248-07/

  • 7/30/2019 2007.10.02 CS248-03 Sampling and Aliasing

    2/40

    CS248 Lecture 3 Kurt Akeley, Fall 2007

    Aliasing

    Aliases are low frequencies in a renderedimage that are due to higher frequenciesin the original image.

  • 7/30/2019 2007.10.02 CS248-03 Sampling and Aliasing

    3/40

    CS248 Lecture 3 Kurt Akeley, Fall 2007

    Jaggies

    Are jaggies due to aliasing? How?

    Original:

    Rendered:

  • 7/30/2019 2007.10.02 CS248-03 Sampling and Aliasing

    4/40

    CS248 Lecture 3 Kurt Akeley, Fall 2007

    Demo

  • 7/30/2019 2007.10.02 CS248-03 Sampling and Aliasing

    5/40

    CS248 Lecture 3 Kurt Akeley, Fall 2007

    What is a point sample (aka sample)?

    An evaluation

    At an infinitesimal point (2-D)

    Or along a ray (3-D)

    What is evaluated

    Inclusion (2-D) or intersection (3-D)

    Attributes such as distance and color

  • 7/30/2019 2007.10.02 CS248-03 Sampling and Aliasing

    6/40

    CS248 Lecture 3 Kurt Akeley, Fall 2007

    Why point samples?

    Clear and unambiguous semantics

    Matches theory well (as well see)

    Supports image assembly in the framebuffer

    will need to resolve visibility based on distance,

    and this works well with point samples

    Anything else just puts the problem off

    Exchange one large, complex scene for manysmall, complex scenes

  • 7/30/2019 2007.10.02 CS248-03 Sampling and Aliasing

    7/40CS248 Lecture 3 Kurt Akeley, Fall 2007

    Fourier theory

    Fouriers theorem is not only one of the most

    beautiful results of modern analysis, but itmay be said to furnish an indispensableinstrument in the treatment of nearly everyrecondite question in modern physics.

    -- Lord Kelvin

  • 7/30/2019 2007.10.02 CS248-03 Sampling and Aliasing

    8/40CS248 Lecture 3 Kurt Akeley, Fall 2007

    Reference sources

    Marc Levoys notes

    Ronald N. Bracewell, The Fourier Transform and itsApplications, Second Edition, McGraw-Hill, Inc.,1978.

    Private conversations with Pat HanrahanMATLAB

  • 7/30/2019 2007.10.02 CS248-03 Sampling and Aliasing

    9/40CS248 Lecture 3 Kurt Akeley, Fall 2007

    Ground rules

    You dont have to be an engineer to get this

    Were looking to develop instinct / understanding

    Not to be able to do the mathematics

    Well make minimal use of equations

    No integral equations

    No complex numbers

    Plots will be consistent

    Tick marks at unit distances

    Signal on left, Fourier transform on the right

  • 7/30/2019 2007.10.02 CS248-03 Sampling and Aliasing

    10/40CS248 Lecture 3 Kurt Akeley, Fall 2007

    Dimensions

    1-D

    Audio signal (time)

    Generic examples (x)

    2-D

    Image (x and y)

    3-D

    Animation (x, y, and time)

    All examples in this presentation are 1-D

  • 7/30/2019 2007.10.02 CS248-03 Sampling and Aliasing

    11/40CS248 Lecture 3 Kurt Akeley, Fall 2007

    Fourier series

    Any periodic function can be exactly

    represented by a (typically infinite) sumof harmonic sine and cosine functions.

    Harmonics are integer multiples of thefundamental frequency

  • 7/30/2019 2007.10.02 CS248-03 Sampling and Aliasing

    12/40CS248 Lecture 3 Kurt Akeley, Fall 2007

    Fourier series example: sawtooth wave

    ( )( )

    ( )

    1

    1

    12sin

    n

    n

    f x n xn

    pp

    +

    =

    -=

    1

    1-1

  • 7/30/2019 2007.10.02 CS248-03 Sampling and Aliasing

    13/40

    CS248 Lecture 3 Kurt Akeley, Fall 2007

    Sawtooth wave summation

    Harmonics Harmonic sums

    1

    2

    3

    n

  • 7/30/2019 2007.10.02 CS248-03 Sampling and Aliasing

    14/40

    CS248 Lecture 3 Kurt Akeley, Fall 2007

    Sawtooth wave summation (continued)

    Harmonics Harmonic sums

    5

    10

    50

    n

  • 7/30/2019 2007.10.02 CS248-03 Sampling and Aliasing

    15/40

    CS248 Lecture 3 Kurt Akeley, Fall 2007

    Fourier integral

    Any function (that matters in graphics)can be exactly represented by an

    integration of sine and cosine functions.

    Continuous, not harmonic

    But the notion of harmonics willcontinue to be useful

  • 7/30/2019 2007.10.02 CS248-03 Sampling and Aliasing

    16/40

    CS248 Lecture 3 Kurt Akeley, Fall 2007

    Basic Fourier transform pairs

    1 ( )sd

    f(x) F(s)

    ( )cos xp II(s)

  • 7/30/2019 2007.10.02 CS248-03 Sampling and Aliasing

    17/40

    CS248 Lecture 3 Kurt Akeley, Fall 2007

    Reciprocal property

    Swappedleft/right fromprevious slide

    f(x) F(s)

    1

    ( )cos xp

    ( )sd

    II(s)

  • 7/30/2019 2007.10.02 CS248-03 Sampling and Aliasing

    18/40

    CS248 Lecture 3 Kurt Akeley, Fall 2007

    Scaling theorem

    ( )cos 2 xp

    cos

    2

    xp

    II(2s)

    II(s/2)

    f(x) F(s)

  • 7/30/2019 2007.10.02 CS248-03 Sampling and Aliasing

    19/40

    CS248 Lecture 3 Kurt Akeley, Fall 2007

    Band-limited transform pairs

    ( )s

    F(s)f(x)

    sinc(x)( )sin x

    x

    p

    p ( )s

    sinc2(x)

  • 7/30/2019 2007.10.02 CS248-03 Sampling and Aliasing

    20/40

    CS248 Lecture 3 Kurt Akeley, Fall 2007

    Finite / infinite extent

    If one member of the transform pair is finite, the otheris infinite

    Band-limited infinite spatial extent Finite spatial extent infinite spectral extent

  • 7/30/2019 2007.10.02 CS248-03 Sampling and Aliasing

    21/40

    CS248 Lecture 3 Kurt Akeley, Fall 2007

    Convolution

    ( ) ( ) ( ) ( )f x g x f u g x u du

    -

    * = -

  • 7/30/2019 2007.10.02 CS248-03 Sampling and Aliasing

    22/40

    CS248 Lecture 3 Kurt Akeley, Fall 2007

    Convolution example

    *

    =

  • 7/30/2019 2007.10.02 CS248-03 Sampling and Aliasing

    23/40

    CS248 Lecture 3 Kurt Akeley, Fall 2007

    Convolution theorem

    Letfandgbe the transforms offandg. Then

    f g f g* =

    f g f g = *

    f g f g* =

    f g f g = *

    Something difficult to do in one domain(e.g., convolution) may be easy to do in the

    other (e.g., multiplication)

  • 7/30/2019 2007.10.02 CS248-03 Sampling and Aliasing

    24/40

    CS248 Lecture 3 Kurt Akeley, Fall 2007

    Sampling theory

    x

    =

    *

    =

    F(s)f(x)

    Spectrum isreplicated an

    infinite number oftimes

  • 7/30/2019 2007.10.02 CS248-03 Sampling and Aliasing

    25/40

    CS248 Lecture 3 Kurt Akeley, Fall 2007

    Reconstruction theory

    x

    =

    *

    =

    F(s)f(x)

    sinc

  • 7/30/2019 2007.10.02 CS248-03 Sampling and Aliasing

    26/40

    CS248 Lecture 3 Kurt Akeley, Fall 2007

    Sampling at the Nyquist rate

    x

    =

    *

    =

    F(s)f(x)

  • 7/30/2019 2007.10.02 CS248-03 Sampling and Aliasing

    27/40

    CS248 Lecture 3 Kurt Akeley, Fall 2007

    Reconstruction at the Nyquist rate

    x

    =

    *

    =

    F(s)f(x)

  • 7/30/2019 2007.10.02 CS248-03 Sampling and Aliasing

    28/40

    CS248 Lecture 3 Kurt Akeley, Fall 2007

    Sampling below the Nyquist rate

    x

    =

    *

    =

    F(s)f(x)

  • 7/30/2019 2007.10.02 CS248-03 Sampling and Aliasing

    29/40

    CS248 Lecture 3 Kurt Akeley, Fall 2007

    Reconstruction below the Nyquist rate

    x

    =

    *

    =

    F(s)f(x)

  • 7/30/2019 2007.10.02 CS248-03 Sampling and Aliasing

    30/40

    CS248 Lecture 3 Kurt Akeley, Fall 2007

    Reconstruction error

    Original Signal

    Undersampled

    Reconstruction

  • 7/30/2019 2007.10.02 CS248-03 Sampling and Aliasing

    31/40

    CS248 Lecture 3 Kurt Akeley, Fall 2007

    Reconstruction with a triangle function

    x

    =

    *

    =

    F(s)f(x)

  • 7/30/2019 2007.10.02 CS248-03 Sampling and Aliasing

    32/40

    CS248 Lecture 3 Kurt Akeley, Fall 2007

    Reconstruction error

    Original Signal

    Triangle

    Reconstruction

  • 7/30/2019 2007.10.02 CS248-03 Sampling and Aliasing

    33/40

    CS248 Lecture 3 Kurt Akeley, Fall 2007

    Reconstruction with a rectangle function

    x

    =

    *

    =

    F(s)f(x)

  • 7/30/2019 2007.10.02 CS248-03 Sampling and Aliasing

    34/40

    CS248 Lecture 3 Kurt Akeley, Fall 2007

    Reconstruction error

    Original Signal

    Rectangle

    Reconstruction

  • 7/30/2019 2007.10.02 CS248-03 Sampling and Aliasing

    35/40

    CS248 Lecture 3 Kurt Akeley, Fall 2007

    Sampling a rectangle

    x

    =

    *

    =

    F(s)f(x)

  • 7/30/2019 2007.10.02 CS248-03 Sampling and Aliasing

    36/40

    CS248 Lecture 3 Kurt Akeley, Fall 2007

    Reconstructing a rectangle (jaggies)

    x

    =

    *

    =

    F(s)f(x)

  • 7/30/2019 2007.10.02 CS248-03 Sampling and Aliasing

    37/40

    CS248 Lecture 3 Kurt Akeley, Fall 2007

    Sampling and reconstruction

    Aliasing is caused by

    Sampling below the Nyquist rate,

    Improper reconstruction, or

    Both

    We can distinguish between

    Aliasing of fundamentals (demo)

    Aliasing of harmonics (jaggies)

  • 7/30/2019 2007.10.02 CS248-03 Sampling and Aliasing

    38/40

    CS248 Lecture 3 Kurt Akeley, Fall 2007

    Summary

    Jaggies matter

    Create false cues

    Violate rule 1

    Sampling is done at points (2-D) or along rays (3-D)

    Sufficient for depth sorting

    Matches theory

    Fourier theory explains jaggies as aliasing. For correctreconstruction:

    Signal must be band-limited

    Sampling must be at or above Nyquist rate

    Reconstruction must be done with a sinc function

  • 7/30/2019 2007.10.02 CS248-03 Sampling and Aliasing

    39/40

    CS248 Lecture 3 Kurt Akeley, Fall 2007

    Assignments

    Before Thursdays class, read

    FvD 3.17 Antialiasing

    Project 1:

    Breakout: a simple interactive game

    Demos Wednesday 10 October

  • 7/30/2019 2007.10.02 CS248-03 Sampling and Aliasing

    40/40

    End