Optical Models Jian Huang, CS 594, Spring 2002

advertisement
Optical Models
Jian Huang, CS 594, Spring 2002
This set of slides are modified from slides used by Prof.
Torsten Moeller, at Simon Fraser University, BC, Canada.
Optical Models
• Nelson Max, “Optical Models”, IEEE
Transactions on Visualization and Computer
Graphics, Vol. 1, No. 2, 1995.
• Jim Blinn’s 1982 SIGGRAPH paper on scattering.
• The mathematical framework for light transport in
volume rendering.
Transport of Light
• Determination of Intensity
• Local - Diffuse and Specular
• Global - Radiosity, Ray Tracing, Ultimate
Physcial
• Mechanisms in Ultimate Model
Observer
– Emittance (+)
– Absorption (-)
– Scattering (+) (single vs. multiple)
Light
Transport of Light
• Typically based on - S. Chandrasekhar “Radiative
Transfer”, Oxford Universtiy Press 1950
• Mathematically challenging
Observer
• Approximate models required Blinn et al to the rescue
• Over Operator only emission and absorption
Light
Max - 1995
• Several cases:
–
–
–
–
–
–
Completely opaque or transparent voxels
Variable opacity correction
Self-emitting glow
Self-emitting glow with opacity along viewing ray
Single scattering of external illumination
Multiple scattering
Blinn - Assumptions
N
• Assumptions:
–
–
–
–
–
–
N - surface normal
E - eye vector
L - light vector
T - surface thickness
e - angle btw. E and N
a - angle btw. E and L
aka phase angle
– I - angle btw. N and L
E
e
i
a
T
Particles
L
Blinn - Assumptions
N
• Assumptions (contd.):
– particles are little spheres with
radius p
– n - number density (number of
particles per unit volume)
– m - cosine of angle e, i.e. N.E
– D - proportional volume of the
cloud occupied by particles
4 3
D  n p
3
E
e
i
a
T
Particles
L
Blinn – transparency (1)
• Expected particles in a volume will be nV
• Probability that there are no particles in the
way can be modeled as a Poisson process:
P0,V   e  nV
Cylinders
must
be empty
E
t
• Hence the probability that the light is making it
through those tubes is:
P0,V   e
2

 np T
m0
L
e
2


p
n T
E
Top Lit
m
Cylinders
of Integration
t
L
Bottom Lit
Blinn – transparency (2)
• Transparency through the cloud:
Tr  e
t
E
m
T
• t is called the optical depth
t  np 2T
-E
Max - absorption only
• I(s) = intensity at distance s along a ray
• t(s) = extinction coefficient
dI
 t s I s 
ds
 s

I s   I 0  exp    tt dt 
 0

 I 0T s 
• T(s) = transparency between 0 and s
Max - absorption only
• Linear variation of t:
t
t0)


T s   exp    tt dt 
 0


t0  tD  

 exp   D

2


D
tD)
D
t
Max - absorption only
• On the opacity a:
 D

a  1  T s   1  exp    tt dt 
 0

 1  exp  tD 
 tD  tD  / 2  ...
2
• assuming t to be constant in the interval
Max - cloud model
• Using fractal structure (Perlin)
Max - self-emitting glow
• Without extinction:
dI
 g s 
ds
s
I s   I 0   g t dt
0
Max - self-emitting glow
• Without extinction:
Max - self-emitting glow
• With extinction:
dI
 g s   ts I s 
ds
 D
 D
 D




I D   I 0 exp    tt dt    g s  exp    tt dt ds
 0
 0
 s

D
I D   I 0T D    g s T s ds
0
Volume Ray Integral (1)
• The continuous form:
 D
 D
 D

I D   I 0 exp    tt dt    g s  exp    tt dt ds
 0
 0
 s

• In general case, can not
compute analytically
Volume Ray Integration (2)
• Practical Computation Method:
 D
 D
 D




I D   I 0 exp    t t dt    g s  exp    t t dt ds
 0
 0
 s

ti  exp  tiDx Dx   1  tiDx Dx
» note: Dx can be Dxi (different everywhere)
 n 
I D   I 0  ti     t j  g i
i 1  j i 1 
i 1
 g n  t n  g n 1  t n 1  g n  2    g1  t1 I 0 
n
n
– which leads to the familiar BTF or FTB compositing …
g(s)
• g(s) could be:
– Self-emitting particle glow
– Reflected color, obtained via illumination
• The color is usually the sum of emitted color E and
reflected color R
Max - self-emitting glow
•
•
•
•
•
Identical glowing spherical particles:
projected area a = r2
surface glow color = C
number per unit volume = N
occluded area aNAdl

total area
A
• extinction coefficient t = a N
• added glow intensity per unit length
g=CaN=Ct
dl
A
Max - self-emitting glow
• Special Case g=Ct: (and C constant)
D
 D

 D




0 g s exp   s t t dt ds  0 Ct s exp   s t t dt ds
D

 D

 C 1  exp    t t dt  


0




I D   I 0T D   C 1  T D 
• This is compositing color C on top of
background I0
Max - self-emitting glow
• For I0=0 and t: varying according to f:
Volume Ray Integration Equation
• Self-emitting glow, none constant color
D
 D

 D

0 g s exp   s t t dt ds  0 C ( s)t s exp   s t t dt ds
D
Max - reflection
w
O
w
X
g x  r x, w, wix
•
•
•
•
i(x) = illumination reaching point x
w = unit reflection direction vector
w’ = unit illumination direction vector
r(x,w,w’): BRDF
–
f x  w
for conventional surface shading effects
Max - reflection
• For particle densities:
w
O
w
X
r x, w, w  wxtx pw, w
– w(x) = albedo
• Blinn: assuming that the primary effect is from interaction of light
with one single particle
• albedo - proportion of light reflected from a particle: in the range of
0..1
– p(w,w’) = phase function
• still unrealistic external reflection of outside illumination
Blinn - Phase Function
• “how” we see the
particles
• depends on the angle of
eye E and light vector L
• smooth drop off …
Top View
a=0
EyeView
L
E
L
a = 90
E
a
L
0
a
180
a = 180
E
Blinn - Phase Function
• Many different models possible
a  1
• Constant function
– size of particles much less then wavelength of the light
• Anisotropic
a  1 x cosa
– more light forward then backward - essentially our
diffuse shading
a   8 sin a     a  cosa 
• Lambert surfaces
3
– spheres reflect according to Lamberts law
– physically based
Blinn - Phase Function
a   3 1  cos 2 a 
4
– diffraction effects dominate
• Rayleigh Scattering
• Henyey-Greenstein

a   1  g
2
 1  g
2

 2 g cosa 
– general model with good fit to empirical data
• Empirical Measurments
– tabulated phase function
• sums of functions
– weighted sum of functions - model different effects in
parallel
3
2
Max - shadows
• Should account for transparency of volume
between light source and point x:
 

i  x, w  L exp    t x  twdt 
 0

• those are the “shadow feelers”
• e.g. Kajiya’s two pass algorithm
w
O
w
X
Max - shadows
Max - multiple scattering
• I(x,w): intensity at position x in direction w
• g(x,w): source term (glow at x in direction w)
g x, w   r x, w, wI x, wdw
4
I  x, w  I 0  x  Dw, wT D  


0  4r x  sw, w, wI x, wdw T s ds
D
I  I 0  KI
Max - multiple scattering
•
•
•
•
use radiosity ideas for the solution
simplified model - scattering is isotropic
i.e. g(x,w) does not depend on w:
then we can compute the total contribution of all
voxels to the iso-tropic scattering:
S  xi   a  xi  Fij g x j 
• where Fij are the “formj factors” and ai are the
albedo coefficients
• do a first pass like Kayija and collect external
illumination in E(xi)
Max - multiple scattering
• Results in big equation system
g  xi   E xi   a xi  Fij g x j 
j
• we still need to solve the form factors
• use an iterative solution method as in progressive
radiosity
I  I 0  KI
 I 0  K I 0  KI 
 I 0  K I 0  K I 0   I 0  KI 
 I 0  KI 0  K 2 I 0  K 3 I 0  
Max - multiple scattering
• Different approach: Monte Carlo Method
• Trace a large representative selection of rays from
light sources and absorb them, with probability
proportional to t, or scatter them, with probability
proportional to r. Build up the distribution of light
flux flowing through each voxel (in each
direction).
Max - multiple scattering
• In a view dependent rendering pass, do a final
single scatter of this light distribution towards the
eye:
I viewpoint , w  I 0 x  Dw, wT D  


0  4r x  sw, w, wI x, wdw T s ds
D
Max - multiple scattering
•
•
•
•
albedo = 0.99
15 iterations were needed
cloud on a 24x24x18 volume
each iteration took
15 minutes
• final 512x384
rendering took
5 minutes
Volumetric Ray Integration
color
opacity
1.0
object (color, opacity)
Ray-casting - revisited
Interpolation
kernel
volumetric compositing
color c = c s as(1 - a) + c
opacity a = a s (1 - a) + a
1.0
object (color, opacity)
Volume Rendering Pipeline (Levoy’88)
Acquired values
Data Preparation
Prepared values
shading
classification
Voxel colors
Voxel opacities
Ray-tracing / resampling
Ray-tracing / resampling
Sample colors
Sample opacities
compositing
Cout  Cin  ain  (1  a )  C Image Pixels
aout  ain  (1  a )  a
Which one?
Cout  Cin  (1  a)  C  a
a out  a in  (1  a)  a
Volume Rendering Pipeline (Wittenbrink et. al. 98)
• FTB color:
• BTF color:
• Opacity:
• The colors that are
composited must be preweighted with opacity, i.e.
associate color:
– C’ = aC
Download