ICVGIP-ppt - IIIT Hyderabad

Download Report

Transcript ICVGIP-ppt - IIIT Hyderabad

Hybrid Ray Tracing and
Path Tracing of Bezier Surfaces
using a mixed hierarchy
Rohit Nigam, P. J. Narayanan
IIIT Hyderabad
CVIT, IIIT Hyderabad, Hyderabad, India
Representing a Scene
f>0
f<0
f=0
Triangular Mesh
Implicit Surface
IIIT Hyderabad
Parametric Surface
Parametric Surface: Motivation
IIIT Hyderabad
 Provide compact and effective representation.
 Remain curved and smooth at arbitrary level of
zooming.
 Memory efficient, in comparison with triangular mesh.
Bezier Surfaces
IIIT Hyderabad
• Bezier Surfaces are the most basic form of parametric
surfaces
• A Bezier Surface can be described as:
Q(u,v) = [U][M][P][M]T[V]T
where [U] = [u3 u2 u 1] and [V] = [v3 v2 v 1], 0 ≤ u,v ≤ 1
[M] is the Bezier Basis Matrix
[P] is the set of 16 Control Points defining the patch
Rendering Bezier Surfaces
• Tessellation based approches
– Eisenacher et al.(2009) :
View Dependent Adaptive Subdivision
IIIT Hyderabad
• Direct Ray Tracing
– Geimer et al.(2005) :
Newton Iteration
– Pabst et al.(2006) :
Bezier Clipping + Newton Iteration
Ray Tracing Bezier Surface
• Constructing an Accelaration Structure
IIIT Hyderabad
 Bounding Volume Hierarchy(BVH)
Ray Tracing Bezier Surface
• Ray Traversal through BVH
0 1 2 3 4 5 6 7 8 9
Ray List
IIIT Hyderabad
Outputs
Potential Ray-Patch intersections list
Initial parameter values
Ray Tracing Bezier Surface
IIIT Hyderabad
• Newton Iteration
Picture Courtesy : http://steadyserverpages.com
Geimer, Abert Approach
Original Curve
• Based on the flatness criteria, each
patch is divided into subpatches.
• BVH for original surfaces
– Bounding boxes of subpatches at leaf
nodes.
Subdivided Linear
Curve
• For each potential intersection
– Generate initial values for Newton Iteration
1
3
2
IIIT Hyderabad
Patch1
sp1 sp2
BVH Nodes
P2
sp1
sp2
P3
sp1 sp2
Subpatches at Leaf
Limitation of the Model for GPUs
• GPU Access time:
– High for global memory
– Comparatively less for shared memory and registers
When subdividing based on flatness criteria, we need to
– Store subpatches starting index
– Store total number of subpatches
– Store initial [u,v] pair for each potential intersection.
IIIT Hyderabad
Thus more global memory operations result in lower
throughput.
• Need to check every subpatch at leaf node
Our Approach
• Create a mixed hierarchy,
consisting of two hierarchical
structures.
IIIT Hyderabad
– The top level BVH tree is
constructed from the bounding
boxes of original patches.
– Leaf nodes represent the original
Bezier Surfaces.
– Each Patch is divided into fixed
size subpatches, hierarchically,
using De Casteljau algorithm.
– Make subtree for each patch from
bounding boxes of the subdivided
patches.
BVH for
Patches
BVH Nodes
Patches
Subtree Nodes
Subpatch
Hierarchy
IIIT Hyderabad
Sub-patches
1
2
3
4
Mixed Hierarchy Structure
• Newton Iteration applied to original patches
– No memory required to store subpatches
IIIT Hyderabad
• Fixed depth subtree
–
–
–
–
–
Utilize constant degree of bezier surfaces
Utilize shared memory
Apply early termination at subtree level
Leads to tighter bounds
A subdivision depth of 6 was found empirically sufficient.
Mixed Hierarchy Structure
• Newton Iteration applied on original patches.
– No memory required to store subpatches.
IIIT Hyderabad
• Fixed depth makes it possible utilize shared memory.
• A subtree at lower level leads to early termination at this
stage, reducing the (Ray, Bounding Box) intersections.
• Subdivision also leads to tighter bounds, which further
reduces the potential (Ray,Patch) intersections.
• A subdivision depth of 6 was found empirically sufficient
for our scenes.
GPU Traversal of
Mixed Hierarchy Structure
• A ‘traverse’ kernel traverses the first level of the BVH.
– Lists out Potential (Ray,Patch) intersections.
– We make use of atomic operations, to provide scalability.
IIIT Hyderabad
• ‘Recheck’ kernel parallely processes the generated
(ray,patch) list.
– This leads to further pruning of the list with tighter subpatch
bounding boxes.
– We make use of ‘t’ values computed here, to not traverse
subpatch nodes with higher values.
– This leads to reduced computation and in cases of false
positive, a little less accurate initial values.
– Lists out the reduced potential (Ray,Patch) intersections.
– Generates the initial values for each intersection.
IIIT Hyderabad
Secondary Rays
Hybrid Ray Tracing
GPU
Start
CPU
Preprocessing
Ray List
rayTraceGPU
rayTraceCPU
Point and Normal
IIIT Hyderabad
Generate Secondary Rays
Hybrid Ray Tracing
IIIT Hyderabad
Divide the Ray list between CPU and GPU
GPU algorithm comprises
of three kernels:
Traverse : Generate
Potential Ray-Patch
Intersections
Recheck : Further prune
intersections and get initial
values
Newton : Apply Newton
iteration to get hit-point
CPU stage comprises of:
1. Divide CPU Raylist into
2c threads, where c is
number of cores.
2. Intersect with main BVH
3. If intersects, intersect
with 2nd level subtree.
4. Apply Newton iteration
to get hit-point
Results
IIIT Hyderabad
Teapot Model
Fps : 64
2 Killeroos
Fps : 10.6
Bigguy Model
Fps : 28.6
Killeroo Model
Fps : 19.2
9 Bigguys
Fps : 5.2
System Specs
GTX 580 + i7 920
1024x1024
Path Tracing
IIIT Hyderabad
• We extend our ray tracing approach to Global
Illumination effects.
• We use Cook’s approach of Monte Carlo based
Stochastic Sampling, to sample the image at
appropriate non-uniformly spaced points.
• Each pixel is sampled for a user defined samples per
pixel
• We apply our data parallel approach to this massive ray
list to generate the desired effects.
IIIT Hyderabad
Path Tracing
Bigguy in a box: 400 spp, 512x512 resolution
Rendered in 28.5 minutes
IIIT Hyderabad
Path Tracing
Bigguy in a box: 1000 spp, 512x512 resolution
Rendered in 28.5 minutes
IIIT Hyderabad
Path Tracing
Bigguy in a box: 3000 spp, 512x512 resolution
Rendered in 28.5 minutes
IIIT Hyderabad
Path Tracing
Bigguy in a box: 5000 spp, 512x512 resolution
Rendered in 28.5 minutes
IIIT Hyderabad
Path Tracing
Bigguy in a box: 10000 spp, 512x512 resolution
Rendered in 28.5 minutes
Conclusion
IIIT Hyderabad
• A mixed hierarchy model is proposed to speed up Ray
Tracing process.
• GPU benefits greatly from fixed depth subtree.
• A hybrid model is proposed, to fully utilize compute
power of CPU and GPU.
• We demonstrate the capability of our method by
producing Global Illumination effects for Bezier patches.
IIIT Hyderabad
THANK YOU
IIIT Hyderabad
Hybrid Ray Tracing
• Divide the Ray list between CPU and GPU
 Ratio decided based on compute capabilities
• GPU algorithm comprises of three kernels:
 Traverse : Generate Potential Ray-Patch Intersections
 Recheck : Further prune intersections and get initial values
 Newton : Apply Newton iteration to get hit-point
• CPU stage comprises of:
IIIT Hyderabad
1.
2.
3.
4.
Divide CPU Raylist into 2c threads, where c is number of cores.
Intersection with main BVH
If intersects, further intersection with 2nd level subtree.
Finally, apply Newton iteration and generate hit-point
• CPU benefits from early ray termination.
IIIT Hyderabad
Hybrid Ray Tracing
Newton Iteration
• We represent a ray as intersection of two planes, (n1,d1)
and (n2,d2)
The ray patch intersection equation becomes
Q(u,v) represents the point on the patch.
IIIT Hyderabad
• We use Newton Iteration to solve for (u,v)
Here J is the inverse Jacobian matrix of R.
Results (Primary Rays, 1024x1024)
IIIT Hyderabad
Model
Patches
Ray-Patch
Intersections
Total Frame Time(ms)
CPU
GPU
Hybrid
Teapot
32
126589
74
8.71
8.01
Bigguy
3570
142779
110
14.59
13.18
Killeroo
11532
147116
193
22.38
20.43
2 Killeroos
23064
317494
356
42.29
38.58
9 Bigguys
32130
570136
2092
77.05
75.9
Results (Primary +Secondary)
IIIT Hyderabad
Model
Patches
Total Frame Time(ms)
CPU
GPU
Hybrid
Teapot
32
137
17.05
15.61
Bigguy
3570
232
39.45
34.92
Killeroo
11532
351
58.3
52.19
2 Killeroos
23064
726
106.03
94.55
9 Bigguys
32130
3107
196.79
191.81