A Practical Analytic Single Scattering Model for Real Time Rendering Bo Sun Ravi Ramamoorthi Srinivasa Narasimhan Shree Nayar Columbia University Columbia University Carnegie Mellon University Columbia University Sponsors: ONR, NSF.

Download Report

Transcript A Practical Analytic Single Scattering Model for Real Time Rendering Bo Sun Ravi Ramamoorthi Srinivasa Narasimhan Shree Nayar Columbia University Columbia University Carnegie Mellon University Columbia University Sponsors: ONR, NSF.

A Practical Analytic Single Scattering
Model for Real Time Rendering
Bo Sun
Ravi Ramamoorthi
Srinivasa Narasimhan
Shree Nayar
Columbia University
Columbia University
Carnegie Mellon University
Columbia University
Sponsors: ONR, NSF
Light Transport in Scattering Media
Scattered (glows)
Viewer
Point Source
Surface Point
Clear Day
Foggy Day
Our Technical Contributions
 Explicit compact Airlight formula
 Explicit Surface Radiance formula
- Accurate
- Simple fragment shader
- Fully interactive
Assumptions:
 Isotropic point light sources
 Homogenous media
 Single scattering
 No volumetric shadows
The Airlight Integral
 : scattering coefficient of the medium
Point Source, s
Dsv
d
Surface Point, p
Viewer, v

Dvp
x

The Airlight Integral:
I 0  e   d  x
  k ( ) 
e
2
d
The Airlight Integral
 : scattering coefficient of the medium
Point Source, s
Dsv
Surface Point, p
Viewer, v

The Airlight Integral:
I 0  e  d  x
  k ( ) 
e
2
d
The Airlight Integral
 : scattering coefficient of the medium
Point Source, s
Dsv
Surface Point, p
Viewer, v

The Airlight Integral:
I 0  e  d  x
  k ( ) 
e
2
d
The Airlight Integral
 : scattering coefficient of the medium
Point Source, s
Dsv
Surface Point, p
Viewer, v

The Airlight Integral:
I 0  e  d  x
  k ( ) 
e
2
d
The Airlight Integral
 : scattering coefficient of the medium
Point Source, s
Dsv
Surface Point, p
Viewer, v

The Airlight Integral:
I 0  e  d  x
  k ( ) 
e
2
d
The Airlight Integral
 : scattering coefficient of the medium
Point Source, s
Dsv
Surface Point, p
Viewer, v

Dvp

Dvp
The Airlight Integral:

0
I 0  e  d  x
  k ( ) 
 e dx
2
d
The Airlight Integral
 : scattering coefficient of the medium
Point Source, s
Dsv
Surface Point, p
Viewer, v

Dvp

Dvp
The Airlight Integral: Lairlight( , Dsv , Dvp ,  ) 

0
I 0  e  d  x
  k ( ) 
 e dx
2
d
The Airlight Model
Originally 4D:
 , Dsv , Dvp , 
Point Source, s
Dsv
Lairlight
Viewer, v
Surface Point, p

Dvp

Tvp  Tsv cos 
 1

A0 [ F ( A1 ,  arctan
) F ( A1 , )]
4 2
Tsv sin 
2
The Airlight Model
Originally 4D:
 , Dsv , Dvp , 
Point Source, s
Dsv
Viewer, v
Lairlight
 2 I 0 e T cos 
2Tsv sin 
sv
Tsv sin 
Surface Point, p

Dvp

Tvp  Tsv cos 
 1

A0 [ F ( A1 ,  arctan
) F ( A1 , )]
4 2
Tsv sin 
2
The Airlight Model
Originally 4D:
 , Dsv , Dvp , 
Point Source, s
Dsv
Lairlight
Viewer, v
Surface Point, p

Dvp

Tvp  Tsv cos 
 1

A0 [ F ( A1 ,  arctan
) F ( A1 , )]
4 2
Tsv sin 
2
Special Function F
v
F (u, v)   exp[ u tan  ]d
0
 Well behaved and purely numerical 2D function.
 Pre-computed once for all and stored as a 2D texture.
Shader Code for Airlight Model
float AirLight( )
{
float u = A1(beta, Dsv, gammasv);
float v1 = 0.25*PI+0.5*atan((DvpDsv*cos(gammasv))/(Dsv*sin(gammasv)));
float v2 = 0.5*gammasv;
float4 f_1=texRECT(F, v1, u);
float4 f_2=texRECT(F, v2, u);
return A0(lightIntensity, beta, Dsv, gammasv)*(f_1.x-f_2.x);
}
Tvp  Tsv cos 
 1

A0 [ F ( A1 ,  arctan
) F ( A1 , )]
4 2
Tsv sin 
2
Shader Code for Airlight Model
float AirLight( )
{
float u = A1(beta, Dsv, gammasv);
float v1 = 0.25*PI+0.5*atan((DvpDsv*cos(gammasv))/(Dsv*sin(gammasv)));
float v2 = 0.5*gammasv;
float4 f_1=texRECT(F, v1, u);
float4 f_2=texRECT(F, v2, u);
return A0(lightIntensity, beta, Dsv, gammasv)*(f_1.x-f_2.x);
}
Tvp  Tsv cos 
 1

A0 [ F ( A1 ,  arctan
) F ( A1 , )]
4 2
Tsv sin 
2
Shader Code for Airlight Model
float AirLight( )
{
float u = A1(beta, Dsv, gammasv);
float v1 = 0.25*PI+0.5*atan((DvpDsv*cos(gammasv))/(Dsv*sin(gammasv)));
float v2 = 0.5*gammasv;
float4 f_1=texRECT(F, v1, u);
float4 f_2=texRECT(F, v2, u);
return A0(lightIntensity, beta, Dsv, gammasv)*(f_1.x-f_2.x);
}
Tvp  Tsv cos 
 1

A0 [ F ( A1 ,  arctan
) F ( A1 , )]
4 2
Tsv sin 
2
Shader Code for Airlight Model
float AirLight( )
{
float u = A1(beta, Dsv, gammasv);
float v1 = 0.25*PI+0.5*atan((DvpDsv*cos(gammasv))/(Dsv*sin(gammasv)));
float v2 = 0.5*gammasv;
float4 f_1=texRECT(F, v1, u);
float4 f_2=texRECT(F, v2, u);
return A0(lightIntensity, beta, Dsv, gammasv)*(f_1.x-f_2.x);
}
Tvp  Tsv cos 
 1

A0 [ F ( A1 ,  arctan
) F ( A1 , )]
4 2
Tsv sin 
2
Shader Code for Airlight Model
float AirLight( )
{
float u = A1(beta, Dsv, gammasv);
float v1 = 0.25*PI+0.5*atan((DvpDsv*cos(gammasv))/(Dsv*sin(gammasv)));
float v2 = 0.5*gammasv;
float4 f_1=texRECT(F, v1, u);
float4 f_2=texRECT(F, v2, u);
return A0(lightIntensity, beta, Dsv, gammasv)*(f_1.x-f_2.x);
}
Tvp  Tsv cos 
 1

A0 [ F ( A1 ,  arctan
) F ( A1 , )]
4 2
Tsv sin 
2
Implementation Choices for Airlight
1. 64x64 floating point texture for F table
Nearest Neighbor
Bilinear Interpolation
2. Add a skybox to invoke vertex/pixel shader to compute
Airlight.
Airlight Demo
Demo
The Surface Radiance Model
Point Source, s
Viewer, v
BRDF
n̂
Surface Point, p
The Surface Radiance Model
Point Source, s
BRDF
Viewer, v
n̂
Surface Point, p
2D : G0, Gn
1D function on
 i : Lambertian, Phong
Lsurface   Lairlight  BRDF  cos i  di
2D: F
Special Function G
Shader Code for Surface Radiance
float SurfaceRadiance( )
{
float4 G = texRECT(G_20, Tsp, thetas);
return Ks*Io*beta/(2*Dsp*PI)*G;
}
I 0k s 
Lsurface 
Gn (Tsp ,  s ' )
2Tsp
2
Shader Code for Surface Radiance
float SurfaceRadiance( )
{
float4 G = texRECT(G_20, Tsp, thetas);
return Ks*Io*beta/(2*Dsp*PI)*G;
}
I 0k s 
Lsurface 
Gn (Tsp ,  s ' )
2Tsp
2
Shader Code for Surface Radiance
float SurfaceRadiance( )
{
float4 G = texRECT(G_20, Tsp, thetas);
return Ks*Io*beta/(2*Dsp*PI)*G;
}
I 0k s 
Lsurface 
Gn (Tsp ,  s ' )
2Tsp
2
Implementation Choices for Surface Radiance
1. Need to add radiance contribution from attenuated direct
lighting.
2. Attenuate the final radiance according to distance to the
camera.
Point Source, s
Viewer, v
BRDF
n̂
Surface Point, p
Implementation Choices for Surface Radiance
1. Need to add radiance contribution from attenuated direct
lighting.
2. Attenuate the final radiance according to distance to the
camera.
Point Source, s
Viewer, v
BRDF
n̂
Surface Point, p
Lambertian and Phong Spheres
Clear
Day
Lambertian
Foggy
Day
Phong=10
Phong=20
The Complete Model
Le
 Tvp
Lsurface  Lairlight
Surface Radiance Model
Airlight Model
2 Lookups G0 and Gn
2 Lookups
F
The Complete Model
Le
 Tvp
Lsurface  Lairlight
Surface Radiance Model
Airlight Model
2 Lookups G0 and Gn
2 Lookups
Image size
Texture lookups
Lights
F
Terms to approximate the phase function
4 S  I  N
Analytic expression 8  S  I
Maya Plug-in available from our website.
Demo: Complex Geometry
Demo
Complex Lighting and Material
Rendering time is linear in the number of lights.
Dsv
Viewer, v
n̂
Surface Point, p
Dvp
BRDF
Point Spread Function
 Assume equidistant point sources
 Scattering is essentially Point Spread Function (PSF).
Intensity
Input

Output
Angles
Intensity
Intensity
PSF
Angles
Angular Component

Amplitude Component
Point Spread Function
 Assume equidistant point sources
 Scattering is essentially Point Spread Function (PSF).
Intensity
Input

Output
Angles
Intensity
Intensity
PSF
Angles
Angular Component

Amplitude Component
Tsv*exp[-Tsv] * Pre-convolved Environment Map
Convolution with PSF
BRDF
Clear Day
Foggy Day
Environment Map
Demo: PSF for Complex Lighting
Demo
Summary
An OpenGL-Like Practical Real-Time Rendering Technique:
 Analytic Airlight Model
50fps
40fps
Summary
An OpenGL-Like Practical Real-Time Rendering Technique:
 Analytic Airlight Model
 Analytic Surface Radiance Model
50fps
60fps
Summary
An OpenGL-Like Practical Real-Time Rendering Technique:
 Analytic Airlight Model
 Analytic Surface Radiance Model
 PSF for Complex Lighting and Natural Material
100fps
20fps
Acknowledgement
 R. Wang, J. Tran and D. Luebke for the PRT code.
 S. Premoze for the Monte Carlo simulation code.
 P. Debevec for the light probes.
 W. Matusik for the tabulated BRDF.
Supported by a Columbia University Presidential Fellowship, an
ONR Grant, an NSF Grant, an NSF CAREER award, and
equipment donations from Intel and NVIDIA.
Thanks for Listening!
Maya Plug-in, 2D tables, and Shader code:
http://www.cs.columbia.edu/~bosun/research.htm
The End
The End