fogshop: real-time design and rendering of inhomogeneous, single-scattering media
DESCRIPTION
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 - PowerPoint PPT PresentationTRANSCRIPT
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 ignores halos/shadows
from [Sun05]
from DX10 volume fog demo
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 additioneasy-to-use media design system
Fogshop Features
Modeling Inhomogeneous Media with RBFs
optical density = sum of n 3D Gaussian blobs + constant:
easy-to-control modelcompatible with particle systems
analytic line integral via erf(x) [Stam93]
01
n
ii xx
22exp iiii bxacx
bi
ai ci
T(a,b) is optical depth between 3D points a and b:
light from ab attenuated by exp(-T(a,b))
viewer, vsurface point, p
point light, s
attenuated by exp(-T(v,p))
Attenuation by Inhomogeneous Fog
ababtatx
dtxbaTab
)()(
,0
integrate density along
path ab
Computing Optical Depth via RBF Splatting
draw bounding box for each RBFintegrate analytically in pixel shader
accumulate over n blobs using alpha blending
multiple splats integrate optical
depth
single RBF splat
airlight models lighted media’s direct appearancedue to light scatter by fog particlesincludes self-shadowing and haloing
volumetric blending (attenuation only)
fogshop (single
scattering)
Fog scatters, not just attenuates, light!
light scatters once off fog particle at x path consists of two segments exponential attenuation along each segmentaccurate for thin media, plausible for denser
viewer, vsurface point, p
point light, s
x view ray
Single-Scattering Model for Airlight
v p
s
T(v,x)
T(s,x)
x
Single-Scattering Integral
dtxsTxvTsx
IxkxL
pv
a ),(),(exp)( 20
0
v p
s
T(v,x)
T(s,x)
x
Single-Scattering Integral
dtxsTxvTsx
IxkxL
pv
a ),(),(exp)( 20
0
x(t) : scattering location along view ray
v p
s
T(v,x)
T(s,x)
x
Single-Scattering Integral
dtxsTxvTsx
IxkxL
pv
a ),(),(exp)( 20
0
(x) : optical density at x
v p
s
T(v,x)
T(s,x)
x
Single-Scattering Integral
dtxsTxvTsx
IxkxL
pv
a ),(),(exp)( 20
0
k() : phase function [constant]
v p
s
T(v,x)
T(s,x)
x
Single-Scattering Integral
dtxsTxvTsx
IxkxL
pv
a ),(),(exp)( 20
0
I0 : light source intensity
v p
s
T(v,x)
T(s,x)
x
Single-Scattering Integral
dtxsTxvTsx
IxkxL
pv
a ),(),(exp)( 20
0
radiance reaching x, neglecting attenuation
v p
s
T(v,x)
T(s,x)
x
Single-Scattering Integral
dtxsTxvTsx
IxkxL
pv
a ),(),(exp)( 20
0
T(v,x), T(s,x) : optical depths
v p
s
T(v,x)
T(s,x)
x
Single-Scattering Integral
dtxsTxvTsx
IxkxL
pv
a ),(),(exp)( 20
0
total attenuation along path
v
s
view ray samples xix
i
ii
i
iia xsxTxvTsx
IxkxL ),(),(exp)( 2
0
Brute Force Numerical Integration
Brute Force Numerical Integration
T(s,xi-2)
v
s
xi-2
T(v,xi-2)
i
ii
i
iia xsxTxvTsx
IxkxL ),(),(exp)( 2
0
Brute Force Numerical Integration
i
ii
i
iia xsxTxvTsx
IxkxL ),(),(exp)( 2
0
T(s,xi-1)
v
s
xi-1
T(v,xi-1)
Brute Force Numerical Integration
• need many samples xi along every view ray
• each needs two optical depth integrals• too expensive for real-time!
i
ii
i
iia xsxTxvTsx
IxkxL ),(),(exp)( 2
0
T(s,xi)
v
s
xi
T(v,xi)
Our Approximation: Decompose by RBFs…
dtsxTxvTsx
IxL
pv
a ),(),(exp4
1)( 2
0
0
Our Approximation: Decompose by RBFs…
dtsxTxvTsx
Ix
dtsxTxvTsx
IxL
pv n
ii
pv
a
),(),(exp4
1)(
),(),(exp4
1)(
20
01
0
20
0
Our Approximation: Decompose by RBFs…
dt
xf
sxTxvTsx
Ix
dtsxTxvTsx
IxL
pv n
ii
pv
a
)(
),(),(exp4
1)(
),(),(exp4
1)(
20
01
0
20
0
Our Approximation: Decompose by RBFs…
n
i
pv
i
pv
pv n
ii
pv
a
dtxfxdtxf
dt
xf
sxTxvTsx
Ix
dtsxTxvTsx
IxL
100 0
20
01
0
20
0
)()()(
)(
),(),(exp4
1)(
),(),(exp4
1)(
Our Approximation: Decompose by RBFs…
n
ii
n
i
i
pv
i
pv
pv n
ii
pv
a
LL
L
dtxfx
L
dtxf
dt
xf
sxTxvTsx
Ix
dtsxTxvTsx
IxL
10
10
0
0 0
20
01
0
20
0
)()()(
)(
),(),(exp4
1)(
),(),(exp4
1)(
… and compute Li with a single sample.
i
rib
v
bi
x(t)
dtxbfdtxfxLpv
iri
pv
ii
00
)()()()(
… and compute Li with a single sample.
• projected center is point of max density along view ray
• assumes f (x) smooth wrt blob’s width
• i integrated analytically
dtxbfdtxfxLpv
iri
pv
ii
00
)()()()(
rib
i
rib
v
bi
x(t)
use red light path through for blob i [per-ray varying]
use blue light path through bi for other blobs j ≠ i [ray invariant]
ib
rib
v
s
Computing Li : Separate Light Paths
rib
Reuse optical depth integrals over many view rays.
iT
iT
Computing the constant term L0
use similar light path separation trickapply analytic method of [Sun05] see paper for details
Accuracy of Our Approximation
fogshopray traced
),(),(exp4
1)( 2
0 sxTxvTsx
Ixf
not smooth
ray traced fogshop
T(x,s) discontinuous(light shafts)
small(looking right at light)
sx
Inaccuracy of Our Approximation
when
Handling Environmental Airlight
L : environment lighting in SH basis
Tr : optical depth along view ray r from v∞
PSF : point spread function (for convolving environment)
attenuated & scatteredonly attenuated
PSFLTTLTL rrra *)exp()exp(
* =
PSFL(before scatter)
L*PSF (after scatter)
Environmental Airlight: Results
point airlight environment airlight
surfaces immersed in mediumincident radiance affected by scatteringsubtle yet noticeable effects:
softened shading blurred highlight media’s shadow
can get away with lots of approximation
Standard Slide without subtitleSurface Reflectance: Why?
assume homogeneous medium of average density
average varies at each pixel, creating inhomogeneous effects point light: average in single direction sp environment light: average all around p
use SH lighting and PSF [Sun05]
Standard Slide without subtitleSurface Reflectance: How?
point light s environment light L
pp
Standard Slide without subtitleSurface Reflectance: Results
point light environment light
break up RBF’s circular shape perturb view rays, indexed by
be consistent when camera rotates add noise in world space
Standard Slide without subtitleAdding Noise
without noise with noise
view rayperturbed view ray
v
noise perturbation
rib
rib
preliminary steps render depth maps from camera & lights
(immersed) surface renderingairlight rendering
Standard Slide without subtitleRendering Summary
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-vertexrender to scene target
Standard Slide without subtitleSurface 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
Standard Slide without subtitleAirlight Rendering
+scene target optical depth airlight
result
=
( )
brush/erasercopy/pasteparticle emitterairbrushreal-time light and camera change
Standard Slide without subtitleInteractive Media Design
scripted using a simple languageparabolic path default
Standard Slide without subtitleInteractive Media Design: Particle
Emitter
particles bounce off scene surfacescollision detection using kd-tree ray tracer
Standard Slide without subtitleInteractive Media Design: Airbrush
Demos
Performance
scene#
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
3.75 Ghz PC, 2GB memory, Nvidia 8800GTX
Contributions
analytical model of single scattering for spatially-varying 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!