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

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

Sampling and Reconstruction

Theoretically Perfect Sensor

Sampling, Aliasing, & Mipmaps

Theoretically Perfect Sensor

Anti-aliasing and sampling

Sampling, Aliasing, & Mipmaps

Sampling and Monte-Carlo Integration

Aliasing and Antialiasing. ITCS 4120/ Aliasing and Antialiasing

Sampling, Aliasing, & Mipmaps

Image Sampling and Quantisation

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

Image Sampling & Quantisation

CS354 Computer Graphics Sampling and Aliasing

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

EECS 556 Image Processing W 09. Interpolation. Interpolation techniques B splines

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

Aliasing And Anti-Aliasing Sampling and Reconstruction

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

Signals and Sampling. CMPT 461/761 Image Synthesis Torsten Möller. Machiraju/Möller

Drawing a Triangle (and an Intro to Sampling)

Drawing a Triangle (and an introduction to sampling)

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

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

Advanced Ray Tracing

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

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

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

This work is about a new method for generating diffusion curve style images. Although this topic is dealing with non-photorealistic rendering, as you

Central Slice Theorem

An Intuitive Explanation of Fourier Theory

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

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

Sampling: Application to 2D Transformations

Photo-realistic Renderings for Machines Seong-heum Kim

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

Lecture 7: Monte Carlo Rendering. MC Advantages

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

Point-Based Rendering

Image Transformation Techniques Dr. Rajeev Srivastava Dept. of Computer Engineering, ITBHU, Varanasi

Computational Aspects of MRI

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

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

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

Ray Tracing III. Wen-Chieh (Steve) Lin National Chiao-Tung University

Fourier analysis and sampling theory

Attributes of Graphics Primitives

Lecture 6 Basic Signal Processing

Distributed Ray Tracing

COMP371 COMPUTER GRAPHICS

Sampling: Antialiasing - Intro

Computer Vision I. Announcements. Fourier Tansform. Efficient Implementation. Edge and Corner Detection. CSE252A Lecture 13.

Filtering, scale, orientation, localization, and texture. Nuno Vasconcelos ECE Department, UCSD (with thanks to David Forsyth)

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

EECS 487: Interactive Computer Graphics

Anti-aliasing and Monte Carlo Path Tracing

ELEC Dr Reji Mathew Electrical Engineering UNSW

Monte-Carlo Ray Tracing. Antialiasing & integration. Global illumination. Why integration? Domains of integration. What else can we integrate?

3. Image formation, Fourier analysis and CTF theory. Paula da Fonseca

Sung-Eui Yoon ( 윤성의 )

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

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

Global Illumination The Game of Light Transport. Jian Huang

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

Ray tracing. EECS 487 March 19,

Scaled representations

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

Line Drawing. Introduction to Computer Graphics Torsten Möller / Mike Phillips. Machiraju/Zhang/Möller

Computer Graphics. Lecture 8 Antialiasing, Texture Mapping

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

Sampling and Reconstruction

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

EXAM SOLUTIONS. Image Processing and Computer Vision Course 2D1421 Monday, 13 th of March 2006,

28 SAMPLING. ALIASING AND ANTI-ALIASING

SDK White Paper. Soft Shadows

Building a Fast Ray Tracer

Capturing, Modeling, Rendering 3D Structures

Lecture 2: 2D Fourier transforms and applications

Parallel Triangle Rendering on a Modern GPU

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

8/5/2012. Introduction. Transparency. Anti-Aliasing. Applications. Conclusions. Introduction

International ejournals

Outline. Foundations of Computer Graphics (Spring 2012)

Point Lattices in Computer Graphics and Visualization how signal processing may help computer graphics

CPSC 425: Computer Vision

Overview. Spectral Processing of Point- Sampled Geometry. Introduction. Introduction. Fourier Transform. Fourier Transform

Practical Product Importance Sampling for Direct Illumination

Corona Sky Corona Sun Corona Light Create Camera About

Amortized Supersampling

Ray Tracing and Irregularities of Distribution

TSBK03 Screen-Space Ambient Occlusion

Rendering Algorithms: Real-time indirect illumination. Spring 2010 Matthias Zwicker

Morphological: Sub-pixel Morhpological Anti-Aliasing [Jimenez 11] Fast AproXimatte Anti Aliasing [Lottes 09]

CS 664 Segmentation. Daniel Huttenlocher

Reconstruction of Images Distorted by Water Waves

3D Rasterization II COS 426

Bixels: Picture Samples With Embedded Sharp Boundaries

Computer Vision 2. SS 18 Dr. Benjamin Guthier Professur für Bildverarbeitung. Computer Vision 2 Dr. Benjamin Guthier

Image Processing and Analysis

Sampling Theory in 1D. Point Lattices in Sampling Theory Multidimensional Sampling Theory. Sampling in 1D. Reconstruction in 1D

Transcription:

Computer Graphics Sampling Theory & Anti-Aliasing Philipp Slusallek

Dirac Comb (1) Constant & δ-function flash Comb/Shah function 2

Dirac Comb (2) Constant & δ-function Duality f(x) = K F(ω) = K (ω) And vice versa Comb function Duality: the dual of a comb function is again a comb function Inverse wavelength Amplitude scales with inverse wavelength f x = k= F ω = 1 Δx k= δ x kδx δ ω k 1 Δx 3

Sampling Continuous function Assume band-limited Finite support of Fourier transform Depicted here as triangle-shaped finite spectrum (not meant to be a tent function) Sampling at discrete points Multiplication with Comb function in spatial domain Corresponds to convolution in Fourier domain Multiple copies of the original spectrum (convolution theorem!) Frequency bands overlap? No : good Yes: aliasing artifacts Schematic sketch of spectrum!!! 4

Reconstruction Only original frequency band desired Filtering In Fourier domain: Multiplication with windowing function around origin In spatial domain Convolution with inverse Fourier transform of windowing function Optimal filtering function Box function in Fourier domain Corresponds to sinc in space domain Unlimited region of support Spatial domain only allows approximations due to finite support 5

Reconstruction Filter Cutting off the spatial support of the sinc function is NOT a good solution Re-introduces high-frequencies spatial ringing 6

Sampling and Reconstruction Original function and its band-limited frequency spectrum Signal sampling beyond Nyquist: Mult./conv. with comb Frequency spectrum is replicated Comb dense enough (sampling rate > 2*bandlimit) Bands do not overlap Ideal filtering Fourier: box (mult.) Space: sinc (conv.) Only one copy 7

Sampling and Reconstruction Reconstruction with ideal sinc Identical signal Non-ideal filtering Fourier: sinc 2 (mult.) Space: tent (conv.) Artificial high frequen. are not cut off Aliasing artifacts Reconstruction with tent function (= piecewise linear interpolation) 8

Sampling at Too Low Frequency Original function and its band-limited frequency spectrum Signal sampling below Nyquist: Mult./conv. with comb Comb spaced too far (sampling rate 2*bandlimit) Spectral band overlap: artificial low frequenci. Ideal filtering Fourier: box (mult.) Space: sinc (conv.) Band overlap in frequency domain cannot be corrected Aliasing 9

Sampling at Too Low Frequency Reconstruction with ideal sinc Reconstruction fails (frequency components wrong due to aliasing!) Non-ideal filtering Fourier: sinc 2 (mult.) Space: tent (conv.) Artificial high frequen. are not cut off Aliasing artifacts Reconstruction with tent function (= piecewise linear interpolation) Even worse reconstruction 10

Aliasing High frequency components from the replicated copies are treated like low frequencies during the reconstruction process In Fourier space: Nyquist satisfied Original spectrum Sampling comb Resulting spectrum Reconstruction filter Reconstructed spectrum Nyquist violated Different signals become aliases when sampled Aliasing 11

Aliasing in 1D Spatial frequency < Nyquist Spatial frequency = Nyquist 2 samples / period Spatial frequency > Nyquist Spatial frequency >> Nyquist 12

Aliasing in 2D [wikipedia] This original image sampled at these locations yields this reconstruction. 13

Aliasing in 2D Spatial sampling repeated frequency spectrum Spatial conv. with box filter spectral mult. with sinc 14

Causes for Aliasing It all comes from sampling at discrete points Multiplied with comb function Comb function: repeats frequency spectrum Issue when using non-band-limited primitives Hard edges infinitely high frequencies In reality, integration over finite region necessary E.g., finite CCD pixel size, integrates in the analog domain Computer: analytic integration often not possible No analytic description of radiance or visible geometry available Only way: numerical integration Estimate integral by taking multiple point samples, average Leads to aliasing Computationally expensive & approximate Important: Distinction between sampling errors and reconstruction errors 15

Sampling Artifacts Spatial aliasing Stair cases, Moiré patterns (interference), etc Solutions Increasing the sampling rate OK, but infinite frequencies at sharp edges Post-filtering (after reconstruction) Too late, does not work - only leads to blurred stair cases Pre-filtering (blurring) of sharp geometry features Slowly make geometry fade out at the edges? Correct solution in principle, but blurred images might not be useful Analytic low-pass filtering hard to implement Super-sampling (see later) On the fly re-sampling: densely sample, filter, down sample 16

Sampling Artifacts in 4D Temporal aliasing Video of cart wheel,... Solutions Increasing the frame rate OK Post-filtering (averaging several frames) Does not work only multiple details Pre-filtering (motion blur) Should be done on the original analog signal Possible for simple geometry (e.g., cartoons) Problems with texture, etc Super-sampling (see later) 17

Antialiasing by Pre-Filtering Filtering before sampling Analog/analytic original signal Band-limiting the signal Reduce Nyquist frequency for chosen sampling-rate Ideal reconstruction Convolution with sinc Practical reconstruction Convolution with Box filter, Bartlett (tent) Reconstruction error 18

Sources of High Frequencies Geometry Edges, vertices, sharp boundaries Silhouettes (view dependent) Texture E.g., checkerboard pattern, other discontinuities, Illumination Shadows, lighting effects, projections, Analytic filtering almost impossible Even with the most simple filters 19

Comparison Analytic low-pass filtering (pixel/triangle overlap) Ideally eliminates aliasing completely Hard to implement Weighted or unweighted area evaluation Compute distance from pixel to a line Filter values can be stored in look-up tables Possibly taking into account slope Distance correction Non-rotationally symmetric filters Does not work at corners Over-/Super-sampling Very easy to implement Does not eliminate aliasing completely Sharp edges contain infinitely high frequencies But it helps: 20

Re-Sampling Pipeline Assumption Energy in higher frequencies typically decreases quickly Reduced aliasing by intermediate sampling at higher frequency Algorithm Super-sampling Sample continuous signal with high frequency f 1 Aliasing with energy beyond f 1 (assumed to be small) Reconstruction of signal Filtering with g 1 (x): e.g. convolution with sinc f1 Exact representation with sampled values!! Analytic low-pass filtering of signal Filtering with filter g 2 (x) where f 2 << f 1 Signal is now band-limited w.r.t. f 2 Re-sampling with a sampling frequency that is compatible with f 2 No additional aliasing Filters g 1 (x) and g 2 (x) can be combined f 2 f 1 21

Super-Sampling in Practice Regular super-sampling Averaging of N samples per pixel N: 4 (quite good), 16 (often sufficient) Samples: rays, z-buffer, motion, reflection,... Filter weights Box filter Others: B-spline, pyramid (Bartlett), hexagonal,... Sampling Patterns (left to right) Regular: aliasing likely Random: often clumps, incomplete coverage Poisson Disc: close to perfect, but costly Jittered: randomized regular sampling Most often: rotated grid pattern 22

Super-Sampling Caveats Popular mistake Sampling at the corners of every pixel Pixel color by averaging from corners Free super-sampling??? Problem Wrong reconstruction filter!!! Same sampling frequency, but post-filtering with a tent function Blurring: loss of information Post-reconstruction blur 1x1 Sampling, 3x3 Blur There is no free Super-sampling 1x1 Sampling, 7x7 Blur 23

Adaptive Super-Sampling Idea: locally adapt sampling density Slowly varying signal: low sampling rate Strong changes: high sampling rate Decide sampling density locally Decision criterion needed Differences of pixel values Contrast (relative difference) A-B / ( A + B ) 24

Adaptive Super-Sampling Recursive algorithm Sampling at pixel corners and center Decision criterion for corner-center pairs Differences, contrast, object-ids, ray trees,... Subdivide quadrant by adding 3 diag. points Filtering with weighted averaging Tile: ¼ from each quadrant Leaf quadrant: ½ (center + corner) Box filter with final weight proport. to area 1 4 A + E 2 D + E + + 1 2 4 + 1 4 E + M 2 F + G 2 + B + G 2 H + M N + M + + + 1 2 2 4 H + G + + 1 2 4 M + Q 2 J + K 2 + G + K 2 L + K E + K + + 2 2 P + Q C + Q R + Q + + + 2 2 2 Extension Jittering of sample points 25

Stochastic Super-Sampling Problems with regular super-sampling Nyquist frequency for aliasing only shifted Expensive: 4-fold to 16-fold effort Non-adaptive: same effort everywhere Too regular: reduction of effective number of axis-aligned levels Introduce irregular sampling pattern triangle edge 0 4/16 8/16 12/16 16/16: 5 levels 17 levels: better, but noisy Stochastic super-sampling Or analytic computation of pixel coverage and pixel mask 26

Stochastic Sampling Requirements Even sample distribution: no clustering Little correlation between positions: no alignment Incremental generation: on demand as needed Generation of samples Poisson-disk sampling Random generation of samples Rejection if closer than min distance to other samples Jittered sampling Random perturbation from regular positions Stratified sampling Subdivision into areas with one random sample in each Improves even distribution Quasi-random numbers (Quasi-Monte Carlo) E.g. Halton sequence Advanced feature: see RIS course for more details 27

Poisson-Disk Sample Distribut. Motivation Distribution of the optical receptors on the retina (here: ape) Andrew Glassner, Intro to Raytracing Distribution of the photo-receptors Fourier analysis 28

Stochastic Sampling Slowly varying function in sample domain Closely reconstructs target value with few samples Quickly varying function in sample domain Transforms energy in high-frequency bands into noise Reconstructs average value as sample count increases 29

Examples Spatial sampling: triangle comb (c) 1 sample/pixel, no jittering: aliasing (d) 1 spp, jittering: noise (e) 16 spp, no jittering: less aliasing (f) 16 spp, jittering: less noise Temporal sampling: motion blur (a) 1 time sample, no jittering: aliasing (b) 1 time sample, jittering/pixel: noise (c) 16 samples, no jittering: less aliasing (d) 16 samples, jittering/pixel: less noise 30

Comparison Regular, 1x1 Regular, 3x3 Regular, 7x7 Jittered, 3x3 Jittered, 7x7 31