Professional Documents
Culture Documents
Credit
Based on group project:
Automatic Bounding of Programmable Shaders for Efficient
Global Illumination, SIGGRAPH 2009
Edgar Velzquez-Armendriz
Shuang Zhao
Milo Haan
Bruce Walter
Kavita Bala
2
2
Motivation
Programmable shading
Physically-based rendering
Challenge
Shader
color
sample (point)
Contributions
First step towards closing the gap
Interface
Provides the functions G.I. needs
Interval arithmetic
Automated compiler
Converts the shaders to interval form
Demonstration
Photon mapping
Multidimensional lightcuts
Result Preview
Multidimensional lightcuts
Photon mapping
Indirect Illumination
Procedural varying
material
Procedural varying
normal
Measured material with
PCA Reconstruction
Procedural Textures
Outline
Introduction
Background and related work
Interface between shaders and G.I.
Compiler
Results
Conclusions and future work
Related Work
Production shaders
Simplified G.I.
[Tabellion and Lamorlette 2004]
Automatic simplification
[Pellacini 2005]
Related Work
Interval methods
Ray Tracing
[Synder 1992, Bala et al. 1999, Heidrich and Seidel 1998]
Tesselation
[Moule and McCool 2002]
Culling
[Hasselgren and Akenine-Mller 2007,
Hasselgren et al. 2009]
Affine Arithmetic
[Comba and Stolfi 1993]
10
Related Work
Heidrich et al. 1998
High quality rasterization of textures
Shader
Diffuse
Phong
IsoWard
Ward
Ashikhmin
Fractal
Average
s(x, i )
#instr
20
149
151
174
486
447
i)
s(x,
before
after
3.4
2.8
2.2
2.1
3.4
2.4
3.5
2.5
2.8
2.3
4.2
2.8
3.2
2.5
i)
s(
x,
before
after
6.7
4.9
4.8
4.0
4.9
3.2
5.4
3.7
3.8
3.0
4.6
3.1
5.0
3.7
Steiner
Mitchell
!"#$
Kummer
Figure 4: Examples of implicit surfaces evaluated using interval arithmetic to find the first intersection along each ray.
code specialized for single-sided intervals, only saves on average 5%. With our optimizations, the savings are 27%.
For Fractal, the difference is smaller due to control flow
making it harder to eliminate long computations chains, but
there is still plenty of optimization potential locally.
11
Outline
Introduction
Background and related work
Interface between shaders and G.I.
Compiler
Results
Conclusions and future work
12
Interface
Functions needed
shade (point, viewDir, lightDir) color
sample (point, viewDir) direction
bound (points, viewDirs, lightDirs) max color
Covers most Monte Carlo global illumination algorithms
need versions for both eye and light tracing
multiple importance sampling needs related prob function
13
Interface
Shade (point, viewDir, lightDir)
Evaluate shading for single point and light
Written by the user as shader program
Sample (point, viewDir)
Select outgoing direction with low noise
Needed by virtually all Monte Carlo rendering algorithms
Bound (points, viewDirs, lightDirs)
Compute upper bound on shade for range of input
Used to construct our sample function and by Lightcuts
14
Importance Sampling
Importance sampling needed for:
Distribution Ray Tracing
Path tracing
Bidirectional path tracing
Metropolis
Photon Mapping
and many more
15
Importance Sampling
Generate directions with probability related to shade
Minimize weights (f/p ratio) to reduce noise
16
Importance Sampling
Shader is an unknown function
17
Importance Sampling
Shader is an unknown function
Construct piecewise-constant bounding function
18
Importance Sampling
Use bound to obtain piecewise values
Subdivide regions for better approximation
19
Importance Sampling
Use bound to obtain piecewise values
Subdivide regions for better approximation
20
Importance Sampling
Guaranteed sampling quality
f/p ratio <= volume of bounding function
Stored as a cubemap over directions
-Z
-Y
+Z
-X
+Y
+X
21
Multidimensional Lightcuts
Scalable rendering [Walter et al. 2006]
Works on clusters of lights and shading points
Uses bounding functions (S2 and S3)
Design
Importance
Sampling
Compiler
shade
Runtime
bound
sample
23
Outline
Introduction
Background and related work
Interface between shaders and G.I.
Compiler
Results
Conclusions and future work
24
=
5
25
=
[3,8]
26
Interval Arithmetic
Define interval versions of basic operations
+, -, *, /, sqrt, pow, etc.
27
27
Interval Arithmetic
Simple and general
Simple conversion even for complex functions
Cost typically 2-4x more than original non-interval version
Interval Arithmetic
Higher order variants can track value correlation
Affine and Taylor Interval Methods
Tighter result intervals
More expensive to compute
29
29
bound s2
bound s3
Kd
N
L
vector3
vector3
vector3
vector3
vector3
interval3
interval3
interval3
interval3
dot(N,L)
max(dot(N,L),0)
Kd*max()
real
real
vector3
interval
interval
interval3
interval
interval
interval3
30
Convert to SSA
y1 = 1.0;
y2 = 2.0;
x1 = y2;
x2 = x1 + 1.0;
31
Translating Branches
if (x > 0.0)
y = 0.0;
else
y = 1.0;
return y;
x=
y=
-1
-1
y1 = 0.0;
y2 = 1.0;
y3 = Psi(Greater(x,0.0), y1, y2);
return y3;
32
Translating Branches
y = z = 0.0;
if (x > 0.0)
y = 1.0;
else
z = 1.0;
y1 = 0.0;
y2 = 1.0;
z1 = 0.0;
z2 = 1.0;
y3 = Psi(Greater(x,0.0), y2, y1);
z3 = Psi(Greater(x,0.0), z1, z2);
x=
y=
z=
-1
-1
-1
33
shader
Photon Mapping
Sample
Compiler
Multidimensional
Lightcuts
Bound
Runtime
API
34
Outline
Introduction
Background and related work
Interface between shaders and G.I.
Compiler
Results
Conclusions and future work
35
Results
Highlight complex shading
System
Mostly unoptimized Java implementation
Dual quad-core Xeon E5440 2.83 GHz, 16 GB RAM
Sun Java 1.6.0-11 64 bit
36
Bounds Comparison
Compare our bounds with hand-crafted
ones
Use multidimensional lightcuts as
reference
Analytic materials
Depth of field
Antialiasing
Environment map lighting
[Walter et al. 2006]
37
Bounds Comparison
Our automatic bounds
Hand-crafted bounds
10,000
8,000
6,000
4,000
2,000
0
Time: 459 s
Time: 176 s
Importance Sampling
Automatic Importance sampling Cosine-weighted (equal time)
Time: 1,830 s
Time: 2,031 s
39
Importance Sampling
Automatic Importance sampling Cosine-weighted (3x time)
Time: 1,830 s
Time: 6,134 s
40
Time: 648 s
Size: 852x480
Time: 516 s
Size: 512x512
32 eye rays per pixel
55,000 lights
10+ M triangles
41
Time: 648 s
Size: 852x480
Time: 516 s
Size: 512x512
32 eye rays per pixel
55,000 lights
10+ M triangles
42
bershader
Fully automated G.I.
Multidimensional lightcuts
464 s
852x480 image
32 eye rays per pixel
55,000 lights
43
Results Pillow
Measured material shader
PCA Decompression
83 data textures
243 lines of code
Time: 2,413 s
512x512 image
4 eye rays per pixel
50,200 lights
44
Results Pillow
45
Time
Speed-up
Tableau
459.2 s
601 x
647.6 s
311 x
Chinchilla
516.3 s
282 x
Elephants Dream
464.0 s
834 x
2,412.5 s
8x
Pillow
46
Conclusions
First step to automatically combine
programmable shading and physically
based rendering
Compiler generates interval versions of
shaders
Prototype enables multiple Monte Carlo
global illumination algorithms
47
Acknowledgements
NSF
CAREER 0644175, CPA 0811680, CNS 0403340
Intel
Microsoft
CONACYT-Mexico 228785
NVIDIA
Autodesk
49
The End
50
51