in ~shirley/.public_html/cs684/students/loginname/index.html - put COPIES
to our HWs there.
Wedensdays are makeups for holiday mondays.
Today's HW is due next Monday - scan the sol'ns and put on web.
next time - spectral color conversions.
today - just math
Math Stuff
----------
Sets - everything in graphics is just a set. ex: R^3 is set of points in 3D.
R is real #'s, Z is complex, [0,1) is an interval (x (mem) [0,1) iff
0<=x<1).
Functions are just mappings - f:[0,1)^2->[0,1]^3 is tuple to triple (might
be a texture mapping function. Is Point^2 to RGB.
Measure - takes in some set S, say (mu)([0,1)) and says how big it is. Depends
on def'n what it returns. length([0,1)) is 1. length/2 might be a
good measure, too. Properties: Measure of two halves should be
measure of whole thing, etc. Integral is a measure: I(f)=_
Int(f,(Omega)). Integral gobbles a function and yields an integer -
so it's a measure (like area). Integrals are always over some set
wrt some measure.
Average - given f: (Omega)->R, and measure (mu), def'n is:
= Int(f(x)d(mu)(x),x in Omega) / Int(d(mu)(x),x in Omega).
Weighted avg preseves fact that average lies between extrema.
Take convention that (mu)(w) is 1 (weighting f'n sums to one), =.
"Energies are always nonnegative, except in the Chemistry department."
Angle - means on a unit circle, the subtended arclength is the angle (in
radians).
Solid angle - area of eclipsed region on the unit sphere. Both angle and
solid angle are measures of sets. (mu)(all angles)=2*Pi.
(mu)(all solid angles)=4*Pi. 4*Pi causes lots of Pi normalization
coeff to show up in code, which is annoying.
We'll have a point getting light from the hemisphere "above" it, so
there the incoming solid angles sum to 2*Pi. Sometimes we want the
cosine-weighted solid angle (for sun moving above point to take
normality of incident rays into account): (1/Pi)*cos(theta) as
weighting f'n.
Kronecker delta: delta(i,j) = { 1: i==j, 0: otherwise }. We will never use
this.
Dirac delta: delta: R -> R. Given x, delta(x) returns zero or infinity.
Is a function that's zero for all x!=0, w/spike to infinity at
zero. Is a unit volume f'n: means Int(delta(x),x=-inf..inf)=1.
Int(delta(x-3)*f(x)*dx,x=-inf..inf) - is a convenient way to pull
single values out of f'ns - comes up for specular reflection (way
light reflects off a mirror).
2D delta ought to be zero at a place we specify (inf. at origin and integrates
to one). Call it (delta2)(x,y) = delta(x)delta(y). Delta f'n on the
sphere (spherical coords): (theta is the angle down from the pole, ie:
angle relative to surface normal). delta(theta)delta(phi) doesn't
quite work. Right answer is in the radiosity book (chapter by
Hanrahan).
Go ahead and buy radiosity books by Cohen&Wallace and by ...? Glastern's
books (the two volume set). Pete will put on reserve.
We won't have good models for this course. Probably just triangles or
something. Use whatever format you want. In class, points are embedded in
R^3. Triangle is just three points. A ray is just a f'n that takes a
parameter t along the ray with "O" as ray origin: r(t) = O + tv w/v normal
or not? For this class make 'em unit vectors, in real life, normalization
is a big bottleneck for RT ray tracing (Steve Parker hits this stumbling
block on the O2k). Rays are displacements. Displacements add, points don't.
But points average. They're different protocols so they shouldn't be the
same thing. Type checking is a good but perhaps painful thing. Pete says
"just make 'em all the same". Right now he's in the "everything's a vector
mode". Probably no reason to every have homo coords in a RT program unless
you're gonna have a non-RT previewer.
A sphere in 3D is: the set of points the same distance from a certain point.
Whenever we do things in 3D, we'll be using normal physics vector math
notation, so get used to it.
Efficiency: try to make it fast. Grunge is good content for the mailing
list. Should be working on an RTer if don't already have one.
rgraham@cs - guy w/number
Probability
-----------
X (mem) Omega - X is "random variable" - is a random member of Omega. As you
write the code, it has no particular value. X has some density f'n (might
be more likely it's over here than over there). X ~ p is notation for "X
has probability density f'n p) - shorthand for that is "pdf p". It's
literally a density f'n. The liklihood of something occurring somewhere is
proportional to the value of the density f'n. Y (mem) [0,2], Y ~ kx. So
Int(kx*dx,x=0..2) = 2k = 1, so k=1/2. Y ~ (1/2)*k is pdf of Y.
The density f'n for Y looks like:
|
p 1-| ____----
0_|____----
Prob(Y==1.2) is zero, but one of those values *will* become the instance.
Can't talk about the probability of a point; it's not meaningful; it's all
zero. Can talk about the ratio of the probabilities of two points:
P(Y==1)/P(Y==0.5) = 1/2*1 / 1/2*1/2 = 2 because the density f'n isn't the
same the two points - you're twice as likely to get 1 out as to get 1/2 out.
The density is measuring the density of samples if an infinite number were
taken.
Light bulbs output no energy at any given time, but over an interval there
is an average amount emitted. Same idea.
Prob(x (mem) [a,b]) = Int(p(x)*dc,x (mem) [a,b]). Also convenient to have some
f'n P(x) def'n'd to be Prob(Y [0,1) w/uniform p(Y)=1.
is called a "canonical random number" - called (xi)
(xi)^2 is a nonuniform variable. So we ought to be able to get nonuniform
valiables. Ought to be able to get the nonuniform variable we want.
Answer is: P^-1(xi) has density p where p = cumulative dist'n f'n associated
w/p.
Ex: p(x) = (1/2)*x. P(x) = Int((1/2)*y*dy,y=0..x) = (1/4)*y^2 | [0..x] =
(1/4)*x^2. Invert: (xi) = (1/4)*x^2 --> x = sqrt(4*drand48()) gives
us what we want. Is intuitively not clearly wrong.
We use this when light comes into a surface: it hits and scatters, and not all
directions are equally likely.
Build this trick into your bag.
HW: program for #10, #14 in matlab. Try matlab on #10?
Last Topic: 2D random vars: no reason can't have (x,y) ~ p(x,y) with
p: (Omega) -> [0,inf]. Closed at inf is allowed in this class.
P(x,y) = Prob(X