SlideShare uses cookies to improve functionality and performance, and to provide you with relevant advertising. If you continue browsing the site, you agree to the use of cookies on this website. See our User Agreement and Privacy Policy.
SlideShare uses cookies to improve functionality and performance, and to provide you with relevant advertising. If you continue browsing the site, you agree to the use of cookies on this website. See our Privacy Policy and User Agreement for details.
Successfully reported this slideshow.
Activate your 30 day free trial to unlock unlimited reading.
Introduction to Bidirectional Path Tracing (BDPT) & Implementation using OpenCL (CEDEC 2015)
6.
6
|
OPENCL
BDPT
|
AUGUST
28,
2015
|
HARADA,
IKEDA,
FUJITA
FIRST
PATH
TRACING
7.
7
|
OPENCL
BDPT
|
AUGUST
28,
2015
|
HARADA,
IKEDA,
FUJITA
PATH
TRACING
IMPLEMENTATION
#1
for(int i=0; i<nx; i++) for(int j=0; j<ny; j++)!
{!
Ray ray = genPrimaryRay( i, j );!
!
float4 coeff = 1.f;!
float4& output = pixel[i,j];!
for(int depth=0; depth<maxDepth; depth++)!
{!
Hit hit = intersect( ray );!
if( !hit.hasHit() ) break;!
!
if( hit.isEmissive() )!
{// Implicit Connection!
output += coeff * getEmission( hit );!
break;!
}!
!
ray, f, pdf = randomSample( hit );!
coeff *= f * dot( hit.m_n, ray.m_dir ) / pdf;!
}!
}!
8.
8
|
OPENCL
BDPT
|
AUGUST
28,
2015
|
HARADA,
IKEDA,
FUJITA
SAMPLING
NEXT
RAY
y For
non
transmission
surface,
no
need
to
sample
the
other
side
RANDOM
SAMPLING
for(int i=0; i<nx; i++) for(int j=0; j<ny; j++)!
{!
Ray ray = genPrimaryRay( i, j );!
!
float4 coeff = 1.f;!
float4& output = pixel[i,j];!
for(int depth=0; depth<maxDepth; depth++)!
{!
Hit hit = intersect( ray );!
if( !hit.hasHit() ) break;!
!
if( hit.isEmissive() )!
{// Implicit Connection!
output += coeff * getEmission( hit );!
break;!
}!
!
ray, f, pdf = randomSample( hit );!
coeff *= f * dot( hit.m_n, ray.m_dir ) / pdf;!
}!
}!
9.
9
|
OPENCL
BDPT
|
AUGUST
28,
2015
|
HARADA,
IKEDA,
FUJITA
SAMPLING
NEXT
RAY
y Random
sampling
is
not
always
efficient
‒ Diffuse
surface
=>
OK
‒ Glossy
surface
=>
Hmm
L
‒ Specular
surface
=>
Bad
L
y We
usually
know
the
reflecJon
characterisJcs
about
surface
‒ Why
not
use
them?
‒ “Importance
sampling”
(BRDF)
RANDOM
SAMPLING
10.
10
|
OPENCL
BDPT
|
AUGUST
28,
2015
|
HARADA,
IKEDA,
FUJITA
IMPORTANCE
SAMPLING
(BRDF)
y Specular
surface
‒ Only
reflect
in
the
mirrored
direcJon
‒ Always
sample
the
direcJon
(pdf
=
1)
y Glossy
surface
‒ Mostly
reflect
around
mirrored
direcJon
‒ Sample
around
the
mirrored
direcJon
Specular
(R)
Glossy
Mae
Specular
(T)
11.
11
|
OPENCL
BDPT
|
AUGUST
28,
2015
|
HARADA,
IKEDA,
FUJITA
PATH
TRACING
IMPLEMENTATION
#2
for(int i=0; i<nx; i++) for(int j=0; j<ny; j++)!
{!
Ray ray = genPrimaryRay( i, j );!
!
float4 coeff = 1.f;!
float4& output = pixel[i,j];!
for(int depth=0; depth<maxDepth; depth++)!
{!
Hit hit = intersect( ray );!
if( !hit.hasHit() ) break;!
!
if( hit.isEmissive() )!
{// Implicit Connection!
output += coeff * getEmission( hit );!
break;!
}!
!
ray, f, pdf = randomSample( hit );!
coeff *= f * dot( hit.m_n, ray.m_dir ) / pdf;!
}!
}!
for(int i=0; i<nx; i++) for(int j=0; j<ny; j++)!
{!
Ray ray = genPrimaryRay( i, j );!
!
float4 coeff = 1.f;!
float4& output = pixel[i,j];!
for(int depth=0; depth<maxDepth; depth++)!
{!
Hit hit = intersect( ray );!
if( !hit.hasHit() ) break;!
!
if( hit.isEmissive() )!
{// Implicit Connection!
output += coeff * getEmission( hit );!
break;!
}!
!
ray, f, pdf = brdfSample( hit );!
coeff *= f * dot( hit.m_n, ray.m_dir ) / pdf;!
}!
}!
Random
Sampling
Brdf
Importance
Sampling
12.
12
|
OPENCL
BDPT
|
AUGUST
28,
2015
|
HARADA,
IKEDA,
FUJITA
PATH
TRACING
IMPLEMENTATION
#2
for(int i=0; i<nx; i++) for(int j=0; j<ny; j++)!
{!
Ray ray = genPrimaryRay( i, j );!
!
float4 coeff = 1.f;!
float4& output = pixel[i,j];!
for(int depth=0; depth<maxDepth; depth++)!
{!
Hit hit = intersect( ray );!
if( !hit.hasHit() ) break;!
!
if( hit.isEmissive() )!
{// Implicit Connection!
output += coeff * getEmission( hit );!
break;!
}!
!
ray, f, pdf = randomSample( hit );!
coeff *= f * dot( hit.m_n, ray.m_dir ) / pdf;!
}!
}!
for(int i=0; i<nx; i++) for(int j=0; j<ny; j++)!
{!
Ray ray = genPrimaryRay( i, j );!
!
float4 coeff = 1.f;!
float4& output = pixel[i,j];!
for(int depth=0; depth<maxDepth; depth++)!
{!
Hit hit = intersect( ray );!
if( !hit.hasHit() ) break;!
!
if( hit.isEmissive() )!
{// Implicit Connection!
output += coeff * getEmission( hit );!
break;!
}!
!
ray, f, pdf = brdfSample( hit );!
coeff *= f * dot( hit.m_n, ray.m_dir ) / pdf;!
}!
}!
Random
Sampling
Brdf
Importance
Sampling
13.
13
|
OPENCL
BDPT
|
AUGUST
28,
2015
|
HARADA,
IKEDA,
FUJITA
INEFFICIENT
CASE
y Rough
surface
+
Small
light
y Brdf
sampling
rarely
hits
the
light
y SoluJon
‒ We
know
where
the
lights
are
‒ Why
ignoring??
‒ Generate
ray
from
lights
‒ “Importance
sampling”
(Light)
Rough
Reference
Brdf
sampling
14.
14
|
OPENCL
BDPT
|
AUGUST
28,
2015
|
HARADA,
IKEDA,
FUJITA
INEFFICIENT
CASE
y Rough
surface
+
Small
light
y Brdf
sampling
rarely
hits
the
light
y SoluJon
‒ We
know
where
the
lights
are
‒ Why
ignoring??
‒ Generate
ray
from
lights
‒ “Importance
sampling”
(Light)
Rough
Reference
Brdf
sampling
Light
sampling
15.
15
|
OPENCL
BDPT
|
AUGUST
28,
2015
|
HARADA,
IKEDA,
FUJITA
PATH
TRACING
IMPLEMENTATION
#3
for(int i=0; i<nx; i++) for(int j=0; j<ny; j++)!
{!
Ray ray = genPrimaryRay( i, j );!
!
float4 coeff = 1.f;!
float4& output = pixel[i,j];!
for(int depth=0; depth<maxDepth; depth++)!
{!
Hit hit = intersect( ray );!
if( !hit.hasHit() ) break;!
!
if( hit.isEmissive() )!
{// Implicit Connection!
output += coeff * getEmission( hit );!
break;!
}!
!
ray, f, pdf = brdfSample( hit );!
coeff *= f * dot( hit.m_n, ray.m_dir ) / pdf;!
}!
}!
for(int i=0; i<nx; i++) for(int j=0; j<ny; j++)!
{!
Ray ray = genPrimaryRay( i, j );!
!
float4 coeff = 1.f;!
float4& output = pixel[i,j];!
for(int depth=0; depth<maxDepth; depth++)!
{!
Hit hit = intersect( ray );!
if( !hit.hasHit() ) break;!
{// Explicit Connection!
ray, pdf = lightSample( hit );!
Hit hit1 = intersect( ray );!
if( !hit1.hasHit() )!
{!
output+=coeff*getEmission( hit1 )/pdf;!
}!
}!
ray, f, pdf = brdfSample( hit );!
coeff *= f * dot( hit.m_n, ray.m_dir ) / pdf;!
}!
}!
Brdf
Importance
Sampling
Light
Importance
Sampling
16.
16
|
OPENCL
BDPT
|
AUGUST
28,
2015
|
HARADA,
IKEDA,
FUJITA
IMPLICIT
CONNECTION,
EXPLICIT
CONNECTION
y Implicit
ConnecJon
‒ A
ray
accidentally
hit
a
light
source
‒ Ater
primary
rays
are
generated
from
camera
‒ Ater
bounced
rays
are
sampled
from
BRDF
y Explicit
ConnecJon
‒ A
path
is
intenJonally
connected
to
a
light
source
‒ Direct
illuminaJon
(sample
a
vertex
on
a
light
source)
Camera
Light
Object
Camera
Light
Object
17.
17
|
OPENCL
BDPT
|
AUGUST
28,
2015
|
HARADA,
IKEDA,
FUJITA
PATH
TRACING
IMPLEMENTATION
#3
y We
should
not
accumulaJng
implicit
hits
for
this
implementaBon
y Even
if
a
ray
hits
an
emissive
surface,
we
ignore
it
y Sounds
like
we
are
wasJng
something
NOTE
18.
18
|
OPENCL
BDPT
|
AUGUST
28,
2015
|
HARADA,
IKEDA,
FUJITA
BRDF
SAMPLING
+
LIGHT
SAMPLING
y Both
generate
image
‒ Each
technique
has
strong
&
weak
points
‒ Converges
to
the
same
image
at
the
end
Brdf
sampling
(16spp)
Light
sampling
(16spp)
Brdf
sampling
(inf. spp)
Light
sampling
(inf. spp)
=
19.
19
|
OPENCL
BDPT
|
AUGUST
28,
2015
|
HARADA,
IKEDA,
FUJITA
PATH
TRACING
IMPLEMENTATION
#3
y We
should
not
accumulaJng
implicit
hits
for
this
implementaBon
y Even
if
a
ray
hits
an
emissive
surface,
we
ignore
it
y Sounds
like
we
are
wasJng
something
y Can
we
use
it
somehow?
NOTE
20.
20
|
OPENCL
BDPT
|
AUGUST
28,
2015
|
HARADA,
IKEDA,
FUJITA
BRDF
SAMPLING
+
LIGHT
SAMPLING
y Then
simply…
Take
an
average?
‒ Works
‒ but
not
the
best
y We
can
set
any
coefficients
if
they
sum
up
to
1.0
‒ brdfSampledImage
*
0.2
+
lightSampledImage
*
0.8
?
‒ brdfSampledImage
*
0.8
+
lightSampledImage
*
0.2
?
‒ Hmm…
x
0.5
+
x
0.5
Brdf
sample
Light
sample
x
0.2
+
x
0.8
Brdf
sample
Light
sample
21.
21
|
OPENCL
BDPT
|
AUGUST
28,
2015
|
HARADA,
IKEDA,
FUJITA
J
L
COMPARING
BRDF
SAMPLING
AND
LIGHT
SAMPLING
y Light
sampling
‒ Good
for
rough
surface
‒ Bad
for
sharp
surface
y Brdf
sampling
‒ Bad
for
rough
surface
‒ Good
for
sharp
surface
L
J
22.
22
|
OPENCL
BDPT
|
AUGUST
28,
2015
|
HARADA,
IKEDA,
FUJITA
BRDF
SAMPLING
+
LIGHT
SAMPLING
y Then
simply…
Take
an
average?
‒ Works
‒ but
not
the
best
y We
can
set
any
coefficients
if
they
sum
up
to
1.0
‒ brdfSampledImage
*
0.2
+
lightSampledImage
*
0.8
?
‒ brdfSampledImage
*
0.8
+
lightSampledImage
*
0.2
?
‒ Hmm
y We
do
not
have
to
se
the
same
coefficients
for
all
the
pixels
J
‒ “MulJple
importance
sampling”
‒ Per
pixel
weight
x
0.5
+
x
0.5
Brdf
sample
Light
sample
x
0.2
+
x
0.8
Brdf
sample
Light
sample
x
+
x
=
Brdf
sample
Light
sample
w_b
w_l
MIS
23.
23
|
OPENCL
BDPT
|
AUGUST
28,
2015
|
HARADA,
IKEDA,
FUJITA
BRDF
SAMPLING
+
LIGHT
SAMPLING
y Uniform
weighJng
(Average)
y Per
pixel
weighJng
(MulJple
Importance
Sampling,
MIS)
VISUALIZATION
OF
MIS
x
+
x
=
Brdf
sample
Light
sample
w_b
w_l
MIS
+
=
1.0
w_b
w_l
x
+
x
=
Brdf
sample
Light
sample
w_b
w_l
Average
0.5
0.5
0.5
0.5
+
=
1.0
w_b
w_l
25.
25
|
OPENCL
BDPT
|
AUGUST
28,
2015
|
HARADA,
IKEDA,
FUJITA
MULTIPLE
IMPORTANCE
SAMPLING
WEIGHT
y Detailed
look
at
brdf
&
light
sampling
(direct
illuminaJon)
y Possible
to
sample
the
same
direcJon
using
both
sampling
technique
‒ Only
difference
is
the
PDF
(probability
density
funcJon)
y Rough
surface
‒ PDF
of
Brdf
sampling
is
almost
uniform
‒ Low
confidence
in
the
sample
=>
Higher
noise
‒ PDF
of
light
sampling
has
a
strong
spike
at
light
direcJon
‒ High
confidence
in
the
sample
=>
Lower
noise
Brdf
Sampling
Light
Sampling
26.
26
|
OPENCL
BDPT
|
AUGUST
28,
2015
|
HARADA,
IKEDA,
FUJITA
MULTIPLE
IMPORTANCE
SAMPLING
WEIGHT
y Detailed
look
at
brdf
&
light
sampling
(direct
illuminaJon)
y Possible
to
sample
the
same
direcJon
using
both
sampling
technique
‒ Only
difference
is
the
PDF
(probability
density
funcJon)
y Sharp
surface
‒ PDF
of
Brdf
sampling
is
almost
uniform
‒ Very
high
confidence
in
the
sample
=>
Lower
noise
‒ PDF
of
light
sampling
has
a
strong
spike
at
light
direcJon
‒ RelaJvely
lower
confidence
in
the
sample
=>
Higher
noise
Brdf
Sampling
Light
Sampling
27.
27
|
OPENCL
BDPT
|
AUGUST
28,
2015
|
HARADA,
IKEDA,
FUJITA
MULTIPLE
IMPORTANCE
SAMPLING
WEIGHT
y Use
sampling
PDF
to
compute
weight
y Weight
for
light
sample
(Explicit
hit)
y Weight
for
brdf
sample
(Implicit
hit)
y This
is
very
important
for
an
efficient
BDPT
28.
28
|
OPENCL
BDPT
|
AUGUST
28,
2015
|
HARADA,
IKEDA,
FUJITA
PATH
TRACING
IMPLEMENTATION
#4
(FINAL)
for(int i=0; i<nx; i++) for(int j=0; j<ny; j++)!
{!
Ray ray = genPrimaryRay( i, j );!
!
float4 coeff = 1.f;!
float4& output = pixel[i,j];!
float pdfb = 0.f;!
for(int depth=0; depth<maxDepth; depth++)!
{!
Hit hit = intersect( ray );!
if( !hit.hasHit() ) break;!
if( hit.isEmissive() )!
{// Implicit Connection!
pdfl = lightPdf( hit );!
w = pdfb / (pdfb + pdfl);!
output += coeff * getEmission( hit ) * w;!
break;!
}!
{// Explicit Connection!
ray, pdfl = lightSample( hit );!
Hit hit1 = intersect( ray );!
if( !hit1.hasHit() )!
{!
w = pdfl / (pdfb + pdfl);!
output += coeff * getEmission( hit1 ) * w / pdfl;!
}!
}!
ray, f, pdfb = brdfSample( hit );!
coeff *= f * dot( hit.m_n, nextRay.m_dir ) / pdfb;!
}!
}!
33.
33
|
OPENCL
BDPT
|
AUGUST
28,
2015
|
HARADA,
IKEDA,
FUJITA
PATH
TRACING
IS
NOT
PERFECT
y Path
tracing
is
really
good
at
an out
door
scene
y But
not
for
a
scene
mostly
lit
by
indirect
illuminaJon
(indoor,
day
Jme)
34.
34
|
OPENCL
BDPT
|
AUGUST
28,
2015
|
HARADA,
IKEDA,
FUJITA
PATH
TRACING
IS
NOT
PERFECT
64
spp
256
spp
1024
spp
x
4
x
4
Indoor
Indoor/outdoor
Outdoor
Good
Ok
Bad
Path
Tracing
is..
35.
35
|
OPENCL
BDPT
|
AUGUST
28,
2015
|
HARADA,
IKEDA,
FUJITA
BAD
CONVERGENCE
FOR
INDOOR
SCENE
y Ray
needs
to
be
bounced
more
than
once
before
connecJng
to
the
light
source
y As
we
bounce,
we
get
less
&
less
confident
about
the
path
‒ Lower
probability
=>
More
noise
36.
36
|
OPENCL
BDPT
|
AUGUST
28,
2015
|
HARADA,
IKEDA,
FUJITA
LIGHT
TRACING
y If
traced
from
the
light,
it
is
beeer
(more
confident)
y Path
Tracing
y Light
Tracing
Camera
Light
Object
Camera
Light
Object
Path
Tracing
BDPT
37.
37
|
OPENCL
BDPT
|
AUGUST
28,
2015
|
HARADA,
IKEDA,
FUJITA
PATH
TRACING
+
1
LIGHT
PATH
y Can
we
mix
path
tracing
&
light
tracing
‒ Trace
1
light
path
‒ Connect
to
camera
path
Camera
Light
Object
38.
38
|
OPENCL
BDPT
|
AUGUST
28,
2015
|
HARADA,
IKEDA,
FUJITA
PATH
TRACING
+
1
LIGHT
PATH
y Can
we
mix
path
tracing
&
light
tracing
‒ Trace
1
light
path
‒ Connect
to
camera
path
y Improves
some
situaJons
(not
all)
‒ Example.
A
room
is
lit
by
bounced
light
y Can
we
trace
more
than
1
light
path,
and
combine?
‒ =>
BidirecJonal
Path
Tracing
Camera
Light
Object
Path
Tracing
Path
Trace
+
1
light
path
64
spp
40.
Bi-Directional Path Tracing (BDPT)
Camera path
Light path
Connection
Camera
Light
Object
• BDPT traces paths from the camera and the light source
• BDPT combines various path sampling strategies
41.
Bi-Directional Path Tracing (BDPT)
Camera path
Light path
Connection
Camera
Light
Object
• BDPT traces paths from the camera and the light source
• BDPT combines various path sampling strategies
42.
Bi-Directional Path Tracing (BDPT)
Camera path
Light path
Connection
Camera
Light
Object
• BDPT traces paths from the camera and the light source
• BDPT combines various path sampling strategies
43.
Bi-Directional Path Tracing (BDPT)
Camera path
Light path
Connection
Camera
Light
Object
• BDPT traces paths from the camera and the light source
• BDPT combines various path sampling strategies
44.
BDPT
I = w0
w1
+
+
…
wk
·
·
·
x0 xk
• The contributions of the sampling strategies are weighted
46.
x0 xk
xs
xs+1
Xs = x0, · · · xs + xs+1, · · · xk
ps(X) = !p 0 · !p 1 · · · !p s · p s+1 · · · p k 1 · p k
BDPT + Multiple Importance Sampling (MIS) (2
The product of the pdfs of the path sampling
47.
The problem of BDPT on GPU implementation
0 1 2 3Global Memory
0 1 2
• BDPT stores all the vertices on the camera and light paths
• The global memory consumption is high
48.
0 1 2 3Global Memory
0 1 2
• BDPT stores all the vertices on the camera and light paths
• The global memory consumption is high
The problem of BDPT on GPU implementation
49.
0 1 2 3Global Memory
0 1 2
• BDPT stores all the vertices on the camera and light paths
• The global memory consumption is high
The problem of BDPT on GPU implementation
50.
0 1 2 3Global Memory
0 1 2
• BDPT stores all the vertices on the camera and light paths
• The global memory consumption is high
The problem of BDPT on GPU implementation
52.
Instant BDPT
Implicit view ( ) path
Explicit view ( ) path
Implicit light ( ) path
Explicit light ( ) path
VI
VE LE
LI
• Path sampling strategies are limited to 4 (PT and LT)
• Low memory consumption
• If the camera has no collision detection, 3 sampling strategies
71.
Lvc BDPT light vertex cache
0 1 2 3Light Vertex Cache
• Light vertex cache
• Recursive MIS
• LvcBDPT doesn’t have the global memory for the camera path
72.
Recursive MIS
x0
xk
xs
ws(X) =
ps(X)
Pk
i=0 pi(X)
1
ws(X)
=
Pk
i=0 pi(X)
ps(X)
p s+1 · dE
s + 1 + !p s · dL
s+1=
73.
1
ws(X)
= p s+1 · dE
s + 1 + !p s · dL
s+1
dE
1 =
1
!p 0
dE
s =
1 + p sdE
s 1
!p s 1
dL
k =
1
p k+1
Recursive MIS
x0
xk
xs
dL
s+1 =
1 + !p s+1 · dL
s+2
p s+2
74.
1
ws(X)
= p s+1 · dE
s + 1 + !p s · dL
s+1
Lvc BDPT + Recursive MIS
x0 xk
xs
dE
1 =
1
!p 0
75.
1
ws(X)
= p s+1 · dE
s + 1 + !p s · dL
s+1
x0 xk
xs
dE
s =
1 + p sdE
s 1
!p s 1
Lvc BDPT + Recursive MIS
76.
1
ws(X)
= p s+1 · dE
s + 1 + !p s · dL
s+1
x0 xk
xs
dE
s =
1 + p sdE
s 1
!p s 1
dL
k =
1
p k+1
Lvc BDPT + Recursive MIS
77.
1
ws(X)
= p s+1 · dE
s + 1 + !p s · dL
s+1
x0 xk
xs
dE
s =
1 + p sdE
s 1
!p s 1
dL
k 1 =
1 + !p k 1 · dL
k
p k
Lvc BDPT + Recursive MIS
78.
1
ws(X)
= p s+1 · dE
s + 1 + !p s · dL
s+1
x0 xk
xs
dE
s =
1 + p sdE
s 1
!p s 1
dL
s+1 =
1 + !p s+1 · dL
s+2
p s+2
Lvc BDPT + Recursive MIS
84.
84
|
OPENCL
BDPT
|
AUGUST
28,
2015
|
HARADA,
IKEDA,
FUJITA
Back
End
World
GPU
(OCL)
-‐ Path
Tracing
-‐ Light
Tracing
-‐
-‐
World
CPU
-‐ Path
Tracing
(OpJmized)
Front
End
ENGINE
ARCHITECTURE
OVERVIEW
Data
Loader
-‐ Obj
-‐ Eson
-‐ Fbx
Data
Manager
-‐ Texture
-‐ Material
-‐ Mesh
Tahoe
API
Texture
Loader
-‐ Png
-‐ Hdr
-‐ OpenExr
-‐ …
Factory
(CPU)
Camera
-‐ PerspecJve
-‐ Parallel
-‐ Bake
-‐ VR
Material
System
-‐ Default
-‐ Graph
-‐ OSL
Light
Sampler
-‐ Uniform
-‐ Group
-‐ StochasJc
Factory
(OCL)
85.
85
|
OPENCL
BDPT
|
AUGUST
28,
2015
|
HARADA,
IKEDA,
FUJITA
Back
End
World
GPU
(OCL)
-‐ Path
Tracing
-‐ Light
Tracing
-‐ BidirecJonal
Path
Tracing
(LvcBDPT)
-‐ BidirecJonal
Path
Tracing
(InstantBDPT)
World
CPU
-‐ Path
Tracing
(OpJmized)
Front
End
ENGINE
ARCHITECTURE
OVERVIEW
Data
Loader
-‐ Obj
-‐ Eson
-‐ Fbx
Data
Manager
-‐ Texture
-‐ Material
-‐ Mesh
Tahoe
API
Texture
Loader
-‐ Png
-‐ Hdr
-‐ OpenExr
-‐ …
Factory
(CPU)
Camera
-‐ PerspecJve
-‐ Parallel
-‐ Bake
-‐ VR
Material
System
-‐ Default
-‐ Graph
-‐ OSL
Light
Sampler
-‐ Uniform
-‐ Group
-‐ StochasJc
Factory
(OCL)
86.
86
|
OPENCL
BDPT
|
AUGUST
28,
2015
|
HARADA,
IKEDA,
FUJITA
PATH
TRACING
CODE
y Not
employing
a
mega
kernel
implementaJon
y There
are
many
small
kernels
for
path
tracing
‒ Easier
to
debug
‒ Performance
‒ Extendibility
=>
Key
to
add
BDPT
y (See
my
slides
@
CEDEC
2014)
87.
87
|
OPENCL
BDPT
|
AUGUST
28,
2015
|
HARADA,
IKEDA,
FUJITA
PATH
TRACING
KERNELS
y Prepare
‒ Camera
ray
set
up
y Loop
‒ Ray
cast
‒ Implicit
hit
accumulaJon
‒ Material
prepare
‒ Shadow
ray
set
up
‒ Material
evaluaJon
‒ Ray
cast
‒ Explicit
hit
accumulaJon
‒ Sample
next
ray
Path
Tracing
Each
line
is
one
or
more
OCL
kernels
88.
88
|
OPENCL
BDPT
|
AUGUST
28,
2015
|
HARADA,
IKEDA,
FUJITA
INSTANT
BDPT
y Prepare
‒ Set
up
camera
ray
‒ Sample
light
point
y Loop
‒ Ray
cast
‒ Material
prepare
(sampleBrdf)
‒ Implicit
connecJon
‒ Explicit
connecJon
to
light
‒ Make
shadow
ray
‒ Ray
cast
‒ Connect
to
light
‒ Sample
next
ray
‒ Update
MIS
weight
term
Trace
Light
Path
Trace
Camera
Path
Orange:
New
kernels
wrieen
for
BDPT
White
:
Using
path
tracing
kernels
89.
89
|
OPENCL
BDPT
|
AUGUST
28,
2015
|
HARADA,
IKEDA,
FUJITA
INSTANT
BDPT
y Prepare
‒ Set
up
light
ray
‒ Sample
lens
point
‒ Explicit
connecJon
light
to
camera
y Loop
‒ Ray
cast
‒ Material
prepare
(sampleBrdf)
‒ Explicit
connecJon
to
camera
‒ Make
shadow
ray
‒ Ray
cast
‒ Set
pixel
index
‒ Connect
to
camera
‒ Sample
next
ray
‒ Update
MIS
weight
term
y Prepare
‒ Set
up
camera
ray
‒ Sample
light
point
y Loop
‒ Ray
cast
‒ Material
prepare
(sampleBrdf)
‒ Implicit
connecJon
‒ Explicit
connecJon
to
light
‒ Make
shadow
ray
‒ Ray
cast
‒ Connect
to
light
‒ Sample
next
ray
‒ Update
MIS
weight
term
Trace
Light
Path
Trace
Camera
Path
Orange:
New
kernels
wrieen
for
BDPT
White
:
Using
path
tracing
kernels
90.
90
|
OPENCL
BDPT
|
AUGUST
28,
2015
|
HARADA,
IKEDA,
FUJITA
LVCBDPT
y More
complicated
than
Instant
BDPT
y ImplementaJon
is
not
that
far
from
Instant
BDPT