12.07.2015 Views

Ray Tracing Parametric Patches1.pdf

Ray Tracing Parametric Patches1.pdf

Ray Tracing Parametric Patches1.pdf

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>Ray</strong> <strong>Tracing</strong> <strong>Parametric</strong> Patches


Surface Representations :• Polygonal Meshes• Implicit Surfaces• Subdivision Surfaces• <strong>Parametric</strong> Surfaces


Implicit SurfacesSurface defined by implicit function:* f (x, y, z) = 0 (on surface)* f (x, y, z) < 0 (Inside)* f (x, y, z) > 0 (Outside)


Subdivision SurfacesUndergoes a sequence of refinements(adding more vertices)until the smoothness is obtained.


<strong>Parametric</strong> Surfaces• Boundary defined by the parametric function:x = f(u,v)y = f(u,v)z = f(u,v)•Example (sphere):x = cos(u)cos(v)y = sin(u)cos(v)z = sin(v)


Curved Surfaces• Motivationo Exact boundary representation for some objectso More concise representation than polygonal mesho Surface remains curved even on zooming.


Types of Curves :• Bezier Curves• Rational Curves• Spline• B – Spline• NURBSEach point on a Bézier curve (and on many other kinds of curves)is computed as a weighted sum of all control points.Each control point in rational curve is assigned a weight. The weightdefines how much does a point "attract" the curve.Sufficiently smooth piecewise-polynomial functionA B-Spline consists of multiple Bézier arcs and provides an unifiedmechanism how to define continuity in the joins.C 2 continuousNon Uniform Rational B-Spline


<strong>Parametric</strong> Patches• Each patch is defined by blending control points


<strong>Parametric</strong> PatchesPoint Q(u,v) on the patch is the tensor product of parametric curves definedby the control points


Bezier Bicubic PatchesA Bézier bi-cubic patch of degree 3 is defined bywhere 0 ≤ u , v ≤ 1 are the patch parameters. The control matrix P andBézier basis matrix M are respectively given byThe normal, n, is computed as the cross product of the parametric tangents:


<strong>Ray</strong> <strong>Tracing</strong> <strong>Parametric</strong> PatchesThe Key idea in <strong>Ray</strong> <strong>Tracing</strong> parametric patches is:• Construct an acceleration structure.• Finding out potential intersecting patches ( <strong>Ray</strong> Bounding-Box test)• Finding out the actual intersections.• Find the parameters(u,v) at the point of intersection.• Find out x,y,z coordinates and normal (if possible ) from the u,v parameters.• Shadow and Secondary rays.


Acceleration Structure• Reducing the number of intersection tests performed is of even moreimportance in ray tracing parametric patches as compared to trianglesbecause testing a parametric patch is a lot more expensive than the testagainst a triangle.• Even though kd-trees are considered faster than BVH, still its better to usethe latter due to the fact that an iterative traversal of axis aligned boundingboxes in depth-first order is well suited for the usage of SIMD instructionsand the hierarchy can additionally provide good initial estimates (for NewtonIteration).


<strong>Ray</strong> <strong>Tracing</strong> <strong>Parametric</strong> PatchesFollowing are the methods for <strong>Ray</strong> <strong>Tracing</strong> of <strong>Parametric</strong> Patches:• Multi-variate Newton Iteration (Toth)• Eigen Value Formation of the problem (Manocha)• Recursive sub-division (Catmull)• Adaptive subdivision with polygon rasterization• Finding Exact hit point of a ray with a patch using algebraicmethods(Kajiya)


Newton IterationMethod for finding successively better approximations to the roots (orzeroes) of a real-valued function.The method will usually converge, provided this initial guess is close enoughto the unknown zero, and that ƒ'(x 0 ) ≠ 0.The rate of convergence of Newton‟s method is quadratic (for roots with 1multiplicity).


Newton IterationPractical Considerations:• Difficulty in calculating derivative of a function• Failure of the method to converge to the root• OvershootNewton‟s method does not guarantee 100% convergence.For not well behaved derivative in the neighborhood of the root,method can overshoot and diverge from the desired root.• Poor initial estimateInitial estimates not close to the root can lead to non-convergence.•Slow convergence for roots of multiplicity > 1For roots with multiplicity > 1, the rate of convergence is merelylinear.


Newton IterationPapers :• On <strong>Ray</strong> <strong>Tracing</strong> <strong>Parametric</strong> Patches, D.L. Toth, SIGGRAPH 1985• Interactive <strong>Ray</strong> <strong>Tracing</strong> of trimmed bicubic bezier surfaces withouttriangulation, Geimer, Abert, WSCG 2005• Direct and fast ray tracing of NURBS surfaces, Abert, Geimer, 2006• Real-Time <strong>Ray</strong>-<strong>Tracing</strong> of Implicit Surfaces on the GPU, Jagmohan, 2010.


Kajiya‟s Method• Exact ray tracing of bicubic surfaces was proposed by Kajiya [1982].• Method represents a ray using two planes, which are intersected with thepatches.• The method involves formation of a resultant 18-degree polynomial, whosereal roots give the values of v-parameter.• The u-parameter is found by substituting the v-value in the pair of bicubiccurve equations and finding the gcd of the equations.• u, v € R and 0 ≤ u,v ≤ 1; imaginary values are discarded.


Kajiya‟s MethodA bezier bi-cubic patch of degree 3 is given by:- (1)A ray is represented as intersection of two orthogonal planes (l 0 ,l 1 )Intersecting a ray with a patch gives us two equations:a ij u 3-i v 3-j = 0 - (2)b ij u 3-i v 3-j = 0 - (3)where i, j € {0,1,2, 3}. a ij = l 0 kP k ij and b ij = l 1 kP k ij, where k € {0,1,2,3} and l 0 k andl 1 k are the horizontal and vertical planes representing the ray.The intersection points of above Equations gives the (u, v) parameter valuesat which the ray intersects the patch.


Kajiya‟s MethodEquations 2 and 3 can be written as polynomials in u:a(u, v) = A 0 u 3 +A 1 u 2 +A 2 u+A 3 = 0b(u, v) = B 0 u 3 +B 1 u 2 +B 2 u+B 3 = 0where Ai and Bi are cubic polynomials in v. We want to find the commonroots of a(u, v) and b(u, v), which exists if the Bezout determinant vanishes.That is, if- (4)


Kajiya‟s Method‣The above equation is an 18-degree Polynomial in v.‣For each root v i of this polynomial, the „u‟ value can be obtained using thegcd of a(u, v i ) and b(u, v i ).‣A real (u i , v i ) pair in the interval [0, 1] gives the ray-patch intersection.‣The closest point and the normal can be found for each ray.‣Secondary rays can be generated and traced in a similar way, before shadingthe point.


Kajiya‟s MethodRoot Finding and deflation Step:


Kajiya‟s Method• The Evaluation of the polynomials is done using the Horner‟s scheme.• To find the roots of the 18-degree Polynomial, we can use any of thefollowing methods: Newtons Method – Quadratic Convergence. Problems with convergence. Eigen Value Method – Converts the polynomial into companion matrix andcomputes the eigen values of the companion matrix, which are the roots ofthe polynomial. Laguerre or Halley‟s method – Cubic Convergence. Laguerre method wassuggested by Kajiya in his SIGGRAPH paper. Uses second order derivativesand complex arithmetic for root finding. Convergence is almost guaranteed. Durand-Kerner or Aberths method to simultaneously find all the roots ofthe polynomial.


Kajiya‟s MethodThe Algorithm converges for a maxIter value of 10.The initial guess is taken as x 0 = (1 + j)/√2.


Advantages• Direct ray tracing of parametric patches leads to:◦ Exact point of intersection◦ High visual quality images◦ Less artifacts◦ Fast preprocessing◦ Less memory requirement◦ Better rendering


Considerationso Even though empirically proven that Laguerre‟s method is a “sure-fire”method, the algorithm may sometime not converge within the bounds ofmaxIter leading to artifacts.o The root finding process is the most time consuming part of the processand hence the overall process is slower than other methods like theSubdivision and polygon rendering method.

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

Saved successfully!

Ooh no, something went wrong!