01/21/05© 2005 university of wisconsin last time course introduction a simple physically-based...

25
01/21/05 © 2005 University of Wisc onsin Last Time Course introduction A simple physically-based rendering example

Upload: cecil-boyd

Post on 01-Jan-2016

217 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: 01/21/05© 2005 University of Wisconsin Last Time Course introduction A simple physically-based rendering example

01/21/05 © 2005 University of Wisconsin

Last Time

• Course introduction

• A simple physically-based rendering example

Page 2: 01/21/05© 2005 University of Wisconsin Last Time Course introduction A simple physically-based rendering example

01/21/05 © 2005 University of Wisconsin

Today

• Raytracing– Chapter 1 of the PBR

• Radiometry – measuring light– Chapter 5 of PBR

• Chapter 2-4 of PBR are about geometric issues

Page 3: 01/21/05© 2005 University of Wisconsin Last Time Course introduction A simple physically-based rendering example

01/21/05 © 2005 University of Wisconsin

Raytracing (PBR Sect. 1.2)

• Cast rays out from the eye, through each pixel, and determine what the rays hit– Builds the image pixel by pixel, one at a time

• Cast additional rays from the hit point to determine the pixel color

• Rays test visibility – what do I see from this point in this direction?– Ray casting is widely used in graphics to test visibility

Page 4: 01/21/05© 2005 University of Wisconsin Last Time Course introduction A simple physically-based rendering example

01/21/05 © 2005 University of Wisconsin

Raytracing

Shadow rays

Reflection ray

Transmitted ray

Page 5: 01/21/05© 2005 University of Wisconsin Last Time Course introduction A simple physically-based rendering example

01/21/05 © 2005 University of Wisconsin

Recursive Ray Tracing

• When a reflected or refracted ray hits a surface, repeat the whole process from that point– Send out more shadow rays

– Send out new reflected ray (if required)

– Send out a new refracted ray (if required)

– Generally, reduce the weight of each additional ray when computing the contributions to surface color

– Stop when the contribution from a ray is too small to notice

• The result is a ray tree

Page 6: 01/21/05© 2005 University of Wisconsin Last Time Course introduction A simple physically-based rendering example

01/21/05 © 2005 University of Wisconsin

Raytracing Implementation (PBR Sect. 1.3)

• Raytracing breaks down into several tasks:– Constructing the rays to cast

– Intersecting rays with geometry

– Determining the “color” of the thing you see

– PBRT breaks these tasks into several steps, because it makes the system very general

• Intersection testing is “geometry” and we won’t talk about it– Chapters 3 and 4 of the book

– You have to read it to understand how to use the provided code, but ignore how it’s implemented

Page 7: 01/21/05© 2005 University of Wisconsin Last Time Course introduction A simple physically-based rendering example

01/21/05 © 2005 University of Wisconsin

PBRT main() function

• Loads the scene

• Initializes things

• Renders the scene

• Cleans up

Page 8: 01/21/05© 2005 University of Wisconsin Last Time Course introduction A simple physically-based rendering example

01/21/05 © 2005 University of Wisconsin

PBRT Render() function

• Basic raytracer interpretation:– Sampler chooses which pixel

– Camera constructs the ray through that pixel

– Integrator determines the color coming back along the ray

– Film records that pixel

• Loop, getting all the pixels from sampler

• Then tell Film to save file

Page 9: 01/21/05© 2005 University of Wisconsin Last Time Course introduction A simple physically-based rendering example

01/21/05 © 2005 University of Wisconsin

PBRT Integrator() functions

• Integrators do most of the interesting work– Although there is plenty of interesting stuff for us in Sampler and Camera and Film

• Basic Raytracing Integrator:– Determine what is hit

– Get the reflectance function there

– Find the incoming light and push through the reflectance function

– Use the reflectance function to get reflection/transmission directions

– Recurse on those directions

Page 10: 01/21/05© 2005 University of Wisconsin Last Time Course introduction A simple physically-based rendering example

01/21/05 © 2005 University of Wisconsin

Measuring Light (PBR Chap. 5)

• To go much further, we need to talk about measuring properties of light

• We will consider only the particle nature of light– No diffraction or interference effects, no polarization

• At any place, at any moment, you can measure the “flow” of light through that point in a given direction– The plenoptic function describes the light in a region: (x,,,t)

– The plenoptic function over a region defines the light field in that region

– We will return to this for image based rendering

Page 11: 01/21/05© 2005 University of Wisconsin Last Time Course introduction A simple physically-based rendering example

01/21/05 © 2005 University of Wisconsin

Light and Color

• The wavelength, , of light determines its “color”– Frequency, , is related:

• Describe light by a spectrum– “Intensity” of light at each wavelength

– A graph of “intensity” vs. wavelength

• We care about wavelengths in the visible spectrum: between the infra-red (700nm) and the ultra-violet (400nm)

1

Page 12: 01/21/05© 2005 University of Wisconsin Last Time Course introduction A simple physically-based rendering example

01/21/05 © 2005 University of Wisconsin

White

• Note that color and intensity are technically two different things• However, in common usage we use color to refer to both

– White = grey = black in terms of color

• We will be precise in this part of the course, and only use the words in their physical sense

# P

hoto

ns

Wavelength (nm)400 500 600 700

White

Less Intense White (grey)

Page 13: 01/21/05© 2005 University of Wisconsin Last Time Course introduction A simple physically-based rendering example

01/21/05 © 2005 University of Wisconsin

Helium Neon Laser

• Lasers emit light at a single wavelength, hence they appear colored in a very “pure” way

# P

hoto

ns

Wavelength (nm)400 500 600 700

Page 14: 01/21/05© 2005 University of Wisconsin Last Time Course introduction A simple physically-based rendering example

01/21/05 © 2005 University of Wisconsin

Normal Daylight#

Pho

tons

Wavelength (nm)400 500 600 700

• Note the hump at short wavelengths - the sky is blue

• Other bumps came from solar emission spectra and atmospheric adsorption

Page 15: 01/21/05© 2005 University of Wisconsin Last Time Course introduction A simple physically-based rendering example

01/21/05 © 2005 University of Wisconsin

Tungsten Lightbulb

• Most light sources are not anywhere near white

• It is a major research effort to develop light sources with particular properties

# P

hoto

ns

Wavelength (nm)400 500 600 700

Page 16: 01/21/05© 2005 University of Wisconsin Last Time Course introduction A simple physically-based rendering example

01/21/05 © 2005 University of Wisconsin

PBRT and Spectra (PBR Sect. 5.1)

• Represent spectra using 3 piecewise constant basis function– RGB, basically– You won’t get good rainbows with the default

• You could change it– You would have to change some reflectance function

implementations– You would have to recompile everything

• To standardize the writing of images, conversions to XYZ color space are required– If you don’t know what XYZ color space is, read the notes from

CS559 last semester (lectures 2 and 3)

Page 17: 01/21/05© 2005 University of Wisconsin Last Time Course introduction A simple physically-based rendering example

01/21/05 © 2005 University of Wisconsin

Radiometric Quantities (PBR Sect. 5.2)

• Quantities that measure the amount of light

• They differ mostly not in what they measure, but in what you measure it over– Flux: Total in some domain

– Irradiance: Per unit area

– Intensity: Per unit angle

– Radiance: Per unit angle per unit projected area

• Basically, all the latter are differential quantities that have no meaning until you integrate them over some domain– Like you have to integrate speed to get distance traveled

Page 18: 01/21/05© 2005 University of Wisconsin Last Time Course introduction A simple physically-based rendering example

01/21/05 © 2005 University of Wisconsin

Radiant Flux

• Total amount of energy passing through a surface or region of space per unit time– Typically denoted by (Phi)– Also called power – Measured in watts (W) or joules/second (J/s)

• These are metric quantities (rather than eg. calories/second)

• Typically used for a light’s total output– You talk about a 60W light bulb– Only part of the story, also need distribution of power over space

• A camera integrates, over the time the shutter is open, the power arriving at the film

Page 19: 01/21/05© 2005 University of Wisconsin Last Time Course introduction A simple physically-based rendering example

01/21/05 © 2005 University of Wisconsin

Irradiance

• Irradiance is the power arriving at a surface, per unit area on the surface– Denoted E in PBR, or sometimes Ir or sometimes I

– Units: Wm-2

r

E(p)= /4r2

A

E(p)= cos/A

p

p

Page 20: 01/21/05© 2005 University of Wisconsin Last Time Course introduction A simple physically-based rendering example

01/21/05 © 2005 University of Wisconsin

Irradiance to Flux

• Integrate over area:

• Hence, we can also say (d is flux density, varies over area):

A

dAE )(p

dA

dE

)()(

pp

Page 21: 01/21/05© 2005 University of Wisconsin Last Time Course introduction A simple physically-based rendering example

01/21/05 © 2005 University of Wisconsin

Measuring Angle

• The solid angle subtended by an object from a point P is the area of the projection of the object onto the unit sphere centered at P– Measured in steradians, sr

– Definition is analogous to projected angle in 2D

– If I’m at P, and I look out, solid angle tells me how much of my view is filled with an object

Page 22: 01/21/05© 2005 University of Wisconsin Last Time Course introduction A simple physically-based rendering example

01/21/05 © 2005 University of Wisconsin

Intensity

• Flux density per unit solid angle:

– Used to describe the directional distribution of light• Depends on the direction,

– Only meaningful for point light sources (otherwise we would need some concept of the area of the light)

d

dI

)()(

Page 23: 01/21/05© 2005 University of Wisconsin Last Time Course introduction A simple physically-based rendering example

01/21/05 © 2005 University of Wisconsin

Radiance

• Flux density per unit area perpendicular to the direction of travel, per unit solid angle:

– Units Wm-2sr-1, power per unit area per unit solid angle

• Radiance is the fundamental measurement– All others can be computed from it via integrals over area and/or

directions

• Radiance is constant along lines– No r2 falloff, the per unit solid angle takes care of it

dAd

dL

),(

),(p

p

Page 24: 01/21/05© 2005 University of Wisconsin Last Time Course introduction A simple physically-based rendering example

01/21/05 © 2005 University of Wisconsin

Incident and Exitant Radiance

• We want to talk about radiance arriving at a point (incident radiance) and radiance leaving a point (exitant radiance)

• Denote with Li(p,) and Lo(p,) always points away from the p

• In general, Li(p,) Lo(p,)

• Also, because radiance is constant along a line, at a point in space (not on a surface) Lo(p,) = Li(p,-)

Page 25: 01/21/05© 2005 University of Wisconsin Last Time Course introduction A simple physically-based rendering example

01/21/05 © 2005 University of Wisconsin

Irradiance from Radiance (PBR Sect. 5.3)

• Integrate radiance over directions in the upper hemisphere:

– cos term deals with projected solid angle. is angle between and n (the normal)

• Next time, how to evaluate integrals like this, and reflectance functions

)(

i2

cos,n

ppH

dLE