fogshop: real-time design and rendering of inhomogeneous, single-scattering media

49
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

Upload: ellema

Post on 24-Feb-2016

43 views

Category:

Documents


0 download

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 Presentation

TRANSCRIPT

Page 1: FOGSHOP: Real-time Design and Rendering of Inhomogeneous, Single-Scattering Media

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

Page 2: FOGSHOP: Real-time Design and Rendering of Inhomogeneous, Single-Scattering Media

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

Page 3: FOGSHOP: Real-time Design and Rendering of Inhomogeneous, Single-Scattering Media

RBF model supports large fog banks immersed viewer

point lighting effects: media’s appearance and shadows

environmental lighting effects: media’s appearance, approx.

shadowssurface reflectance effects due to immersion in media

noise additioneasy-to-use media design system

Fogshop Features

Page 4: FOGSHOP: Real-time Design and Rendering of Inhomogeneous, Single-Scattering Media

Modeling Inhomogeneous Media with RBFs

optical density = sum of n 3D Gaussian blobs + constant:

easy-to-control modelcompatible with particle systemsanalytic line integral via erf(x) [Stam93]

01

n

ii xx

22exp iiii bxacx

biai ci

Page 5: FOGSHOP: Real-time Design and Rendering of Inhomogeneous, Single-Scattering Media

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

Page 6: FOGSHOP: Real-time Design and Rendering of Inhomogeneous, Single-Scattering Media

Computing Optical Depth via RBF Splatting

draw bounding box for each RBFintegrate analytically in pixel shaderaccumulate over n blobs using alpha blending

multiple splats integrate optical

depth

single RBF splat

Page 7: FOGSHOP: Real-time Design and Rendering of Inhomogeneous, Single-Scattering Media

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!

Page 8: FOGSHOP: Real-time Design and Rendering of Inhomogeneous, Single-Scattering Media

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

Page 9: FOGSHOP: Real-time Design and Rendering of Inhomogeneous, Single-Scattering Media

v p

s

T(v,x)

T(s,x)

x

Single-Scattering Integral dtxsTxvT

sxIxkxL

pv

a ),(),(exp)( 20

0

Page 10: FOGSHOP: Real-time Design and Rendering of Inhomogeneous, Single-Scattering Media

v p

s

T(v,x)

T(s,x)

x

Single-Scattering Integral dtxsTxvT

sxIxkxL

pv

a ),(),(exp)( 20

0

x(t) : scattering location along view ray

Page 11: FOGSHOP: Real-time Design and Rendering of Inhomogeneous, Single-Scattering Media

v p

s

T(v,x)

T(s,x)

x

Single-Scattering Integral dtxsTxvT

sxIxkxL

pv

a ),(),(exp)( 20

0

(x) : optical density at x

Page 12: FOGSHOP: Real-time Design and Rendering of Inhomogeneous, Single-Scattering Media

v p

s

T(v,x)

T(s,x)

x

Single-Scattering Integral dtxsTxvT

sxIxkxL

pv

a ),(),(exp)( 20

0

k() : phase function [constant]

Page 13: FOGSHOP: Real-time Design and Rendering of Inhomogeneous, Single-Scattering Media

v p

s

T(v,x)

T(s,x)

x

Single-Scattering Integral dtxsTxvT

sxIxkxL

pv

a ),(),(exp)( 20

0

I0 : light source intensity

Page 14: FOGSHOP: Real-time Design and Rendering of Inhomogeneous, Single-Scattering Media

v p

s

T(v,x)

T(s,x)

x

Single-Scattering Integral dtxsTxvT

sxIxkxL

pv

a ),(),(exp)( 20

0

radiance reaching x, neglecting attenuation

Page 15: FOGSHOP: Real-time Design and Rendering of Inhomogeneous, Single-Scattering Media

v p

s

T(v,x)

T(s,x)

x

Single-Scattering Integral dtxsTxvT

sxIxkxL

pv

a ),(),(exp)( 20

0

T(v,x), T(s,x) : optical depths

Page 16: FOGSHOP: Real-time Design and Rendering of Inhomogeneous, Single-Scattering Media

v p

s

T(v,x)

T(s,x)

x

Single-Scattering Integral dtxsTxvT

sxIxkxL

pv

a ),(),(exp)( 20

0

total attenuation along path

Page 17: FOGSHOP: Real-time Design and Rendering of Inhomogeneous, Single-Scattering Media

v

s

view ray samples xi x

i

iii

iia xsxTxvTsx

IxkxL ),(),(exp)( 20

Brute Force Numerical Integration

Page 18: FOGSHOP: Real-time Design and Rendering of Inhomogeneous, Single-Scattering Media

Brute Force Numerical Integration

T(s,xi-2)

v

s

xi-2

T(v,xi-2)

i

iii

iia xsxTxvTsx

IxkxL ),(),(exp)( 20

Page 19: FOGSHOP: Real-time Design and Rendering of Inhomogeneous, Single-Scattering Media

Brute Force Numerical Integration

iii

iiia xsxTxvT

sxIxkxL ),(),(exp)( 2

0

T(s,xi-1)

v

s

xi-1

T(v,xi-1)

Page 20: FOGSHOP: Real-time Design and Rendering of Inhomogeneous, Single-Scattering Media

Brute Force Numerical Integration

• need many samples xi along every view ray• each needs two optical depth integrals• too expensive for real-time!

i

iii

iia xsxTxvTsx

IxkxL ),(),(exp)( 20

T(s,xi)

v

s

xi

T(v,xi)

Page 21: FOGSHOP: Real-time Design and Rendering of Inhomogeneous, Single-Scattering Media

Our Approximation: Decompose by RBFs…

dtsxTxvTsx

IxLpv

a ),(),(exp41)( 2

00

Page 22: FOGSHOP: Real-time Design and Rendering of Inhomogeneous, Single-Scattering Media

Our Approximation: Decompose by RBFs…

dtsxTxvTsx

Ix

dtsxTxvTsx

IxL

pv n

ii

pv

a

),(),(exp41)(

),(),(exp41)(

20

01

0

20

0

Page 23: FOGSHOP: Real-time Design and Rendering of Inhomogeneous, Single-Scattering Media

Our Approximation: Decompose by RBFs…

dt

xf

sxTxvTsx

Ix

dtsxTxvTsx

IxL

pv n

ii

pv

a

)(

),(),(exp41)(

),(),(exp41)(

20

01

0

20

0

Page 24: FOGSHOP: Real-time Design and Rendering of Inhomogeneous, Single-Scattering Media

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

)()()(

)(

),(),(exp41)(

),(),(exp41)(

Page 25: FOGSHOP: Real-time Design and Rendering of Inhomogeneous, Single-Scattering Media

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

)()()(

)(

),(),(exp41)(

),(),(exp41)(

Page 26: FOGSHOP: Real-time Design and Rendering of Inhomogeneous, Single-Scattering Media

… and compute Li with a single sample. i

rib

v

bi

x(t)

dtxbfdtxfxLpv

iri

pv

ii

00

)()()()(

Page 27: FOGSHOP: Real-time Design and Rendering of Inhomogeneous, Single-Scattering Media

… 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)

Page 28: FOGSHOP: Real-time Design and Rendering of Inhomogeneous, Single-Scattering Media

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 Pathsrib

Reuse optical depth integrals over many view rays.

iT

iT

Page 29: FOGSHOP: Real-time Design and Rendering of Inhomogeneous, Single-Scattering Media

Computing the constant term L0

use similar light path separation trickapply analytic method of [Sun05] see paper for details

Page 30: FOGSHOP: Real-time Design and Rendering of Inhomogeneous, Single-Scattering Media

Accuracy of Our Approximation

fogshopray traced

Page 31: FOGSHOP: Real-time Design and Rendering of Inhomogeneous, Single-Scattering Media

),(),(exp41)( 2

0 sxTxvTsx

Ixf

not

smooth

ray traced fogshop

T(x,s) discontinuous(light shafts)

small(looking right at light)

sx

Inaccuracy of Our Approximationwhen

Page 32: FOGSHOP: Real-time Design and Rendering of Inhomogeneous, Single-Scattering Media

Handling Environmental Airlight

L : environment lighting in SH basisTr : 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)

Page 33: FOGSHOP: Real-time Design and Rendering of Inhomogeneous, Single-Scattering Media

Environmental Airlight: Results

point airlight environment airlight

Page 34: FOGSHOP: Real-time Design and Rendering of Inhomogeneous, Single-Scattering Media

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?

Page 35: FOGSHOP: Real-time Design and Rendering of Inhomogeneous, Single-Scattering Media

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 puse SH lighting and PSF [Sun05]

Standard Slide without subtitleSurface Reflectance: How?

point light s environment light L

pp

Page 36: FOGSHOP: Real-time Design and Rendering of Inhomogeneous, Single-Scattering Media

Standard Slide without subtitleSurface Reflectance: Results

point light environment light

Page 37: FOGSHOP: Real-time Design and Rendering of Inhomogeneous, Single-Scattering Media

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

Page 38: FOGSHOP: Real-time Design and Rendering of Inhomogeneous, Single-Scattering Media

preliminary steps render depth maps from camera & lights(immersed) surface renderingairlight rendering

Standard Slide without subtitleRendering Summary

Page 39: FOGSHOP: Real-time Design and Rendering of Inhomogeneous, Single-Scattering Media

compute T(s,p) for each point light s using RBF splatting to cube mapcompute average optical depth at object centers if using environmental lightingshade per-vertexrender to scene target

Standard Slide without subtitleSurface Rendering

Page 40: FOGSHOP: Real-time Design and Rendering of Inhomogeneous, Single-Scattering Media

compute T(v,bi), T(s,v), T(s,bi) plane sweep algorithm on CPUaccumulate airlight and screen optical depth T(v,p) perturb view rays if noise enabled computed on GPUattenuate scene target and add airlight

Standard Slide without subtitleAirlight Rendering

+scene target optical depth airlight

result

=

( )

Page 41: FOGSHOP: Real-time Design and Rendering of Inhomogeneous, Single-Scattering Media

brush/erasercopy/pasteparticle emitterairbrushreal-time light and camera change

Standard Slide without subtitleInteractive Media Design

Page 42: FOGSHOP: Real-time Design and Rendering of Inhomogeneous, Single-Scattering Media

scripted using a simple languageparabolic path default

Standard Slide without subtitleInteractive Media Design: Particle

Emitter

Page 43: FOGSHOP: Real-time Design and Rendering of Inhomogeneous, Single-Scattering Media

particles bounce off scene surfacescollision detection using kd-tree ray tracer

Standard Slide without subtitleInteractive Media Design: Airbrush

Page 44: FOGSHOP: Real-time Design and Rendering of Inhomogeneous, Single-Scattering Media

Demos

Page 45: FOGSHOP: Real-time Design and Rendering of Inhomogeneous, Single-Scattering Media

Performancescene #

vertices#

RBFs # lights fps

gargoyle 78,054 34 3 101box 8,901 3008 1 34terrain 65,047 292 env. map 92city 77,226 353 env. map 162motorcycle 44,430 1223 env. map 31

3.75 Ghz PC, 2GB memory, Nvidia 8800GTX

Page 46: FOGSHOP: Real-time Design and Rendering of Inhomogeneous, Single-Scattering Media

Contributionsanalytical model of single scattering for spatially-varying mediaenables visually accurate, real-time renderingeasy-to-use tools for interactive media designmain 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

Page 47: FOGSHOP: Real-time Design and Rendering of Inhomogeneous, Single-Scattering Media

Limitationsinaccurate approximation near lightslight shafts ignoredenvironmental lighting:— low-frequency and distant— very approximate shadows (averages in all directions)— use PRT for self-shadows on scene objects

Page 48: FOGSHOP: Real-time Design and Rendering of Inhomogeneous, Single-Scattering Media

Future Worklight shaftsmultiple scatteringmixed surface-surface and media-surface shadowing

Page 49: FOGSHOP: Real-time Design and Rendering of Inhomogeneous, Single-Scattering Media

Thanks!