Theoretically Perfect Sensor

Similar documents
Theoretically Perfect Sensor

CS354 Computer Graphics Sampling and Aliasing

Aliasing. Can t draw smooth lines on discrete raster device get staircased lines ( jaggies ):

Drawing a Triangle (and an introduction to sampling)

Advanced Computer Graphics. Aliasing. Matthias Teschner. Computer Science Department University of Freiburg

Announcements. Written Assignment 2 out (due March 8) Computer Graphics

Sampling and Reconstruction

Computer Graphics. Texture Filtering & Sampling Theory. Hendrik Lensch. Computer Graphics WS07/08 Texturing

Aliasing and Antialiasing. ITCS 4120/ Aliasing and Antialiasing

The main goal of Computer Graphics is to generate 2D images 2D images are continuous 2D functions (or signals)

Motivation. The main goal of Computer Graphics is to generate 2D images. 2D images are continuous 2D functions (or signals)

Computer Graphics. Sampling Theory & Anti-Aliasing. Philipp Slusallek

To Do. Advanced Computer Graphics. Sampling and Reconstruction. Outline. Sign up for Piazza

Drawing a Triangle (and an Intro to Sampling)

Lecture 6 Basic Signal Processing

28 SAMPLING. ALIASING AND ANTI-ALIASING

Image Filtering, Warping and Sampling

Basics. Sampling and Reconstruction. Sampling and Reconstruction. Outline. (Spatial) Aliasing. Advanced Computer Graphics (Fall 2010)

Sampling, Aliasing, & Mipmaps

Aliasing And Anti-Aliasing Sampling and Reconstruction

Ray Tracing. Johns Hopkins Department of Computer Science Course : Rendering Techniques, Professor: Jonathan Cohen

Sampling, Aliasing, & Mipmaps

Outline. Sampling and Reconstruction. Sampling and Reconstruction. Foundations of Computer Graphics (Fall 2012)

Outline. Foundations of Computer Graphics (Spring 2012)

EECS 487: Interactive Computer Graphics

Anti-aliasing and sampling

Sampling and Monte-Carlo Integration

Topic 12: Texture Mapping. Motivation Sources of texture Texture coordinates Bump mapping, mip-mapping & env mapping

Today. Anti-aliasing Surface Parametrization Soft Shadows Global Illumination. Exercise 2. Path Tracing Radiosity

Lets assume each object has a defined colour. Hence our illumination model is looks unrealistic.

Topic 11: Texture Mapping 11/13/2017. Texture sources: Solid textures. Texture sources: Synthesized

Advanced Ray Tracing

I have a meeting with Peter Lee and Bob Cosgrove on Wednesday to discuss the future of the cluster. Computer Graphics

Topic 11: Texture Mapping 10/21/2015. Photographs. Solid textures. Procedural

The simplest and most obvious method to go from a continuous to a discrete image is by point sampling,

Distributed Ray Tracing

CS5620 Intro to Computer Graphics

Lecture 2: 2D Fourier transforms and applications

Anti-aliasing and Monte Carlo Path Tracing. Brian Curless CSE 557 Autumn 2017

Anti-aliasing and Monte Carlo Path Tracing

Visual Pathways to the Brain

Image Processing, Warping, and Sampling

Anti-aliasing and Monte Carlo Path Tracing. Brian Curless CSE 457 Autumn 2017

Lighting and Shading

Filtering theory: Battling Aliasing with Antialiasing. Department of Computer Engineering Chalmers University of Technology

Sampling, Aliasing, & Mipmaps

Computer Graphics. Lecture 8 Antialiasing, Texture Mapping

Problem Set 4 Part 1 CMSC 427 Distributed: Thursday, November 1, 2007 Due: Tuesday, November 20, 2007

Fall CSCI 420: Computer Graphics. 7.1 Rasterization. Hao Li.

Last Time: Acceleration Data Structures for Ray Tracing. Schedule. Today. Shadows & Light Sources. Shadows

Image Sampling and Quantisation

Dr Pavan Chakraborty IIIT-Allahabad

Image Sampling & Quantisation

Sampling: Antialiasing - Intro

Fourier Transform in Image Processing. CS/BIOEN 6640 U of Utah Guido Gerig (slides modified from Marcel Prastawa 2012)

Attributes of Graphics Primitives

Reading. 18. Projections and Z-buffers. Required: Watt, Section , 6.3, 6.6 (esp. intro and subsections 1, 4, and 8 10), Further reading:

Sung-Eui Yoon ( 윤성의 )

Fourier analysis and sampling theory

Filtering theory: Battling Aliasing with Antialiasing. Tomas Akenine-Möller Department of Computer Engineering Chalmers University of Technology

CSCI 420 Computer Graphics Lecture 14. Rasterization. Scan Conversion Antialiasing [Angel Ch. 6] Jernej Barbic University of Southern California

Reading. 2. Fourier analysis and sampling theory. Required: Watt, Section 14.1 Recommended:

Computer Vision. Fourier Transform. 20 January Copyright by NHL Hogeschool and Van de Loosdrecht Machine Vision BV All rights reserved

COMP371 COMPUTER GRAPHICS

Today. Acceleration Data Structures for Ray Tracing. Cool results from Assignment 2. Last Week: Questions? Schedule

Rasterization. Rasterization (scan conversion) Digital Differential Analyzer (DDA) Rasterizing a line. Digital Differential Analyzer (DDA)

Image processing in frequency Domain

Computer Graphics. Rendering. by Brian Wyvill University of Calgary. cpsc/enel P 1

Building a Fast Ray Tracer

Local vs. Global Illumination & Radiosity

Homework 3: Shading, Raytracing, and Image Processing

An Intuitive Explanation of Fourier Theory

Computer Vision and Graphics (ee2031) Digital Image Processing I

Applications of Image Filters

Sampling, Resampling, and Warping. COS 426, Spring 2014 Tom Funkhouser

Distribution Ray-Tracing. Programação 3D Simulação e Jogos

Logistics. CS 586/480 Computer Graphics II. Questions from Last Week? Slide Credits

ECS 175 COMPUTER GRAPHICS. Ken Joy.! Winter 2014

Ray-tracing Acceleration. Acceleration Data Structures for Ray Tracing. Shadows. Shadows & Light Sources. Antialiasing Supersampling.

Topics and things to know about them:

CS 4620 Midterm, March 21, 2017

Edges, interpolation, templates. Nuno Vasconcelos ECE Department, UCSD (with thanks to David Forsyth)

Today. Global illumination. Shading. Interactive applications. Rendering pipeline. Computergrafik. Shading Introduction Local shading models

Computer Graphics. Attributes of Graphics Primitives. Somsak Walairacht, Computer Engineering, KMITL 1

Michael Moody School of Pharmacy University of London 29/39 Brunswick Square London WC1N 1AX, U.K.

COMP 4801 Final Year Project. Ray Tracing for Computer Graphics. Final Project Report FYP Runjing Liu. Advised by. Dr. L.Y.

2D rendering takes a photo of the 2D scene with a virtual camera that selects an axis aligned rectangle from the scene. The photograph is placed into

Specular reflection. Lighting II. Snell s Law. Refraction at boundary of media

Anti-aliasing. Images and Aliasing

CMSC427 Shading Intro. Credit: slides from Dr. Zwicker

So far, we have considered only local models of illumination; they only account for incident light coming directly from the light sources.

Anti-aliased and accelerated ray tracing. University of Texas at Austin CS384G - Computer Graphics Fall 2010 Don Fussell

Spatial Enhancement Definition

CS 543: Computer Graphics. Rasterization

Image Processing. Overview. Trade spatial resolution for intensity resolution Reduce visual artifacts due to quantization. Sampling and Reconstruction

SAMPLING AND NOISE. Increasing the number of samples per pixel gives an anti-aliased image which better represents the actual scene.

Illumination Models & Shading

Distribution Ray Tracing

Texture-Mapping Tricks. How Bad Does it Look? We've Seen this Sort of Thing Before. Sampling Texture Maps

Computer Graphics. Ray Tracing. Based on slides by Dianna Xu, Bryn Mawr College

Transcription:

Sampling 1/67

Sampling The ray tracer samples the geometry, only gathering information from the parts of the world that interact with a finite number of rays In contrast, a scanline renderer can push all the triangles onto the image plane however, the simple approach of testing which pixel centers are inside which triangles is also a form of sampling one needs to calculate the overlap between projected triangles and finite size (square) pixels in order to avoid sampling 2/67

Theoretically Perfect Sensor The value seen by a theoretically perfect sensor corresponds to the fraction of the sensor covered by the object as well as the exposure time Impractical for rendering, especially for complex scenes Coverage: Signal: 3/67

Real World Sensors Even the eye and camera have to deal with the fact that they do not collect all of the information 4/67

Example: Jaggies Send a ray from the center of each pixel and shade the entire pixel based on the color returned by that ray Jaggies occur because lines of pixels do not line up with lines of objects (This occurs in scanline rendering as well ) 5/67

Aliasing Sampling causes aliasing artifacts An alias or imposter appears in the place of the actual feature For example, in the previous slide, a jagged line appears in the place of the straight line Anti-aliasing techniques are used to prevent and alleviate these aliasing artifacts caused by inadequate sampling 6/67

Example: Texturing Artifacts Texture coordinates nonuniformly mapped onto a surface cause the sampling rate to vary across the texture Incorrect Aliasing Correct 7/67

Example: Sparkling Highlights Aliasing in normal vectors can cause noise in specular highlights in the Blinn-Phong shading model Incorrect Aliasing Correct 8/67

Example: Wagon Wheel Effect A spinning wheel appears to spin backwards when its motion is insufficiently sampled in time This is temporal aliasing 9/67

Sampling Rate Sampling artifacts can be reduced by increasing the number of pixels in an image (and consequently the total number of samples) Increasing the resolution of an image is costly Requires additional time to render because the number of rays cast increases Displaying the high resolution image and/or using the image as a texture requires both additional storage and computation, problematic for many applications Optimizing the Sampling Rate Use the lowest possible sampling rate that does not result in noticeable aliasing artifacts What is this ideal sampling rate? 10/67

1D Example 11/67

Sampling Rate: 4 Samples per Period 12/67

Discrete Samples 13/67

Continuous Reconstruction 14/67

Sampling Rate: 2 Samples per Period 15/67

Discrete Samples 16/67

Continuous Reconstruction 17/67

Sampling Rate: 1 Sample per Period 18/67

Discrete Samples 19/67

Continuous Reconstruction Continuous reconstruction from discrete samples no longer matches the original function Appears to be a different function Aliased! 20/67

Sampling Rate: 2/3 Sample per Period 21/67

Discrete Samples 22/67

Continuous Reconstruction Continuous reconstruction from discrete samples no longer matches the original function Appears to be a different function Aliased! 23/67

Aliasing For this sampling rate, these two cosine waves of different frequencies and amplitudes become aliased Can t tell the difference between them 24/67

Aliasing Sampling at too low a rate results in aliasing Aliasing refers to an effect that causes two different signals to become indistinguishable an alias or imposter Nyquist-Shannon Sampling Theorem If a function f(t) contains no frequencies higher than W hertz, it can be completely determined by samples at a series of points spaced 1/(2W) seconds apart That is, 2 samples per period are required to prevent aliasing 25/67

Anti-Aliasing 26/67

Anti-Aliasing Given a fixed sampling frequency (e.g. #pixels in a feature), the Nyquist frequency is defined as half the sampling frequency Need 2 samples per period to prevent aliasing If the real world function being sampled has no frequencies above the Nyquist frequency, no aliasing occurs But any real world frequencies above the Nyquist frequency will appear as aliases to the sampler Before sampling, pre-filter out all frequencies in the real world signal higher than the Nyquist frequency in order to prevent aliasing We can do this by transforming the function into frequency space 27/67

Fourier Transform Used to transform from the spatial domain to the frequency domain, and vice versa: F(k) f(x) f ( x) e F( k) e 2 jkx 2 jkx dx dk f(x) F(k) 28/67

Constant Function 29/67

Low Frequency Cosine 30/67

High Frequency Cosine 31/67

Narrow Gaussian Narrow Wide 32/67

Wider Gaussian Wider Narrower 33/67

Sum of 2 Different Frequency and Amplitude Cosine Functions 34/67

Discrete Samples 35/67

Reconstructed Alias 36/67

Pre-filtering in Fourier Space 1. Compute the Fourier transform of the signal 37/67

Pre-filtering in Fourier Space 2. Apply a low-pass filter to the Fourier transform of the signal to remove all frequencies higher than the Nyquist frequency 38/67

Pre-filtering in Fourier Space 2. Apply a low-pass filter to the Fourier transform of the signal to remove all frequencies higher than the Nyquist frequency 39/67

Pre-filtering in Fourier Space 3. Compute the inverse Fourier transform of the low-pass filtered signal 40/67

Pre-filtering in Fourier Space 4. The lower frequency component of the original function can then be sampled and reconstructed without aliasing. 41/67

Pre-filtering in Fourier Space 4. The lower frequency component of the original function can then be sampled and reconstructed without aliasing. 42/67

Pre-filtering in Fourier Space 4. The lower frequency component of the original function can then be sampled and reconstructed without aliasing. 43/67

Pre-filter Before Sampling! If we sample before filtering, high frequency components will masquerade as low frequency components There is no way to discern the high frequencies masquerading as low frequencies from the actual low frequencies We must pre-filter before sampling in order to avoid aliasing 44/67

Blurring vs. Antialiasing Blurring Jaggies After Sampling Pre-filtering 45/67

Images 46/67

Images Images have discrete values and are not continuous functions Use a discrete Fourier transform for pre-filtering The Fast Fourier Transform is a divide and conquer algorithm that enables us to compute the discrete Fourier transform and its inverse in O(n log n) time where n is the number of samples Compute the 2D Fourier transform by applying 1D discrete Fourier transforms (i.e. FFTs) along each dimension 1. Compute the discrete Fourier transform (via FFT) Transform the discrete image values into another array of discrete values 2. Perform operations 3. Compute the inverse discrete Fourier transform (via FFT) 47/67

Constant Function Spatial Domain Frequency Domain 48/67

Spatial Domain Frequency Domain 49/67

Spatial Domain Frequency Domain 50/67

Spatial Domain Frequency Domain 51/67

Spatial Domain Frequency Domain 52/67

Real World Image Spatial Domain Frequency Domain 53/67

Lowest Frequencies Spatial Domain Frequency Domain 54/67

Intermediate Frequencies Spatial Domain Frequency Domain 55/67

Larger Intermediate Frequencies Spatial Domain Frequency Domain 56/67

Highest Frequencies (edges) Spatial Domain Frequency Domain 57/67

Anti-Aliasing 58/67

Anti-Aliasing Let f and g be functions in the spatial domain, and F(f) and F(g) be the transformations of these functions in the frequency domain Here f is our image, F(f) is the frequency space representation of our image, and F(g) is the low pass filter we wish to apply in the frequency domain via multiplication component by component, i.e. F(f) F(g) this multiplication zeroes out high frequency components of F(f) Finally we apply the inverse transform to the final result to obtain: 59/67

Convolution Applying this low pass filter F(g) to the transform of the function f in the frequency domain is equivalent to a spatial convolution of the function f with the inverse transform of the filter (i.e. g ): The spatial convolution is defined by 60/67

Convolution We can skip the FFT entirely, and instead apply convolution in the spatial domain Unfortunately, (recall) narrow low pass filters in the frequency domain result in wide convolution kernals in the spatial domain (and vice versa) So it takes a lot of work to apply a narrow low pass frequency domain filter in the spatial domain via convolution (one has to consider a large number of non-local pixels) We d prefer a small local convolution kernal in the spatial domain This gives a wide frequency domain filter, and so won t perfectly filter out all high frequencies But, meh, it s ok-ish 61/67

Box Filter A box filter contains uniform weights throughout a certain range [x0,x1] x [y0, y1] and zeroes everywhere else Applying a box filter via discrete convolution: Overlay the filter on the 2D array of image values Multiply each pair of overlayed values Sum (integrate) the results to obtain a new value usually defined at the center of the filter 1 / 16 1 / 16 1 / 16 1 / 16 1 / 16 1 / 16 1 / 16 1 / 16 1 / 16 1 / 16 1 / 16 1 / 16 1 / 16 1 / 16 1 / 16 1 / 16 62/67

Box Filter Approximates a Low-Pass Filter Spatial Domain Frequency Domain 63/67

Wider Box Filter Removes More Frequencies Spatial Domain Frequency Domain 64/67

Supersampling Average multiple point samples distributed throughout a single pixel to obtain the value for that pixel Rendering a 100 by 100 image using uniform 4 by 4 supersampling is equivlanet to rendering a 400 by 400 image and applying a 4 by 4 box filter on every 16 th point (deleting the other 15 out of 16 points) Sample at a higher resolution, but still storing the same (lower) resolution image NB: As the number of points per pixel approaches infinity, it approximates the area coverage integral (a smart random distribution is often used ) 65/67

Point Sampling 4 by 4 Supersampling Exact Area Coverage 66/67

Antialiasing Jaggies Anti-aliased 67/67