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

Sampling and Reconstruction

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

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

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)

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

Drawing a Triangle (and an Intro to Sampling)

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

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

Lecture 6 Basic Signal Processing

28 SAMPLING. ALIASING AND ANTI-ALIASING

Sampling, Aliasing, & Mipmaps

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

Aliasing And Anti-Aliasing Sampling and Reconstruction

Image Filtering, Warping and Sampling

Sampling, Aliasing, & Mipmaps

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

Outline. Foundations of Computer Graphics (Spring 2012)

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

EECS 487: Interactive Computer Graphics

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

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

Anti-aliasing and sampling

Anti-aliasing and Monte Carlo Path Tracing

Sampling and Monte-Carlo Integration

Advanced Ray Tracing

Lecture 2: 2D Fourier transforms and applications

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

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

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

Visual Pathways to the Brain

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

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

CS5620 Intro to Computer Graphics

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

Distributed Ray Tracing

Computer Graphics. Lecture 8 Antialiasing, Texture Mapping

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

Image processing in frequency Domain

Image Sampling and Quantisation

Image Processing, Warping, and Sampling

Image Sampling & Quantisation

Dr Pavan Chakraborty IIIT-Allahabad

Lighting and Shading

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

Sampling, Aliasing, & Mipmaps

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

Fourier analysis and sampling theory

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

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

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

COMP371 COMPUTER GRAPHICS

Homework 3: Shading, Raytracing, and Image Processing

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

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

lecture 18 - ray tracing - environment mapping - refraction

Computer Vision and Graphics (ee2031) Digital Image Processing I

An Intuitive Explanation of Fourier Theory

Attributes of Graphics Primitives

Sampling: Antialiasing - Intro

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

ECS 175 COMPUTER GRAPHICS. Ken Joy.! Winter 2014

CS 4620 Midterm, March 21, 2017

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

Sung-Eui Yoon ( 윤성의 )

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

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

EF432. Introduction to spagetti and meatballs

Anti-aliasing. Images and Aliasing

Scaled representations

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

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

Building a Fast Ray Tracer

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

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

Spatial Enhancement Definition

IMPORTANT INSTRUCTIONS

Local vs. Global Illumination & Radiosity

Applications of Image Filters

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

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

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

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

Topics and things to know about them:

CS 543: Computer Graphics. Rasterization

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

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

EF432. Introduction to spagetti and meatballs

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

graphics pipeline computer graphics graphics pipeline 2009 fabio pellacini 1

Sampling and Reconstruction

graphics pipeline computer graphics graphics pipeline 2009 fabio pellacini 1

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

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

Transcription:

Sampling 1/60

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/60

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/60

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

Aliasing 5/60

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 ) 6/60

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 7/60

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

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

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

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? 11/60

1D Example 12/60

Sampling Rate: 4 Samples per Period 13/60

Discrete Samples 14/60

Continuous Reconstruction 15/60

Sampling Rate: 2 Samples per Period 16/60

Discrete Samples 17/60

Continuous Reconstruction 18/60

Sampling Rate: 1 Sample per Period 19/60

Discrete Samples 20/60

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

Sampling Rate: 2/3 Sample per Period 22/60

Discrete Samples 23/60

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

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

Nyquist Frequency 26/60

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 27/60

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 28/60

Fourier Transform 29/60

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

Constant Function 31/60

Low Frequency Cosine 32/60

High Frequency Cosine 33/60

Narrow Gaussian Narrow Wide 34/60

Wider Gaussian Wider Narrower 35/60

Anti-Aliasing 36/60

Sum of 2 Different Frequency and Amplitude Cosine Functions 37/60

Discrete Samples 38/60

Reconstructed Alias 39/60

Pre-filtering in Fourier Space 1. Compute the Fourier transform of the signal 40/60

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 41/60

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 42/60

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

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

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

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

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 47/60

Blurring vs. Antialiasing Blurring Jaggies After Sampling Pre-filtering 48/60

Images 49/60

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) 50/60

Constant Function Spatial Domain Frequency Domain 51/60

Spatial Domain Frequency Domain 52/60

Spatial Domain Frequency Domain 53/60

Spatial Domain Frequency Domain 54/60

Spatial Domain Frequency Domain 55/60

Real World Image Spatial Domain Frequency Domain 56/60

Lowest Frequencies Spatial Domain Frequency Domain 57/60

Intermediate Frequencies Spatial Domain Frequency Domain 58/60

Larger Intermediate Frequencies Spatial Domain Frequency Domain 59/60

Highest Frequencies (edges) Spatial Domain Frequency Domain 60/60

Convolution 61/60

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: 62/60

RECALL: 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 63/60

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 64/60

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 kernels 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 kernel 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 65/60

RECALL: Narrow Gaussian Narrow Wide 66/60

RECALL: Wider Gaussian Wider Narrower 67/60

Box Filter 68/60

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 69/60

Box Filter Approximates a Low-Pass Filter Spatial Domain Frequency Domain 70/60

Wider Box Filter Removes More Frequencies Spatial Domain Frequency Domain 71/60

Supersampling 72/60

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 equivalent 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 store 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 ) 73/60

Point Sampling 4 by 4 Supersampling Exact Area Coverage 74/60

This Matters! 75/60

This Matters! Jaggies Anti-aliased 76/60

Sketch Your Scene 77/60

Question 1 Sketch the most important parts first Model the most important parts in CG first too, in case you run out of time Is it hard to draw? Will it be hard to model Does it make sense or need explanation? Will your CG scene make sense? Etc. 78/60