The present disclosure relates to computer graphics, and more specifically, to rendering curves.
Rendering of two-dimensional curves and three-dimensional surfaces can be performed with an iterative process known as subdivision. Subdivision starts with an initial control polygon, and in each iteration, replaces each vertex with two vertices. Many types of subdivision schemes are possible.
Many aspects of the disclosure can be better understood with reference to the following drawings. The components in the drawings are not necessarily to scale, emphasis instead being placed upon clearly illustrating the principles of the present disclosure.
One type of subdivision is known as split and tweak. Starting with an initial polygonal control loop, a Split operation inserts a new mid-edge vertex in the middle of each edge and then a Tweak operation adjusts the position of the old and/or new vertices. In this disclosure, we refer to the initial polygonal control loop as 0P, the loop obtained after k subdivision steps (Split and Tweak pairs) as kP, the jth vertex of kP as kPj. The subdivision scheme disclosed herein computes each new vertex of k+1P as a linear combination of a set of vertices of kP. Specifically, the new position of the old vertices is k+1P2j=αkPj−1+βkPj+XkPj+1, and the position the mid-edge vertices created by the split is k+1P2j+1=δkPj−1+εkPj+φkPj+1+γkPj+2 for the position of the mid-edge vertices created by the split. All operations on vertex indices are performed modulo the number of vertices in the loop.
To achieve a symmetric scheme for which the result is independent of the orientation of the control loop, α=X, δ=γ, and ε=φ. To make the subdivision scheme translation-invariant, the relationship between the coefficients is α+β+X=1 and δ+ε+φ+γ=1. Hence, all seven coefficients may be defined in terms of two parameters, a and b. In one example embodiment disclosed herein, the relationship between the two parameters and the seven coefficients is α=X=a/8, β=(8−2a)/8, δ=γ=(b−1)/16, and ε=φ=(9−b)/16. The corresponding subdivision, k+1P2j=(akPj−1+(8−2a)kPj+akPj+1)/8 and k+1P2j+1=((b−1)kPj−1+(9−b)kPj+(9−b)kPj+1+(b−1)kPj+2)/16, is denoted Ja,b. For simplicity, Js,s is referred to herein as Js.
This particular parameterization has the property that J0 is the four-point subdivision and J1 is the uniform cubic b-spline subdivision (see
The above discussion showed how curve subdivision schemes can be parameterized. Using the techniques disclosed herein, these parameters can be optimized to achieve geometric properties such as vertex or mid-edge point interpolation or area preservation. In some embodiments, the optimal parameters are chosen independent of any data given, which reduces or eliminates the optimization cost and ensures stability and local control.
The Js subdivision scheme, as disclosed herein, generalizes the Jarek construction to the whole family of subdivision schemes. Consider two loops, P={P0, P1, . . . Pk} and Q={Q0, Q1, . . . Qk}. Let Ls(P,Q) produce a new loop R={R0, R1, . . . Rk}, where Ri=(1−s)Pi+sQi. Note that although Js(0P)=Ls(J0(0P), J1(0P)), in general, kJs(0P)≠Ls(kJ0(0P), kJ1(0P)). Hence, the curves produced by iterations of Js refinements are not linear combinations of the curves produced by iterations of four-point and cubic B-spline schemes. This observation explains why the limit curves produced by iterative Js refinements exhibit superior smoothness properties. As the number k of refinements grows, the loop kP converges to a limit curve *Js(0P), which we simply denote as *Js.
This convergence is illustrated in
We show that: for −1.7≦s<0 and 4≦s≦5.8, *Js is C1; for 0<s≦1 and 2.8<s<4, *Js is C2; for 1<s<3/2 and 3/2<s≦2.8, *Js is C3; for s=3/2, *Js is C4ef. To establish the continuity of the Js scheme for different values of s, we first consider the necessary conditions for continuity. Given the subdivision matrix for Js, if the subdivision scheme produces curves that are Cm, then the eigenvalues of its subdivision matrix are of the form 1, (1/2), (1/4), . . . , (1/2)m, λ, . . . where λ<(1/2)m. The eigenvalues of the subdivision matrix for Js subdivision are 1, (1/2), (1/4), (1/8), (2−s)/8, (s−1)/16, (s−1)/16, 0, 0. It is easy to verify that Js subdivision satisfies the necessary conditions for C1 continuity when −2<s<6, for C2 continuity when 0<s<4, for C3 continuity when 1<s<3, and for C4 continuity when s=3/2. Notice that these conditions are only necessary, they are not sufficient.
To determine sufficient conditions on the subdivision scheme, the Laurent polynomial of the subdivision scheme is used, given by S(z)=(s−1)/16+s/8z+(9−s)/16z2+(1−s/4)z3+(9−s)/16z4+s/8z5+(s−1)/16z6, which encodes the columns of the infinite subdivision matrix in a compact form. The subdivision scheme will generate Cm curves if the infinity norm of the kth power of the subdivision matrix for the mth divided differences is less than 1 for some k. The columns of this divided difference subdivision matrix are given by (2m/(1+z)m+1)S(z). A numeric check of what range of s satisfies these bounds for different continuity levels verifies that Js subdivision produces curves that are at least C1 for −1.7<=s<=5.8, at least C2 for 0<s<4, at least C3 for 1<s<=2.8, and at least C4 for s=3/2. In fact, s=3/2 corresponds to uniform quintic b-spline subdivision, which is easily verified by noticing that their Laurant polynomials are identical. Although the numerically verified sufficient bounds are slightly more restrictive than the proven necessary bounds, the true sufficient bounds are strongly suspected to extend to match the necessary bounds for continuity in the limit. However, the numerical verification is exponential in k and difficult to compute for large values of k.
Relation with Uniform B-Splines
Uniform B-spline curves Bd of degree d have a two-part subdivision: first the control points are doubled by inserting mid-edge points; then we replace the vertices by the mid-edge points d−1 times. This subdivision scheme creates curves that are Cd−1. The Js subdivision scheme described herein exactly reproduces the odd degree B-splines B3 and B5 for s=1 and s=3/2, but not even degree B-splines. However, in some embodiments, parameter s is optimized in a data independent manner to match the basis functions created by B2 and B4 subdivision.
In one embodiment this optimization is performed by minimizing the difference between the basis function values on a dense uniform grid. The optimal parameter s depends on what norm is used to measure the distance between the values. One such norm is L2 but this norm has little to do with how humans perceive closeness. The L∞ norm may be the best norm because this norm minimizes the worst-case scenario and provides strict error bounds. The disadvantage of the L∞ norm is that the optimization problem becomes difficult due to the use of non-differentiable functions like Max and Abs. On the other hand, the L1 norm optimizes the average case scenario and will typically perform better in practice than other norms, but this norm does not bound the worst case as the L∞ norm does.
In some of the embodiments described herein, the optimal parameter in these different norms is computed even if the computation requires significant effort, since the optimization is data independent and only needs to be computed once. When optimizing the Js subdivision scheme described herein to match quadratic B-spline subdivision, the L1 and L∞ norms produce very different values s=0.689 and s=0.639 respectively. In some embodiments, the L1 norm is selected as it is expected to perform better in practice. For quartic B-splines, the two norms are very close to one another and the optimal value is computed as s=1.27. Notice that quadratic B-splines are actually C1 curves, whereas a J0.689 subdivision scheme as disclosed herein approximates quadratic B-splines actually produces C2 curves. J8/8 converges to a cubic B-spline curve B3. J1.27 converges to a C3 curve that closely approximates the quartic B-spline curve B4. Finally, J12/8 converges to a C4 quintic B-spline curve.
As the value of s increases towards 1.5, the smoothness of the Js curve described herein increases, but the limit curve drifts farther away from the vertices of the original control loop C. In some embodiments, an optimization is used to obtain a polygon loop 0P for which the limit curve *P exactly interpolates the vertices of C. In general, the limit mask for the Js subdivision is given by the dominant left eigenvector of the subdivision matrix and has the closed-form {(s−1)s, 2s(8−s), 72+2(s−9)s, 2s(8−s), (s−1)s}/(12(6+s)) for arbitrary parameter values s. One variation finds control points whose limit curve exactly interpolates the vertices of the control polygon by solving a global system of equations using a matrix whose rows contain shifts of the limit mask. Another variation uses an iterative retrofitting which can quickly converge to the solution of these equations.
The retrofitting method can be shown to fail to converge for some ranges of s values. We do so by computing the spectral radius (largest absolute eigenvalue) of the infinite matrix (I−L) where I is the identity matrix and L is a matrix whose rows contains shifts of the limit mask. Despite the fact that this matrix is infinite, we can use techniques from block-circulant matrices to write down the infinite set of eigenvalues and bound their norm. If the spectral radius of the matrix (I−L) is greater than or equal to 1, then this iterative method for interpolating the vertices of the control polygon will fail. For the subdivision scheme described herein, this convergence criteria is violated for s≦−0.86 and 2≦s. Therefore, this iterative retrofitting method will not work for these values of s. For −0.86<s<2 this retrofitting technique work well and converged quickly for various test cases during interactive curve manipulation.
The retrofitting technique described above loses the local control property of the Js subdivision technique, such that each control vertex of C may influence the entire curve *Js. Another embodiment retains local control while producing subdivided curves that nearly interpolate the vertices of C, by combining Js steps with different values of s. For example, a single anticipation Jr step, with r=−33/26, followed by a series of J12/8 steps converges to a C4 quintic B-spline curve that nearly interpolates the original vertices. This is shown in
In the embodiments shown in
Instead of interpolating the original control vertices as discussed above, another variation interpolates mid-edge points.
The Js subdivision scheme disclosed herein can be applied to two-dimensional area preservation. For each polygonal control loop, the a, b, and s parameters may be adjusted in a shape-dependent manner through numerical iteration to ensure that the refined curve has the same area as the initial polygonal loop 0P.
Note that these solutions are independent of the particular control polygon, but do not guarantee that area will be preserved exactly. If exact area preservation is required with a model-independent solution, a step of J−0.0053, 1.0276 followed by *J0.4666, produces a C2 curve that has the same area as the original control polygon, but the curve is noticeably flat along the edges of the control polygon.
The Js subdivision scheme disclosed herein can be applied to multi-resolution rendering. The s parameter in Js can be optimized to match linear subdivision, to produce a smooth curve that reduces the difference between consecutive levels of subdivision. A large discrepancy exists between optimal values in different norms: L∞ yields s=0.152773 whereas L1 yields s=0.304763. The L1 norm may perform better for most applications, although the result may depend on the particular control loop.
The Js subdivision scheme disclosed herein can be applied to multi-resolution design. In one embodiment, the subdivisions are used as in Hierarchical B-splines to first define a smooth curve with very few control points. Then small details are added by editing the position of user-selected vertices at intermediate subdivision levels. Finally, subsequent levels of subdivision are performed. An example is shown in
The Js subdivision scheme disclosed herein can be extended to open curves by inserting four additional control points between 0P0 and 0Pn−1 and by omitting 5 spans. The additional control points control the behavior of the limit curve near its ends. In some embodiments, the limit curve interpolates (in position and direction) both ends of the original control polygon: that is, the curve starts at 0P0 with a tangent along 0P1-0P0 and to end at 0Pn−1 with a tangent along 0Pn−2-0Pn−1. Using the limit mask described above in connection with retrofitting, and the tangent mask {1−s,2(s−4),0,−2(s−4),−(1−s)}/12 derived from the left eigenvector of the subdivision matrix corresponding to 1/2, a simple set of equations is solved for these two additional control points to enforce these specified conditions. The solution adds two control points 0P−1=(9−s)/40P0+(s−3)/20P1+(1−s)/40P2 and 0P−2=(12−s)/20P0+(s−8)0P1+(6−s)/20P2 to the curve. The masks for the opposite end of the curve are identical.
A naïve Split & Tweak implementation of the Js subdivision scheme disclosed herein would involve storing all the points of the final curve, or at least on the penultimate curve. Such a large amount of storage may be undesired when displaying surfaces or animations with a large numbers of recursions, or when the refinements are performed on graphics hardware with limited on-chip memory. Discussed next is an technique for generating a final curve without having to store the intermediate levels of subdivision and without having to perform any redundant computation.
This method—referred to herein as “ringing”—uses a ring data structure containing 5 points per subdivision level L. At any given moment during the curve rendering process, ring rk contains 5 consecutive points of kP. In one embodiment, rk is implemented as a first-in-first-out data structure. During curve rendering, the ring data structure rk advances along the polygon kP, one vertex at a time, to include the next vertex with each slide. Each ring stores its point in an array of 5 slots. To avoid shifting points, the index is advanced to the next-to-be-replaced vertex using modulo 5. The advancement of rings is synchronized, so that ring rk+1 advances twice as fast than ring rk. The top ring, r0, obtains its next point as the next point along 0P. Each other ring rk+1, for k≧0, computes its next point from rk, alternating the two Js masks: k+1P2j=(akPj−1+(8−2a)kPj+akPj+1)/8 for each even point and k+1P2j+1=((b−1)kPj−1+(9−b)kPj+(9−b)kPj+1+(b−1) kPj+2)/16 for each odd point. (These masks were introduced earlier in the discussion of
The ringing process begins by initializing the top ring r0 with the first 5 control points of 0P. The points of the other rings, r1, r2, . . . rL, are derived recursively using the two refinement formulae above. Then, the bottom ring rL is advanced one step at a time, sliding at each step its 5 points by one vertex, along the final curve. For every 2 steps of rk the parent ring rk−1 makes one step. Ring r0 is advanced by loading it with the next control point on the curve.
The stages of the ringing process are illustrated in
The examples discussed so far are two-dimensional, but the techniques disclosed herein can be extended to refine curves in higher dimensions and to refine curves with properties. The ringing approach described above generates points on the subdivided curve one by one. One adaptation defines the trajectory of a moving point or the trajectory of the center of a moving object and animates it. Replacing each control point by a different trajectory defines an animated curve that deforms through time where, at each step of the animation, each control point is advanced by one step along its trajectory, and then the subdivision curve these points define is rendered. This animation approach uses one set of motion-rings per moving control point and one set of display-rings for drawing the current curve at a given time. For example, the third point of each final motion-ring may be used as a control polygon for driving the display-ring and drawing the current curve.
Surfaces are produced as described above, but a second set of display-rings is used, driven using the fourth point (say point D) on each final motion-ring. The two display-rings are driven simultaneously to produce a string of quads along the surface. This technique is illustrated in
To produce surfaces with borders, automatically adjusted endpoints are added (as explained above in the discussion of extending to open curves) to each motion-ring and to the display-rings and treat them as open-loop curves.
Reproduced below is sample code for implementing the ringing method described above. Although classes are used, an object-oriented language is not required.
When implemented in software (e.g., by instructions executing on a processor) the subdivision scheme and/or the ringing process disclosed herein may be embodied in any computer-readable medium for use by or in connection with computer 800, or with any system that can fetch and execute the instructions. In the context of this disclosure, a “computer-readable medium” can be any means that can contain or store the program for use by, or in connection with, an instruction execution system. The computer readable medium can be, for example but not limited to, a system or that is based on electronic, magnetic, optical, electromagnetic, infrared, or semiconductor technology.
Specific examples of a computer-readable medium using electronic technology would include (but are not limited to) the following: random access memory (RAM); read-only memory (ROM); and erasable programmable read-only memory (EPROM or Flash memory). A specific example using magnetic technology includes (but is not limited to) a portable computer diskette. Specific examples using optical technology include (but are not limited to) compact disk (CD) and digital video disk (DVD).
The subdivision scheme and/or the ringing process disclosed herein may also be implemented in hardware, including (but not limited to): a programmable logic device (PLD), programmable gate array (PGA), field programmable gate array (FPGA), an application-specific integrated circuit (ASIC), a system on chip (SoC), and a system in package (SiP). In particular, the subdivision scheme and/or the ringing process disclosed herein may be implemented in hardware by a graphics processor, also known as a graphics processing unit (GPU).
A GPU is a specialized type of microprocessor that is optimized to perform fast rendering of three-dimensional primitive objects such as triangles, quadrilaterals, etc. The primitives are described with vertices, where each vertex has attributes (e.g., color), and textures can be applied to the primitives. The result of the rendering is a two-dimensional array of pixels which appears on a computer display or monitor. In this contemplated embodiment, the subdivision scheme and/or ringing process is implemented by the GPU itself (i.e, in hardware logic) rather than by instructions executing on the GPU (i.e., in software running on the GPU).
Any software components illustrated herein are abstractions chosen to illustrate how functionality is partitioned among components Other divisions of functionality are also possible, and these other possibilities are intended to be within the scope of this disclosure. Furthermore, to the extent that software components are described in terms of specific data structures (e.g., arrays, lists, flags, pointers, collections, etc.), other data structures providing similar functionality can be used instead.
Any software components included herein are described in terms of code and data, rather than with reference to a particular hardware device executing that code. Furthermore, to the extent that system and methods are described in object-oriented terms, there is no requirement that the systems and methods be implemented in an object-oriented language. Rather, the systems and methods can be implemented in any programming language, and executed on any hardware platform.
Any software components referred to herein include executable code that is packaged, for example, as a standalone executable file, a library, a shared library, a loadable module, a driver, or an assembly, as well as interpreted code that is packaged, for example, as a class. In general, the components used by the systems and methods of reducing media stream delay are described herein in terms of code and data, rather than with reference to a particular hardware device executing that code. Furthermore, the systems and methods can be implemented in any programming language, and executed on any hardware platform.
The flow charts, messaging diagrams, state diagrams, and/or data flow diagrams herein provide examples of the operation of systems and methods of reducing media stream delay through independent decoder clocks, according to embodiments disclosed herein. Alternatively, these diagrams may be viewed as depicting actions of an example of a method implemented by independent decoder clocking logic 190. Blocks in these diagrams represent procedures, functions, modules, or portions of code which include one or more executable instructions for implementing logical functions or steps in the process. Alternate implementations are also included within the scope of the disclosure. In these alternate implementations, functions may be executed out of order from that shown or discussed, including substantially concurrently or in reverse order, depending on the functionality involved. The foregoing description has been presented for purposes of illustration and description. It is not intended to be exhaustive or to limit the disclosure to the precise forms disclosed. Obvious modifications or variations are possible in light of the above teachings. The implementations discussed, however, were chosen and described to illustrate the principles of the disclosure and its practical application to thereby enable one of ordinary skill in the art to utilize the disclosure in various implementations and with various modifications as are suited to the particular use contemplated. All such modifications and variation are within the scope of the disclosure as determined by the appended claims when interpreted in accordance with the breadth to which they are fairly and legally entitled.
This application claims priority to copending U.S. Provisional Application having Ser. No. 61/034,712 filed Mar. 7, 2008, which is hereby incorporated by reference herein in its entirety.
Number | Date | Country | |
---|---|---|---|
61034712 | Mar 2008 | US |