FOGSHOP: Real-time Design and Rendering of Inhomogeneous, Single-Scattering Media Kun Zhou, MSRA Qiming Hou, Tsinghua Univ. Minmin Gong, MSRA John Snyder, MSR Baining Guo, MSRA Heung-Yeung Shum, MSRA.

Download Report

Transcript FOGSHOP: Real-time Design and Rendering of Inhomogeneous, Single-Scattering Media Kun Zhou, MSRA Qiming Hou, Tsinghua Univ. Minmin Gong, MSRA John Snyder, MSR Baining Guo, MSRA Heung-Yeung Shum, MSRA.

FOGSHOP: Real-time Design and
Rendering of Inhomogeneous,
Single-Scattering Media
Kun Zhou, MSRA
Qiming Hou, Tsinghua Univ.
Minmin Gong, MSRA
John Snyder, MSR
Baining Guo, MSRA
Heung-Yeung Shum, MSRA
Previous Real-Time Techniques
homogeneous fog
 no spatial variation
layered fog using textures
 vertical variation only
 immersed lights/objects
volume rendering
from [Sun05]
 ignores halos/shadows
from DX10 volume fog demo
Fogshop Features
RBF model supports
 large fog banks
 immersed viewer
point lighting effects:
 media’s appearance and shadows
environmental lighting effects:
 media’s appearance, approx. shadows
surface reflectance effects
 due to immersion in media
noise addition
easy-to-use media design system
Modeling Inhomogeneous Media with RBFs
optical density = sum of n 3D
Gaussian blobs + constant:
n
 x     i x    0
bi
ci
ai
i 1
easy-to-control model
compatible with particle systems
analytic line integral via erf(x)
[Stam93]

 i x   ci exp  ai 2 x  bi
2

Attenuation by Inhomogeneous Fog
T(a,b) is optical depth between 3D points a and b:
T a, b   
0
ba
 x  dt
x(t )  a  t (b  a ) b  a
integrate density
 along path ab
light from ab attenuated by exp(-T(a,b))
point light, s
ed
ow
ad
sh
by
,p
(s
-T
p(
ex
))
viewer, v
attenuated by exp(-T(v,p))
surface
point, p
Computing Optical Depth via RBF Splatting
single RBF splat
multiple splats
integrate optical depth
draw bounding box for each RBF
integrate analytically in pixel shader
accumulate over n blobs using alpha blending
Fog scatters, not just attenuates, light!
airlight models lighted media’s direct appearance
due to light scatter by fog particles
includes self-shadowing and haloing
volumetric blending
(attenuation only)
fogshop
(single scattering)
Single-Scattering Model for Airlight
point light, s
viewer, v
x
view ray
light scatters once off fog particle at x
path consists of two segments
exponential attenuation along each segment
accurate for thin media, plausible for denser
surface
point, p
Single-Scattering Integral
La  
0
v p
 x  k  ( x) 
exp T (v, x)  T ( s, x)  dt
I0
xs
2
s
T(s,x)
v
T(v,x)
x

p
Single-Scattering Integral
La  
0
v p
 x  k  ( x) 
exp  T (v, x)  T ( s, x)  dt
I0
xs
2
x(t) : scattering location along view ray
s
T(s,x)
v
T(v,x)
x

p
Single-Scattering Integral
La  
0
v p
 x  k  ( x) 
exp  T (v, x)  T ( s, x)  dt
I0
xs
2
(x) : optical density at x
s
T(s,x)
v
T(v,x)
x

p
Single-Scattering Integral
La  
0
v p
 x  k  ( x) 
exp  T (v, x)  T ( s, x)  dt
I0
xs
2
k() : phase function [constant]
s
T(s,x)
v
T(v,x)
x

p
Single-Scattering Integral
La  
0
v p
 x  k  ( x) 
exp T (v, x)  T ( s, x)  dt
I0
xs
2
I0 : light source intensity
s
T(s,x)
v
T(v,x)
x

p
Single-Scattering Integral
La  
0
v p
 x  k  ( x) 
exp  T (v, x)  T ( s, x)  dt
I0
xs
2
radiance reaching x, neglecting attenuation
s
T(s,x)
v
T(v,x)
x

p
Single-Scattering Integral
La  
0
v p
 x  k  ( x) 
exp  T (v, x)  T ( s, x)  dt
I0
xs
2
T(v,x), T(s,x) : optical depths
s
T(s,x)
v
T(v,x)
x

p
Single-Scattering Integral
La  
0
v p
 x  k  ( x) 
exp  T (v, x)  T ( s, x)  dt
I0
xs
2
total attenuation along path
s
T(s,x)
v
T(v,x)
x

p
Brute Force Numerical Integration
La 
  x  k  ( x )
i
i
i
I0
xi  s
2
exp T (v, xi )  T ( xi , s )  x
s
v
view ray samples xi
x

Brute Force Numerical Integration
La 
  x  k  ( x )
i
i
i
I0
xi  s
2
exp  T (v, xi )  T ( xi , s)  x
s
T(s,xi-2)
v
T(v,xi-2)
xi-2
Brute Force Numerical Integration
La 
  x  k  ( x )
i
i
i
I0
xi  s
2
exp  T (v, xi )  T ( xi , s)  x
s
T(s,xi-1)
v
T(v,xi-1)
xi-1
Brute Force Numerical Integration
La 
  x  k  ( x )
i
i
i
I0
xi  s
2
exp  T (v, xi )  T ( xi , s)  x
s
T(s,xi)
v
T(v,xi)
xi
• need many samples xi along every view ray
• each needs two optical depth integrals
• too expensive for real-time!
Our Approximation: Decompose by RBFs…
La  
0
v p
I0
1
 ( x)
4 x  s
2
exp T (v, x)  T ( x, s )  dt
Our Approximation: Decompose by RBFs…
La  
v p

v p
0
0
I0
1

( x)

4 x  s
2
exp T (v, x)  T ( x, s )  dt
n
I0

 1
  0    i ( x) 
i 1

 4 x  s
2
exp T (v, x)  T ( x, s )  dt
Our Approximation: Decompose by RBFs…
La  
v p

v p
0
0

( x)

I0
1
4 x  s
2
exp T (v, x)  T ( x, s )  dt
n
I0

 1
exp T (v, x)  T ( x, s )  dt
  0    i ( x) 
2
i 1

 4 x  s

f ( x)
Our Approximation: Decompose by RBFs…
La  
v p

v p

v p
0
0
0
I0
1

( x)

4 x  s
exp T (v, x)  T ( x, s )  dt
2
n
I0

 1
exp T (v, x)  T ( x, s )  dt
  0    i ( x) 
2
i 1

 4 x  s

f ( x)
n
 0 f ( x) dt   
i 1
0
v p
 i ( x) f ( x) dt
Our Approximation: Decompose by RBFs…
La  
v p

v p
0
0
I0
1

( x)

4 x  s
2
exp T (v, x)  T ( x, s )  dt
n
I0

 1
exp T (v, x)  T ( x, s )  dt
  0    i ( x) 
2
i 1

 4 x  s

f ( x)
n
v p
v p

 0 f ( x) dt   
 i ( x) f ( x) dt
0
0
 i 1 


L0
Li
n
 L0   Li
i 1
… and compute Li with a single sample.
i
bi
bir
v
Li  
0
v p
x(t)
 i ( x) f ( x) dt  f (b ) 
r
i
0
v p
 i ( x) dt
… and compute Li with a single sample.
i
bi
bir
v
Li  
0
v p
x(t)
i ( x) f ( x) dt  f (b ) 
r
i
r
0
v p
i ( x) dt
• projected center bi is point of max density along view ray
• assumes f (x) smooth wrt blob’s width
• i integrated analytically
Computing Li : Separate Light Paths
use red light path
Ti through bir
for blob i
[per-ray varying]
use blue light path Ti through bi for other blobs  j ≠ i
[ray invariant]
s
v
bir
bi
Reuse optical depth
integrals over many
view rays.
Computing the constant term L0
use similar light path separation trick
apply analytic method of [Sun05]
see paper for details
Accuracy of Our Approximation
ray traced
fogshop
Inaccuracy of Our Approximation
I0
1
when f ( x) 
4 x  s
2
exp T (v, x)  T ( x, s )  not smooth
x  s small
(looking right at light)
T(x,s) discontinuous
(light shafts)
ray traced
fogshop
Handling Environmental Airlight
La  exp(Tr ) L  Tr exp(Tr ) L * PSF 




attenuated only
scattered & attenuated
L : environment lighting in SH basis
Tr : optical depth along view ray r from v∞
PSF : point spread function (for convolving environment)
=
*
L
(before scatter)
PSF
L*PSF
(after scatter)
Environmental Airlight: Results
point airlight
environment airlight
Surface Reflectance: Why?
surfaces immersed in medium
incident radiance affected by scattering
subtle yet noticeable effects:



softened shading
blurred highlight
media’s shadow
can get away with lots of approximation
Surface Reflectance: How?
assume homogeneous medium of average density

average varies at each pixel, creating inhomogeneous effects

point light: average in single direction sp

environment light: average all around p
use SH lighting and PSF [Sun05]
point light s
p
environment light L
p
Surface Reflectance: Results
point light
environment light
Adding Noise
perturbed view ray
view ray
noise
perturbation
break up RBF’s circular shape

perturb view rays, indexed by
bir
be consistent when camera rotates

bir
add noise in world space
v
without noise
with noise
Rendering Summary
preliminary steps

render depth maps from camera & lights
(immersed) surface rendering
airlight rendering
Surface Rendering
compute T(s,p) for each point light s
 using RBF splatting to cube map
compute average optical depth at object centers
 if using environmental lighting
shade per-vertex
render to scene target
Airlight Rendering
compute T(v,bi), T(s,v), T(s,bi)

plane sweep algorithm on CPU
accumulate airlight and screen optical depth T(v,p)


perturb view rays if noise enabled
computed on GPU
attenuate scene target and add airlight
(
scene target
optical depth

=
result
)
airlight
+
Interactive Media Design
brush/eraser
copy/paste
particle emitter
airbrush
real-time light and camera change
Interactive Media Design: Particle Emitter
scripted using a simple language
parabolic path default
Interactive Media Design: Airbrush
particles bounce off scene surfaces
collision detection using kd-tree ray tracer
Demos
Performance
scene
3.75 Ghz PC, 2GB memory,
Nvidia 8800GTX
# vertices # RBFs
# lights
fps
gargoyle
78,054
34
3
101
box
8,901
3008
1
34
terrain
65,047
292
env. map
92
city
77,226
353
env. map
162
motorcycle
44,430
1223
env. map
31
Contributions
analytical model of single scattering for spatiallyvarying media
enables visually accurate, real-time rendering
easy-to-use tools for interactive media design
main new ideas:

decompose scattering integral, one term per RBF

sample term at peak of its RBF along view ray

optical depth integrals for other RBFs:
•
sampled at RBF center
•
precomputed and reused for multiple view rays
Limitations
inaccurate approximation near lights
light shafts ignored
environmental lighting:
— low-frequency and distant
— very approximate shadows (averages in all directions)
— use PRT for self-shadows on scene objects
Future Work
light shafts
multiple scattering
mixed surface-surface and media-surface shadowing
Thanks!