Sampling and Reconstruction Digital Image Synthesis Yung-Yu Chuang 10/25/2005 with slides by Pat Hanrahan, Torsten Moller and Brian Curless.

Slides:



Advertisements
Similar presentations
Sampling, Aliasing.
Advertisements

Sampling and Reconstruction
Technische Universität München Fakultät für Informatik Computer Graphics SS 2014 Sampling Rüdiger Westermann Lehrstuhl für Computer Graphik und Visualisierung.
Advanced Computer Graphics CSE 190 [Spring 2015], Lecture 4 Ravi Ramamoorthi
David Luebke 1 4/28/2015 Aliasing & Antialiasing.
David Luebke1/19/99 CS 551/651: Antialiasing David Luebke
MIT EECS 6.837, Durand and Cutler Sampling, Aliasing, & Mipmaps.
CS 551 / CS 645 Antialiasing. What is a pixel? A pixel is not… –A box –A disk –A teeny tiny little light A pixel is a point –It has no dimension –It occupies.
Aliasing & Antialiasing
Cis 782 Advanced Computer Graphics Raghu Machiraju
Sampling Attila Gyulassy Image Synthesis. Overview Problem Statement Random Number Generators Quasi-Random Number Generation Uniform sampling of Disks,
Advanced Computer Graphics (Fall 2010) CS 283, Lecture 3: Sampling and Reconstruction Ravi Ramamoorthi Some slides.
Sampling, Aliasing, & Mipmaps
Convolution, Edge Detection, Sampling : Computational Photography Alexei Efros, CMU, Fall 2006 Some slides from Steve Seitz.
CSCE 641 Computer Graphics: Image Sampling and Reconstruction Jinxiang Chai.
Sampling and Pyramids : Rendering and Image Processing Alexei Efros …with lots of slides from Steve Seitz.
CSCE 641 Computer Graphics: Image Sampling and Reconstruction Jinxiang Chai.
Advanced Computer Graphics (Spring 2006) COMS 4162, Lecture 3: Sampling and Reconstruction Ravi Ramamoorthi
University of British Columbia CPSC 414 Computer Graphics © Tamara Munzner 1 Sampling Week 7, Fri 17 Oct 2003 p1 demos sampling.
Texture Reading: Chapter 9 (skip 9.4) Key issue: How do we represent texture? Topics: –Texture segmentation –Texture-based matching –Texture synthesis.
1 Images and Transformations Images by Pawan SinhaPawan Sinha.
Advanced Computer Graphics (Spring 2005) COMS 4162, Lecture 3: Sampling and Reconstruction Ravi Ramamoorthi
CIS 681 Distributed Ray Tracing. CIS 681 Anti-Aliasing Graphics as signal processing –Scene description: continuous signal –Sample –digital representation.
Sampling and Antialiasing CMSC 491/635. Abstract Vector Spaces Addition –C = A + B = B + A –(A + B) + C = A + (B + C) –given A, B, A + X = B for only.
Advanced Computer Graphics CSE 190 [Spring 2015], Lecture 3 Ravi Ramamoorthi
CS 431/636 Advanced Rendering Techniques
… Representation of a CT Signal Using Impulse Functions
© Chun-Fa Chang Sampling Theorem & Antialiasing. © Chun-Fa Chang Motivations “ My ray traced images have a lot more pixels than the TV screen. Why do.
Antialiasing CptS 548 Advanced Computer Graphics John C. Hart.
David Luebke 1 9/4/2015 CS 551/651: Advanced Computer Graphics Antialiasing Continued: Prefiltering and Supersampling.
Computer Graphics Inf4/MSc Computer Graphics Lecture 9 Antialiasing, Texture Mapping.
MIT EECS Sampling and Monte-Carlo Integration.
01/28/05© 2005 University of Wisconsin Last Time Improving Monte Carlo Efficiency.
Antialiasing CAP4730: Computational Structures in Computer Graphics.
Filtering Robert Lin April 29, Outline Why filter? Filtering for Graphics Sampling and Reconstruction Convolution The Fourier Transform Overview.
CS 450: COMPUTER GRAPHICS ANTIALIASING SPRING 2015 DR. MICHAEL J. REALE.
09/19/2002 (C) University of Wisconsin 2002, CS 559 Last Time Color Quantization Dithering.
Image Processing Basics. What are images? An image is a 2-d rectilinear array of pixels.
Computer Vision Spring ,-685 Instructor: S. Narasimhan Wean 5403 T-R 3:00pm – 4:20pm.
CMSC 635 Sampling and Antialiasing. Aliasing in images.
CS559: Computer Graphics Lecture 4: Compositing and Resampling Li Zhang Spring 2008.
Duy & Piotr. How to reconstruct a high quality image with the least amount of samples per pixel the least amount of resources And preserving the image.
MIT EECS Sampling, Aliasing, & Mipmaps. MIT EECS Last Time? Global illumination “physically accurate light transport” The rendering equation.
CS348B Lecture 9Pat Hanrahan, Spring 2005 Overview Earlier lecture Statistical sampling and Monte Carlo integration Last lecture Signal processing view.
Sampling and Reconstruction Digital Image Synthesis Yung-Yu Chuang with slides by Pat Hanrahan, Torsten Moller and Brian Curless.
Sampling Pixel is an area!! – Square, Rectangular, or Circular? How do we approximate the area? – Why bother? Color of one pixel Image Plane Areas represented.
Sampling Theorem & Antialiasing
Sampling and Reconstruction Digital Image Synthesis Yung-Yu Chuang 10/22/2008 with slides by Pat Hanrahan, Torsten Moller and Brian Curless.
1 Dr. Scott Schaefer Antialiasing. 2/70 What is aliasing?
01/26/05© 2005 University of Wisconsin Last Time Raytracing and PBRT Structure Radiometric quantities.
David Luebke 3/17/2016 Advanced Computer Graphics Antialiasing David Luebke
Linear systems: University of Illinois at Chicago ECE 427, Dr. D. Erricolo University of Illinois at Chicago ECE 427, Dr. D. Erricolo Consider two complex.
CIS 681 Distributed Ray Tracing. CIS 681 Anti-Aliasing Graphics as signal processing –Scene description: continuous signal –Sample –digital representation.
University of Texas at Austin CS384G - Computer Graphics Fall 2008 Don Fussell Sampling and Reconstruction.
Sampling Week 7, Fri 17 Oct 2003 p1 demos sampling.
Advanced Computer Graphics
… Sampling … … Filtering … … Reconstruction …
Distributed Ray Tracing
Sampling Theorem & Antialiasing
Sampling and Antialiasing
Sampling and Reconstruction
Sampling Theorem told us …
Outline Linear Shift-invariant system Linear filters
Joshua Barczak CMSC435 UMBC
CSCE 643 Computer Vision: Image Sampling and Filtering
Sampling and Reconstruction
Cis 782 Advanced Computer Graphics Raghu Machiraju
Distributed Ray Tracing
Chapter 3 Sampling.
Distributed Ray Tracing
Presentation transcript:

Sampling and Reconstruction Digital Image Synthesis Yung-Yu Chuang 10/25/2005 with slides by Pat Hanrahan, Torsten Moller and Brian Curless

Sampling theory Sampling theory: the theory of taking discrete sample values (grid of color pixels) from functions defined over continuous domains (incident radiance defined over the film plane) and then using those samples to reconstruct new functions that are similar to the original (reconstruction). Sampler : selects sample points on the image plane Filter : blends multiple samples together

Aliasing Approximation errors: jagged edges or flickering in animation sample position sample value

Fourier analysis Most functions can be decomposed into a weighted sum of shifted sinusoids. spatial domainfrequency domain

Fourier analysis spatial domainfrequency domain

Fourier analysis Fourier transform is a linear operation. inverse Fourier transform

Convolution theorem

1D convolution theorem example

2D convolution theorem example f(x,y)h(x,y)g(x,y) F(s x,s y )H(s x,s y )G(s x,s y )

The delta function Dirac delta function, zero width, infinite height and unit area

Sifting and shifting

Shah/impulse train function frequency domainspatial domain,

Sampling band limited

Reconstruction The reconstructed function is obtained by interpolating among the samples in some manner

In math forms

Reconstruction filters The sinc filter, while ideal, has two drawbacks: It has large support (slow to compute) It introduces ringing in practice The box filter is bad because its Fourier transform is a sinc filter which includes high frequency contribution from the infinite series of other copies.

Aliasing increase sample spacing in spatial domain decrease sample spacing in frequency domain

Aliasing high-frequency details leak into lower-frequency regions

Sampling theorem

For band limited function, we can just increase the sampling rate However, few of interesting functions in computer graphics are band limited, in particular, functions with discontinuities. It is because the discontinuity always falls between two samples and the samples provides no information of the discontinuity.

Antialiasing (Prefiltering)

It is blurred, but better than aliasing

Antialiasing (nonuniform sampling) The impulse train is modified as It turns regular aliasing into noise. But random noise is less distracting than coherent aliasing.

Antialiasing (adaptive sampling) Take more samples only when necessary. However, in practice, it is hard to know where we need supersampling. Some heuristics could be used. It makes a less aliased image, but may not be more efficient than simple supersampling particular for complex scenes.

Application to ray tracing Sources of aliasing: object boundary, small objects, textures and materials Good news: we can do sampling easily Bad news: we can’t do prefiltering Key insight: we can never remove all aliasing, so we develop techniques to mitigate its impact on the quality of the final image.

pbrt sampling interface Creating good sample patterns can substantially improve a ray tracer’s efficiency, allowing it to create a high-quality image with fewer rays. core/sampling.*, samplers/*

An ineffective sampler

An effective sampler

Sampler Sampler(int xstart, int xend, int ystart, int yend, int spp); bool GetNextSample(Sample *sample); int TotalSamples() In core/scene.cpp, while (sampler->GetNextSample(sample)) {... }

Sample Struct Sample { Sample(SurfaceIntegrator *surf, VolumeIntegrator *vol, const Scene *scene);... float imageX, imageY; float lensU, lensV; float time;... }

Stratified sampling Subdivide the sampling domain into non- overlapping regions (strata) and take a single sample from each one so that it is less likely to miss important features.

Stratified sampling completely random stratified uniform stratified jittered

Comparison of sampling methods 256 samples per pixel as reference 1 sample per pixel (no jitter)

Comparison of sampling methods 1 sample per pixel (jittered) 4 samples per pixel (jittered)

High dimension D dimension means N D cells. Solution: make strata separately and associate them randomly, also ensuring good distributions.

Stratified sampling void StratifiedSample1D(float *samp, int nSamples, bool jitter) { float invTot = 1.f / nSamples; for (int i = 0; i < nSamples; ++i) { float delta = jitter ? RandomFloat() : 0.5f; *samp++ = (i + delta) * invTot; } void StratifiedSample2D(float *samp, int nx, int ny, bool jitter) { float dx = 1.f / nx, dy = 1.f / ny; for (int y = 0; y < ny; ++y) for (int x = 0; x < nx; ++x) { float jx = jitter ? RandomFloat() : 0.5f; float jy = jitter ? RandomFloat() : 0.5f; *samp++ = (x + jx) * dx; *samp++ = (y + jy) * dy; }

Stratified sampling StratifiedSample2D(imageSamples, xPixelSamples, yPixelSamples, jitterSamples); StratifiedSample2D(lensSamples, xPixelSamples, yPixelSamples, jitterSamples); StratifiedSample1D(timeSamples, xPixelSamples*yPixelSamples, jitterSamples); for (int o=0;o<2*xPixelSamples*yPixelSamples; o+=2) { imageSamples[o] += xPos; imageSamples[o+1] += yPos; } Shuffle(lensSamples, xPixelSamples*yPixelSamples, 2); Shuffle(timeSamples, xPixelSamples*yPixelSamples, 1);

Stratified sampling bool StratifiedSampler::GetNextSample(Sample *sample) { if (samplePos == xPixelSamples*yPixelSamples) { } for (u_int i = 0; i n1D.size(); ++i) LatinHypercube(sample->oneD[i],sample->n1D[i],1); for (u_int i = 0; i n2D.size(); ++i) LatinHypercube(sample->twoD[i],sample->n2D[i],2); ++samplePos; return true; }

Latin hypercube sampling Integrators could request an arbitrary n samples. nx1 or 1xn doesn’t give a good sampling pattern. A worst case for stratified sampling

Stratified sampling referencerandomstratified jittered

Stratified sampling

1 camera sample and 16 shadow samples per pixel 16 camera samples and each with 1 shadow sample per pixel

Best candidate sampling Stratified sampling doesn’t guarantee good sampling across pixels. Poisson disk pattern addresses this issue. The Poisson disk pattern is a group of points with no two of them closer to each other than some specified distance. It can be generated by dart throwing. It is time-consuming. Best-candidate algorithm by Dan Mitchell. It generates many candidates randomly and only insert the one farthest to all previous samples. Compute a “tilable pattern” offline.

Best candidate sampling stratified jitteredbest candidate It avoids holes and clusters.

Best candidate sampling stratified jittered, 1 sample/pixel best candidate, 1 sample/pixel

Best candidate sampling stratified jittered, 4 sample/pixel best candidate, 4 sample/pixel

Low discrepancy sampling Stratified sampling could suffer when there are holes or clusters. Discrepancy can be used to evaluate the quality of a sampling pattern. for the set of AABBs with a corner at the origin

1D discrepancy Uniform is optimal! Fortunately, for higher dimension, The low-discrepancy patterns are less uniform.

Radial inverse

van der Corput sequence

Halton sequence

Hammersley sequence

Folded radical inverse

Radial inverse HaltonHammersley

Folded radial inverse HaltonHammersley

Low discrepancy sampling stratified jittered, 1 sample/pixel Hammersley sequence, 1 sample/pixel

Reconstruction filters Given image samples, we can do the following to compute pixel values. 1.reconstruct a continuous function L’ from samples 2.prefilter L’ to remove frequency higher than Nyquist limit 3.sample L’ at pixel locations Instead, we consider an interpolation problem

Filter provides an interface to f(x,y) Film stores a pointer to a filter and use it to filter the output before writing it to disk. Filter::Filter(float xw, float yw) Float Evaluate(float x, float y); filters/* width, half of support

Box filter Most commonly used in graphics. It’s just about the worst filter possible, incurring postaliasing by high-frequency leakage. Float BoxFilter::Evaluate(float x, float y) { return 1.; }

Triangle filter Float TriangleFilter::Evaluate(float x, float y) { return max(0.f, xWidth-fabsf(x)) * max(0.f, yWidth-fabsf(y)); }

Gaussian filter Gives reasonably good results in practice Float GaussianFilter::Evaluate(float x, float y) { return Gaussian(x, expX)*Gaussian(y, expY); }

Mitchell filter parametric filters, tradeoff between ringing and blurring Negative lobes

Mitchell filter Separable filter Two parameters, B and C, B+2C=1 suggested

Windowed sinc filter