01/28/05© 2005 university of wisconsin last time improving monte carlo efficiency

29
01/28/05 © 2005 University of Wisc onsin Last Time Improving Monte Carlo Efficiency

Upload: diana-tyler

Post on 28-Dec-2015

213 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: 01/28/05© 2005 University of Wisconsin Last Time Improving Monte Carlo Efficiency

01/28/05 © 2005 University of Wisconsin

Last Time

• Improving Monte Carlo Efficiency

Page 2: 01/28/05© 2005 University of Wisconsin Last Time Improving Monte Carlo Efficiency

01/28/05 © 2005 University of Wisconsin

Today

• Improving Efficiency with Monte Carlo Integration

Page 3: 01/28/05© 2005 University of Wisconsin Last Time Improving Monte Carlo Efficiency

01/28/05 © 2005 University of Wisconsin

Cameras

• The camera’s task is to take a pixel and compute a ray out into the scene– Camera is given an image point, a lens sample point, and a time

– Output is a ray in world space, with normalized direction

• There are many types of camera– Orthographic

– Perspective

– Spherical

– Define your own …

Page 4: 01/28/05© 2005 University of Wisconsin Last Time Improving Monte Carlo Efficiency

01/28/05 © 2005 University of Wisconsin

Depth of Field

• Details on constructing rays are in PBR Ch 6

• All cameras in PBRT take parameters for depth of field– A Lens radius parameter

– A focal distance parameter

• When asked for a ray, the camera gets sample values to use to compute a point on the lens

Page 5: 01/28/05© 2005 University of Wisconsin Last Time Improving Monte Carlo Efficiency

01/28/05 © 2005 University of Wisconsin

Realistic Lens System

Aperture: Size controls how many world rays project to pixel

Page 6: 01/28/05© 2005 University of Wisconsin Last Time Improving Monte Carlo Efficiency

01/28/05 © 2005 University of Wisconsin

Simplified Lens Model (1)

Image Pt Near Clip PlaneFocal PlaneLens Plane

• All rays through a single point on the focal plane land at the same pixel – things at focal plane are in focus– The aperture controls how big the solid angle is that gets thorugh

Aperture size

Page 7: 01/28/05© 2005 University of Wisconsin Last Time Improving Monte Carlo Efficiency

01/28/05 © 2005 University of Wisconsin

Simplified Lens Model (2)

• Rays through a point off the focal plane land at multiple pixel locations – circle of confusion

• Or, a single pixel sees multiple points at a given depth

Image Pt Near Clip PlaneFocal PlaneLens Plane

Aperture size

Page 8: 01/28/05© 2005 University of Wisconsin Last Time Improving Monte Carlo Efficiency

01/28/05 © 2005 University of Wisconsin

Adjusting Rays for Depth of Field

• The lens radius is the size of the little circle on the lens– NOT aperture size – includes aperture and lens position

• Compute a sample within this circle– Circle is centered at same (x,y) as image point

– It will be the “start” of our adjusted ray

Page 9: 01/28/05© 2005 University of Wisconsin Last Time Improving Monte Carlo Efficiency

01/28/05 © 2005 University of Wisconsin

Input

Image Pt Near Clip PlaneFocal PlaneLens Plane

• Start with ray that has origin at near clip plane and passes through the “focal point”– Regardless of where they hit the lens, all rays should hit focal plane

at same location as this ray

Page 10: 01/28/05© 2005 University of Wisconsin Last Time Improving Monte Carlo Efficiency

01/28/05 © 2005 University of Wisconsin

Adjusting Ray (2)

• Compute hit point with focal plane• Regardless of where we hit the lens, we should hit this same

point

Image Pt Near Clip PlaneFocal PlaneLens Plane

Aperture size

Page 11: 01/28/05© 2005 University of Wisconsin Last Time Improving Monte Carlo Efficiency

01/28/05 © 2005 University of Wisconsin

Adjusting Ray (3)

• New ray uses lens point as origin, and passes through focal plane point

• PBR is actually a little fuzzy on exactly where ray starts– Only makes sense if lens plane is same as near clip plane

Image Pt Near Clip PlaneFocal PlaneLens Plane

Aperture size

Page 12: 01/28/05© 2005 University of Wisconsin Last Time Improving Monte Carlo Efficiency

01/28/05 © 2005 University of Wisconsin

Depth of Field Effect

Page 13: 01/28/05© 2005 University of Wisconsin Last Time Improving Monte Carlo Efficiency

01/28/05 © 2005 University of Wisconsin

Realistic Cameras

• Kolb et al. describe a more realistic camera model– Craig Kolb, Don Mitchell and Pat Hanrahan, “A realistic camera

model for computer graphics”, SIGGRAPH '95, pp 317-324

– Model all parts of lens system, including sizes and shapes of all sub-parts, distances between surfaces, index of refraction, etc

Page 14: 01/28/05© 2005 University of Wisconsin Last Time Improving Monte Carlo Efficiency

01/28/05 © 2005 University of Wisconsin

Using Kolb’s Model

• Sample in solid angle out of pixel

• Trace ray through lens system– Fast – know sequence of intersections already

• Also important to know the “exit pupil”, the range of solid angle that passes through the lens

Page 15: 01/28/05© 2005 University of Wisconsin Last Time Improving Monte Carlo Efficiency

01/28/05 © 2005 University of Wisconsin

Thick Lens Approximation

World Camera

Thin Lens

World Camera

Thick Lens

• Can be done with 4x4 transformation

Page 16: 01/28/05© 2005 University of Wisconsin Last Time Improving Monte Carlo Efficiency

01/28/05 © 2005 University of Wisconsin

Effect of Lens

• Incorrect field of view due to standard model is apparent

• Not in these images:– Distortion around the edge of the image: “coma”, “pincushion distortion”,

“barrel”

– “Vignetting”: darkening around edge due to rays from edge of image hitting obstacles inside the lens

Accurate Thick approx Standard graphics

Page 17: 01/28/05© 2005 University of Wisconsin Last Time Improving Monte Carlo Efficiency

01/28/05 © 2005 University of Wisconsin

Sampling The Lens (PBR Sect 14.5.2)

• The camera is passed two canonical random variables for the lens sample

• These must be converted into samples on a disk

• First method:

sin

cos

2 2

1

ry

rx

r

Page 18: 01/28/05© 2005 University of Wisconsin Last Time Improving Monte Carlo Efficiency

01/28/05 © 2005 University of Wisconsin

But …

1

2

• Regions on the right all have equal area – which is requirement for uniform distribution

• But why is it still a problem?

Page 19: 01/28/05© 2005 University of Wisconsin Last Time Improving Monte Carlo Efficiency

01/28/05 © 2005 University of Wisconsin

Shirley’s method

• Regions are more similar in shape

yx

yr

y

x

12

12

2

1

Page 20: 01/28/05© 2005 University of Wisconsin Last Time Improving Monte Carlo Efficiency

01/28/05 © 2005 University of Wisconsin

Image Sampling and Reconstruction(PBR Chap 7)

• No time for an review of this topic– See CS559 notes

• We have several samples of the image at points scattered over the image plane– They are not uniformly arranged, which means most reconstruction

theory, particularly frequency domain methods, are useless

• The problem is to combine them to determine the pixel’s final color– We want to do this as each sample comes in, because we may have

many many more samples than pixels

Page 21: 01/28/05© 2005 University of Wisconsin Last Time Improving Monte Carlo Efficiency

01/28/05 © 2005 University of Wisconsin

Filtering

• We will use weighted interpolation to reconstruct:

• f is the filter function

• Filter has a width and height – area of support

• Sum is over samples falling inside support

• We can compute this as each sample comes in– is sample’s contribution to pixel

– Same sample may contribute to many pixels

i ii

i iiii

yyxxf

yxLyyxxfyxI

,

,,,

iiii yxLyyxxf ,,

Page 22: 01/28/05© 2005 University of Wisconsin Last Time Improving Monte Carlo Efficiency

01/28/05 © 2005 University of Wisconsin

Filtering and Sampling

• Filters and samples can interact in strange ways

Different sampler, same filter

Page 23: 01/28/05© 2005 University of Wisconsin Last Time Improving Monte Carlo Efficiency

01/28/05 © 2005 University of Wisconsin

Different Filters

Box Gaussian Mitchell

Page 24: 01/28/05© 2005 University of Wisconsin Last Time Improving Monte Carlo Efficiency

01/28/05 © 2005 University of Wisconsin

Box and Triangle

Note: Code in PBR ignores normalization

W

ywxwyxf

Wyxf

yx

,0max,0max,

1,

Page 25: 01/28/05© 2005 University of Wisconsin Last Time Improving Monte Carlo Efficiency

01/28/05 © 2005 University of Wisconsin

Gaussian and Mitchell

• Gaussian tends to blur too much

• Mitchell enhances edges a little, which is perceptually pleasing– Parameterized filter: B and C. Keep B=2C=1 for good results

Page 26: 01/28/05© 2005 University of Wisconsin Last Time Improving Monte Carlo Efficiency

01/28/05 © 2005 University of Wisconsin

Windowed Sinc

• Would like a sinc function but without infinite support

• Solution is to multiply it by another functions that has finite support

x

xxw

ywwyxww

xyxfyx

sin

sincsinc,

Page 27: 01/28/05© 2005 University of Wisconsin Last Time Improving Monte Carlo Efficiency

01/28/05 © 2005 University of Wisconsin

Windowed Sinc

Page 28: 01/28/05© 2005 University of Wisconsin Last Time Improving Monte Carlo Efficiency

01/28/05 © 2005 University of Wisconsin

More Filters

• There is a wealth of research on filter design

• In images with noisy samples, as we will frequently see, a common idea is to avoid the effect of an outlier– Or view it as the one sample that found the really bright spot, and

smooth it over many samples

Page 29: 01/28/05© 2005 University of Wisconsin Last Time Improving Monte Carlo Efficiency

01/28/05 © 2005 University of Wisconsin

Next Time

• Reflectance Functions