12.07.2015 Views

Ray Tracing Bezier Surface - IIIT Hyderabad

Ray Tracing Bezier Surface - IIIT Hyderabad

Ray Tracing Bezier Surface - IIIT Hyderabad

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>IIIT</strong> <strong>Hyderabad</strong>Hybrid <strong>Ray</strong> <strong>Tracing</strong> andPath <strong>Tracing</strong> of <strong>Bezier</strong> <strong>Surface</strong>susing a mixed hierarchyRohit Nigam, P. J. NarayananCVIT, <strong>IIIT</strong> <strong>Hyderabad</strong>, <strong>Hyderabad</strong>, India


<strong>IIIT</strong> <strong>Hyderabad</strong>Representing a Scenef>0f


<strong>IIIT</strong> <strong>Hyderabad</strong>Parametric <strong>Surface</strong>: Motivation‣ Provide compact and effective representation.‣ Remain curved and smooth at arbitrary level ofzooming.‣ Memory efficient, in comparison with triangular mesh.


<strong>IIIT</strong> <strong>Hyderabad</strong><strong>Bezier</strong> <strong>Surface</strong>s• Most basic form of parametric surfaces• Described as:Q(u,v) = [U][M][P][M] T [V] Twhere [U] = [u 3 u 2 u 1] and [V] = [v 3 v 2 v 1], 0 ≤ u,v ≤ 1[M] : <strong>Bezier</strong> Basis Matrix[P] : set of 16 Control Points defining the patch


<strong>IIIT</strong> <strong>Hyderabad</strong>Rendering <strong>Bezier</strong> <strong>Surface</strong>s• Tessellation based approches– Eisenacher et al.(2009) :View Dependent Adaptive Subdivision• Direct <strong>Ray</strong> <strong>Tracing</strong>– Geimer et al.(2005) :Newton Iteration– Pabst et al.(2006) :<strong>Bezier</strong> Clipping + Newton Iteration


<strong>IIIT</strong> <strong>Hyderabad</strong><strong>Ray</strong> <strong>Tracing</strong> <strong>Bezier</strong> <strong>Surface</strong>• Constructing an Accelaration Structure‣ Grid‣ KD-Tree‣ Bounding Volume Hierarchy(BVH)


<strong>IIIT</strong> <strong>Hyderabad</strong><strong>Ray</strong> <strong>Tracing</strong> <strong>Bezier</strong> <strong>Surface</strong>• <strong>Ray</strong> Traversal through BVH0 1 2 3 4 5 6 7 8 9<strong>Ray</strong> ListOutputsPotential <strong>Ray</strong>-Patch intersections listInitial parameter values


<strong>IIIT</strong> <strong>Hyderabad</strong><strong>Ray</strong> <strong>Tracing</strong> <strong>Bezier</strong> <strong>Surface</strong>• Newton Iteration• Bivariate Newton Iterationto solve for (u,v)Picture Courtesy :http://steadyserverpages.comR is the intersection equation for a ray,J is the Jacobian matrix of R.


<strong>IIIT</strong> <strong>Hyderabad</strong>Geimer 2005• Based on the flatness criteria, each patchis divided into subpatches.• BVH for original surfaces– Bounding boxes of subpatches at leaf nodes.• For each potential intersection– Generate initial values for Newton Iteration• Achieve 6.4 fps for 512x512 image.Original CurveSubdivided LinearCurve1BVH Nodes2 3Patch1 P2 P3sp1 sp2 sp1 sp2 sp1 sp2 Subpatches at Leaf


<strong>IIIT</strong> <strong>Hyderabad</strong>Our Approach• Mixed hierarchy: consists oftwo hierarchical structures.– Top level BVH: Boundingboxes of original patches.– Leaf nodes represent theoriginal <strong>Bezier</strong> <strong>Surface</strong>s.– Each Patch is divided intofixed size subpatches,hierarchically, using DeCasteljau algorithm.– Subtree for each patch frombounding boxes of thesubdivided patches.1 2 3 4BVH forPatchesSubpatchHierarchy


<strong>IIIT</strong> <strong>Hyderabad</strong>Mixed Hierarchy Advantages• Tighter bounds of subpatch– Eliminates more rays– Better Initialization• Low Additional memory– Intersection performed onoriginal patches.• Better suited for the GPU– Shared memory stores skippointer and subpatch number.We subdivide 6 times.1 2 3 4BVH forPatchesSubpatchHierarchy


<strong>IIIT</strong> <strong>Hyderabad</strong>GPU Implementation• A kernel traverses the first levelof the BVH.– Atomic operations to providescalability.– Output: Potential (<strong>Ray</strong>,Patch)intersections• Another kernel parallely processesthe generated (ray,patch) list.– Tighter subpatch bounding boxesleads to further pruning.– Output:• Reduced potential (<strong>Ray</strong>,Patch)intersections.• Initial values for each intersection.0 1 2 3 4 5 6 7<strong>Ray</strong> List0,1 2,2 3,6 4,3 5,7 6,1 7,3Potential <strong>Ray</strong>-PatchIntersections0,1 2,2 4,3 5,7 7,314 8 7 34 63Initial values


<strong>IIIT</strong> <strong>Hyderabad</strong>GPU Implementation• Newton Iteration– Each <strong>Ray</strong>-Patch intersection mappedto a thread– Applied till convergence or maxiteration– Output: Hit-point and surface normal– Takes 20-30% of the total time0,1 2,2 4,3 5,7 7,3Potential Intersections14 8 7 34 63Initial valuesH1 H2 NH H3 H4Hit PointsN1 N2 NH N3 N4<strong>Surface</strong> Normals


<strong>IIIT</strong> <strong>Hyderabad</strong>Secondary <strong>Ray</strong>s• Generate direction from hit-pointand surface normal.• Generate <strong>Ray</strong> List.• Apply the same algorithm forsecondary <strong>Ray</strong> List.• Recurse for a fixed depth forreflection/refractions.H1 H2 NH H3 H4N1 N2 NH N3 N40 1 2 3Secondary <strong>Ray</strong>sIntersectionAlgorithmC1 C2 C3 C4Final Color values


<strong>IIIT</strong> <strong>Hyderabad</strong>Hybrid <strong>Ray</strong> <strong>Tracing</strong>Generate <strong>Ray</strong>s<strong>Ray</strong> ListGPUCPU0 1 2 3 4 5 6 70 1 2 3 4 5 6 7rayTraceGPUrayTraceCPUHit Point<strong>Surface</strong> NormalH1 H2 NH H3N1 N2 NH N3H4N4Secondary <strong>Ray</strong> List0 1 2 3


<strong>IIIT</strong> <strong>Hyderabad</strong>ResultsTeapot ModelFps : 64(115)*Bigguy ModelFps : 28.6(68.5)Killeroo ModelFps : 19.2(44.7)System SpecsGTX 580 + i7 9201024x1024Primary + Shadow+ Reflection2 KilleroosFps : 10.6(23)9 BigguysFps : 5.2(13)* : Figure in bracket gives Primary fps


<strong>IIIT</strong> <strong>Hyderabad</strong>Results (Primary+Secondary)Model Patches Total Frame Time(ms)CPU GPU HybridTeapot 32 137 17.05 15.61Bigguy 3570 232 39.45 34.92Killeroo 11532 351 58.3 52.192 Killeroos 23064 726 106.03 94.559 Bigguys 32130 3107 196.79 191.81


<strong>IIIT</strong> <strong>Hyderabad</strong>Path <strong>Tracing</strong>Bigguy in a box: 400 spp, 512x512 resolutionRendered in 75 secs


<strong>IIIT</strong> <strong>Hyderabad</strong>Path <strong>Tracing</strong>Bigguy in a box: 1000 spp, 512x512 resolutionRendered in 165 secs


<strong>IIIT</strong> <strong>Hyderabad</strong>Path <strong>Tracing</strong>Bigguy in a box: 2000 spp, 512x512 resolutionRendered in 323 secs


<strong>IIIT</strong> <strong>Hyderabad</strong>Path <strong>Tracing</strong>Bigguy in a box: 5000 spp, 512x512 resolutionRendered in 14.4 mins


<strong>IIIT</strong> <strong>Hyderabad</strong>Path <strong>Tracing</strong>Bigguy in a box: 10000 spp, 512x512 resolutionRendered in 28.5 mins


<strong>IIIT</strong> <strong>Hyderabad</strong>Conclusions• A mixed hierarchy model is proposed to speed up <strong>Ray</strong><strong>Tracing</strong> process.• GPU benefits greatly from fixed depth subtree.• A hybrid model is proposed, to fully utilize computepower of CPU and GPU.• We demonstrate the capability of our method byproducing Global Illumination effects for <strong>Bezier</strong> patches.


<strong>IIIT</strong> <strong>Hyderabad</strong>THANK YOU


<strong>IIIT</strong> <strong>Hyderabad</strong>ResultsIntel i7 920 + Nvidia GT X580; 1024x1024

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!