Scan line algorithm - University of California, Merced

Download Report

Transcript Scan line algorithm - University of California, Merced

EECS 274 Computer Vision
Light and Shading
Radiometry – measuring light
• Relationship between light source, surface
geometry, surface properties, and
receiving end (camera)
• Inferring shape from surface reflectance
– Photometric stereo
– Shape from shading
• Reading: FP Chapter 2, S Chapter 2, H
Chapter 10
Radiometry
• Questions:
– how “bright” will surfaces be?
– what is “brightness”?
• measuring light
• interactions between light
and surfaces
• Core idea - think about light
arriving at a surface
• Around any point is a
hemisphere of directions
• Simplest problems can be
dealt with by reasoning about
this hemisphere (summing
effects due to all incoming
directions)
Shape, illumination and reflectance
• Estimating shape and surface reflectance
properties from its images
• If we know the shape and illumination, can
say something about reflectance (e.g.,
light field rendering in graphics)
• Usually reflectance and shape are coupled
(e.g., inverse problem in vision)
Foreshortening
• As a source is tiled wrt the direction in which the light is
traveling  it looks smaller to a patch of surface viewing
the source
• As a patch is tiled wrt to the direction in which the light is
traveling  it looks smaller to the source
• The effect of a source on a surface depends on how the
source looks from the point of view of the surface
Foreshortening
• Principle: two sources that
look the same to a receiver
must have the same effect on
the receiver
• Principle: two receivers that
look the same to a source
must receive the same amount
of energy
• “look the same” means
produce the same input
hemisphere (or output
hemisphere)
• Reason: what else can a
receiver know about a source
but what appears on its input
hemisphere? (ditto, swapping
receiver and source)
• Crucial consequence: a big
source (resp. receiver), viewed
at a glancing angle, must
produce (resp. experience) the
same effect as a small source
(resp. receiver) viewed
frontally
Solid angle
• The pattern a source generates on an input
hemisphere is described by the solid angle
• In a plane, an infinitesimally short line segment
subtends an infinitesimally small angle
dl
1
p
d 
dl cos 1
r
Solid angle
• By analogy with angle (in
radians), the solid angle
subtended by a region at a
point is the area projected on a
unit sphere centered at that
point
• The solid angle subtended by
a patch area dA is given by
dA cos 
d 
r2
• Another useful expression in
angular coordinate:
d   sin  d  d  
unit: steradians (sr)
Measuring light in free space
• The distribution of light in
space is a function of position
and direction
• Think about the power
transferred from an
infinitesimal source to an
infinitesimal receiver
• We have
total power leaving s to r =
total power arriving at r from s
• Also:
Power arriving at r is
proportional to:
– solid angle subtended by s at r
(because if s looked bigger
from r, there’d be more)
– foreshortened area of r
(because a bigger r will collect
more power)
Radiance
• Amount of energy (power) traveling at some point in a
specified direction, per unit area perpendicular to the
direction of travel (foreshortened area), per unit solid
angle (w × m-2 × sr-1)
• Small surface patch viewing a source frontally collect
more energy than the same patch viewing along a nearly
tangent direction
• The amount of received energy depends on
– How large the source looks from the patch, and
– How large the patch looks from the source
• A function of position and direction: L  P ,  ,  
Radiance (cont’d)
• The square meters in the units are
foreshortened (i.e., perpendicular to the direction
of travel)
• Crucial property: In a vacuum, radiance leaving
p in the direction of q is the same as radiance
arriving at q from p
– which was how we got to the unit
Radiance is constant along
straight lines
• Power 1->2, leaving 1:
Energy emitted by the patch
L  P1 ,  ,  dA1 cos  1 d  ( dt )
Radiance × foreshortened area × solid angle × time
• Power 1->2, arriving at 2:
Radiance leaving P1 in the direction
of P2 is L P1 , P1 P2
Radiance arriving at P2 from the
direction of P1 is L P , P P



• But these must be the same,
so that the two radiances are
equal
2
1 2

 
cos  dA




 L P , P P dA cos  (
)( dt )
r
cos  cos 
 L P , P P 
dA dA dt
r
d 3 E1 2  L P1 , P1 P2 dA1 cos 1 d 2 (1) (dt )
1
1 2
1
1 2
1
1
1
d 2 (1) Solid angle subtended by patch 2 at patch 1
2
2
2
2
2
1
2
Radiance is constant along
straight lines
• Power 1->2, arriving 2:
 
cos  dA


 L P , P P dA cos  (
)( dt )
r
d 3 E1 2  L P2 , P1 P2 dA2 cos  2 d1( 2 ) (dt )
• Power 1->2, arriving at 2:
2
1 2
 d 3 E1 2

 L P1 , P1 P2
• But these must be the same,
so that the two radiances are
equal
2
1
2
2
cosrcos
1
2
2
which means that

 
L P1 , P1 P2  L P2 , P1 P2
1
dA1dA2 dt

so that radiance is constant along
straight lines
Light at surfaces
• Many effects when light strikes
a surface -- could be:
– absorbed
– transmitted
• skin
– reflected
• mirror
– scattered
• milk
– travel along the surface and
leave at some other point
• sweaty skin
• Fluorescence: Some surfaces
absorb light at one wavelength
and radiate light at a different
wavelength
• Assume that
– all the light leaving a point is
due to that arriving at that
point
– surfaces don’t fluoresce (light
leaving a surface at a given
wavelength is due to light
arriving at that wavelength)
– surfaces don’t emit light (i.e.
are cool)
Irradiance
• Describe the relationship between
– incoming illumination, and
– reflected light
• A function of both
– the direction in which light arrives at a surface
– and the direction in which it leaves
Irradiance (cont’d)
• How much light is arriving at a
surface?
• Sensible unit is irradiance
• Incident power per unit area
not foreshortened
• A surface experiencing
radiance L(x,,) coming in
from d experiences
irradiance
• Crucial property:
Total power arriving at the
surface is given by adding
irradiance over all incoming
angles --- this is why it’s a
natural unit
• Total power is
 L P ,  ,   cos  sin  d d

(1 / dA ) L  P ,  ,  (cos  dA ) d   L  P ,  ,   cos  d 
Irradiance = radiance × foreshortening factor × solid angle
The BRDF
• Can model this situation with
the Bidirectional Reflectance
Distribution Function (BRDF)
• The most general model of
local reflection
BRDF 
radiance in the outgoing direction
incident irradiance
A surface illuminated by
radiance Li  P ,  i ,  i 
coming in from a region of solid
angle dω at angle  i , i  to
emit radiance Lo  P ,  o ,  o 
Lo  P ,  o ,  o 
 bd  P ,  o ,  o ,  i , i  
Li  P ,  i , i  cos  i d 
BRDF
• Units: inverse steradians (sr-1)
• Symmetric in incoming and outgoing directions
– this is the Helmholtz reciprocity principle
• Radiance leaving a surface in a particular
direction:
L o  P ,  o ,  o    bd  P ,  o ,  o ,  i ,  i , Li  P ,  i ,  i  cos  i d 
• Add contributions from every incoming
direction of a hemisphere Ω (whatever the
direction of irradiance)
Lo P, o , o    bd P, o , o , i , i ,Li P, i , i  cos  i d

Helmholtz stereopsis
• Exploit the symmetry of surface reflectance
• For corresponding pixels, the ratio of incident
radiance to emitted radiance is the same
• Derive a relationship between the intensities of
corresponding pixels that does not depend on
the BRDF of the surface
Suppressing angles - Radiosity
• In many situations, we do not
really need angle coordinates
– e.g. cotton cloth, where the
reflected light is not dependent
on angle
• If the radiance leaving the
surface is independent of exit
angle, no need describing a
unit that depends on direction
• Appropriate unit is radiosity
– total power leaving a point on
the surface, per unit area on
the surface (Wm-2)
– note that this is independent of
the exit direction
• Radiosity B(P) from radiance?
– sum radiance leaving surface
over all exit directions,
multiplying by a cosine
because this is per unit area
not per unit foreshortened
area
B  P    Lo  P ,  ,   cos  d 

Radiosity
• Important relationship:
– radiosity of a surface whose radiance is independent
of angle (e.g. that cotton cloth) Lo P ,  ,    Lo P 
B P    Lo P,  ,   cos  d

 Lo P  cos  d

 Lo P 
 2 2
0
  Lo P 

0
cos  sin  d d
Radiosity
Radiosity used in rendering
• surfaces reflect light diffusely
• viewpoint independent
Suppressing angles: BRDF
• BRDF is a very general notion
– some surfaces need it
– very hard to measure
• illuminate from one direction, view from another, repeat
– very unstable
• minor surface damage can change the BRDF
• e.g. ridges of oil left by contact with the skin can act as lenses
• For many surfaces, light leaving the surface is largely
independent of exit angle
– surface roughness is one source of this property
Directional hemispheric
reflectance
• The light leaving a surface is
largely independent of exit
angle
• Directional hemispheric
reflectance (DHR):
– The fraction of the incident
irradiance in a given direction
that is reflected by the surface
(whatever the direction of
reflection)
– Summing the radiance leaving
the surface over all directions
and dividing it by the
irradiance in the direction of
illumination
– unitless, range is 0 to 1
• Note that DHR varies with
incoming direction
– e.g. a ridged surface, where
left facing ridges are
absorbent and right facing
ridges reflect
 dh
L P, 

 ,   

i
i
o
o
, o  cos  o do
Li P,  i , i  cos  i di
 Lo P,  o , o  cos  o 
 
 d o
 L  P ,  ,   cos  d
i
i
i
i
 i
   bd P,  o , o ,  i , i  cos  o do

Lambertian surfaces and albedo
• For some surfaces, the DHR is
independent of illumination
direction too
– cotton cloth, carpets, matte
paper, matte paints, etc.
• For such surfaces, radiance
leaving the surface is
independent of angle
• Called Lambertian surfaces
(same Lambert) or ideal diffuse
surfaces
• Use radiosity as a unit to
describe light leaving the
surface
• For a Lambertian surface,
BRDF is independent of angle,
too
• For Lambertian surfaces, DHR
is often called diffuse
reflectance, or albedo, ρd
• Useful fact:
 d    bd ( o , o , i , i ) cos  o do

 bd ( o ,  o ,  i ,  i )  
   bd cos  o do


2
  bd  2  cos  o sin  o d o do
0
   bd
0
 bd 
d

Lambertian objects
Non-Lambertian objects
Specular surfaces
• Another important class of
surfaces is specular, or mirrorlike
– radiation arriving along a
direction leaves along the
specular direction
– reflect about normal
– some fraction is absorbed,
some reflected
– on real surfaces, energy
usually goes into a lobe of
directions
– can write a BRDF, but
requires the use of funny
functions
Phong’s model
• There are very few cases
where the exact shape of the
specular lobe matters
• Typically
– very, very small --- mirror
– small -- blurry mirror
– bigger -- see only light sources
as “specularities”
– very big -- faint specularities
• Phong’s model
– reflected energy falls off with
cos   
n
Lambertian + specular
• Widely used model
– all surfaces are Lambertian plus specular component
• Advantages
– easy to manipulate
– very often quite close true
• Disadvantages
– some surfaces are not
• e.g. underside of CD’s, feathers of many birds, blue spots on many
marine crustaceans and fish, most rough surfaces, oil films (skin!),
wet surfaces
– Generally, very little advantage in modeling behavior of light at a
surface in more detail -- it is quite difficult to understand behavior
of L+S surfaces