The present invention claims priority of Korean Patent Application No. 10-2008-0130778, file on Dec. 22, 2008, which is incorporated herein by reference.
The present invention relates to a method and an apparatus for generating a graphic hair motion and, more particularly, to a method and an apparatus for generating a graphic hair motion with high quality and effective speed in visualizing a shape and motion of hair in computer graphics.
As well known to one skilled in the art, there is a mass-spring model in which the number of material points and the nearest material point are connected to each other with springs in respective strands of hair. According to the mass-spring model, hair is implemented in a very simple and rapid fashion.
After the above-mentioned proposal, Hadap has proposed a rigid multi-body linear chain model based on a rigid multi-body model used in robotics and articulated object animation. In this model, respective hair strands are approximated into linear rigid multi-bodies so that a dynamic engine can be easily modified to use and hair does not extend.
Recently, an elastic curve hair model is proposed and its researches are being widely conducted. Moreover, Bertails proposed a model of discrete Kirchhoff's theory for elastic rods used in mechanical engineering. In the Bertails model, a strand of hair is subdivided into segments with same length and the respective segments are modeled in helix type. The Bertails model can provide the expression of hair curling in inextensible strands of hair.
However, in the above-mentioned mass-spring model, overall strands of hair are extended when the spring is extended and curling cannot be expressed sufficiently. In order to solve these problems, several modified mass-spring models are proposed to connect the material points and a not-nearest material point with springs. However, even in the new models, the extension of strands of hair and insufficient curling expression of hair cannot be solved.
Next, Hadap model is applied to only straight hair because of being unable to express curl hair curling which requires the expression of hair curling.
Since the Bertails model uses an equal-length subdividing method when subdividing hairs into segments, it is not sufficient to express reality of hair strands ends which are more bent in the ends than in the roots of the hair strands. Further, there are great deals of vectors and matrices to be calculated for simulating the hair strands using high degree of freedom thereby spending a long time. Moreover, there is no way of automatically generating variables of a model curve from an initial three-dimension (3D) curve.
It is, therefore, an object of the present invention to provide a graphic motion generating method and apparatus for modeling hair into elastic curves that are inextensible while twisting and curling of hair can be expressed, for applying an adaptive different subdividing method to subdivide a single strand of hair into several segments such that detailed bending and curling of the strands of hair can be expressed in the vicinities of roots and ends of the strands of hair, for modeling the respective segments of respective strands of hair into low degree-of-freedom elastic curves with degrees of freedom less than two such that geometric and dynamic physical quantities can be calculated in a short time, and for automatically generating a curvature vector of the elastic curve model from an initial hair curve by using a minimizing technique.
In accordance with one aspect of the present invention, there is provided a method for generating a graphic hair motion including: subdividing a strand of hair into N segment curves with lengths (lQ) by using initial curve information of the strand of hair; determining a list of initial curvature vectors (CQ) of the segment curves; generating a list of rotation vectors (ΩQ), a list of rotation matrices (P(ΩQ,s)), a list of transition matrices (R(ΩQ,s)), and a list of model curves (rQ(s)) based on the list of the curvature vectors; generating lists of composite matrices (U, V, and W) by using the rotation matrices and the transition matrices; determining a list of new curvature vectors (CQ) of a shape of a next frame based on the lists of the composite matrices and an external root motion of hair; and repeatedly performing the generation of another lists of rotation vectors, rotation matrices, transition matrices, and model curves and the determination of a list of new curvature vectors of another next frame to generate a hair curve modified according to time.
It is preferable that the length (lQ) of each of the segment curves is obtained by applying a differential subdividing method which increases reality of the hair by reflecting property of the strand of the hair.
It is preferable that each of the model curves (rQ(s)) is determined by following equation:
t
Q(s)=P(ΩQ,s)tQ-1(lQ-1)
r
Q(s)=rQ-1(lQ-1)+R(ΩQ,s)tQ-1(lQ-1),
where in the Qth segment curve, rQ(s) is a position vector of a model curve, tQ(s) is a tangential vector, R(ΩQ,s) is a transition matrix in which P(ΩQ,s) is integrated with respect to s, tQ-1(lQ-1) and rtQ-1(lQ-1) are respectively a tangential vector and a position vector at an end point of (Q−1)th segment curve, s position parameter, and lQ is a length of the Qth segment curve.
It is preferable that the property of the strand of hair bending of which is gradually increased as goes from the vicinity of root to end of the strand of the hair.
It is preferable that each of the curvature vectors (CQ) for the determining each of the rotation vectors (ΩQ) has only two or less degrees of freedom such that the model curves (rQ(s)) are modeled into a low degree-of-freedom elastic curve.
It is preferable that the low degree-of-freedom is a Fresnel-Cosserat curve.
It is preferable that the strand of the hair is subdivided into the segment curves such that a segment curve near to a root of the strand is relatively long and a segment curve near to an end of the strand is relatively short.
It is preferable that the composite matrices (U, V, and W) are calculated by differentiating and integrating geometric quantities expressed by the following equation:
is α component of a rotation vector ΩQ, P(ΩQ,s) is a rotation matrix, R(ΩQ,s) is a transition matrix, and I3 is an identity matrix.
It is preferable that the list of the new curvature vectors (CQ) of said another next frame is determined by using a semi-implicit method in computer graphics.
It is preferable that when the semi-implicit method is used, each of the model curves of a frame at every time is determined by 2N-dimension vector xt=(τ1,κ1, . . . , τN,κN)t and a curved shape of a strand of hair (xt+Δt) at a time (t+Δt) is obtained from a curved shape of a strand of hair xt at a time t through following equation:
x
t+Δt
=x
t
+Δty
t+Δt
yt{{dot over (τ)}1,{dot over (κ)}1, . . . , {dot over (τ)}N,{dot over (κ)}N},
where Δt is a time interval and yt is a differential of xt with respect to time t.
It is preferable that the yt+Δt is obtained by solving a linear equation:
Ayt+Δt=Byt+ft, where matrices A and B may be respectively a mass matrix and a stiffness matrix of (2N)*(2N) matrices calculated using geometric composite matrices, ft is a restoring force due to an elastic force of the strand of the hair, an inertial force caused by movement of a root connected to a body of the strand, an external force such as gravity or wind, and a collision force between the hair and the body of the strand or between the hair and another hair, and the composite matrices of claim 9 may be used to calculate (2N) vector ft.
It is preferable that an algorithm for solving the linear equation comprises at least one of conjugate gradient (CG) method, Cholesky decomposition (CD), singular value decomposition (SVD), Gauss-Seidel relaxation, a multi-grid algorithm, and a preconditioned conjugate gradient (PCG) method.
It is preferable that the initial curve information of the strand of the hair is three-dimension curve information in a format of a set of M sample points.
It is preferable that the set of the M sample points is generated by at least one of Autodesk MAYA and Shave & Haircut or by an editor program.
It is preferable that in the generating of the list of the initial curvature vectors (CQ), the list of the initial curvature vectors of the N segment curves is obtained from 3M values of initial M sample points by applying a minimizing technique to a difference function g(τ1,κ1, . . . , τN,κN) as expressed by following equation:
where r(s) and rin(s) are a model curve and a sample curve respectively, r(sκ)−rin(sκ) is an error, and it is understood that sum of square of the error becomes the difference function g(τ1,κ1, . . . , τN,κN).
In accordance with another aspect of the present invention, there is provided an apparatus for generating a graphic hair motion, including: an initializer to determine a list of initial curvature vectors by using curve information of a strand of hair; a kinematics unit to generate a rotation vector, a rotation matrix, a transition matrix, and a model curve; a geometry unit to generate a composite matrix using the rotation matrix and the transition matrix; and a dynamics unit to calculate a list of new curvature vectors of a shape of a next frame based on the composite matrix and an external root motion of hair.
It is preferable that the geometry unit is connected to the kinematics unit and the dynamics unit such that the list of the new curvature vectors determined by the dynamics unit is used by the kinematics unit again and generates a modified hair curve according to time.
According to the present invention, a systemized pipeline for generating hair motion is provided so that manual operation can be miniaturized and calculation process can be effective.
Since hair curves are subdivided differently according to distances from roots of the hair curves, detailed expression of hair is enabled by reflecting phenomena that a small change occurs at the roots and a considerable bending occurs near ends of hair.
Moreover, since a list of initial curvature vectors is automatically generated with respect to a sample input of an arbitrary initial hair curve, user's burden required to use a generalized coordinate model can be eliminated.
Since it is possible to use only degrees of freedom less than two per a segment of a strand of hair, time for calculation can be shortened.
Furthermore, the method and apparatus of the present invention are useful to visualize the motion of hair in a rapid and effective manner and are applied to a physics-based animation of human hair and animal fur in computer graphics resulting in effectively generating a high quality image of the human hair and animal fur.
The above and other objects and features of the present invention will become apparent from the following description of embodiments given in conjunction with the accompanying drawings, in which:
Hereinafter, embodiments of the present invention will be described in detail with reference to the accompanying drawings.
The initial value generator 10 may be an editor program providing initial shapes of strands of hair and using any one of Autodesk MAYA and Shave & Haircut as commercial programs or a new program. The initial value generator 10 may provide three-dimension (3D) curve information in the format of a set of M sample points expressed by the following equation 1 from initial strands of hair for the graphic hair motion-generating unit 20.
rin(s):{x1,y1,z1, . . . , xM,yM,zM}, [Equation 1]
where rin(s) is a set of sample points and M is the number of sample points.
The graphic hair motion-generating unit 20, as illustrated in
The initializer 201 subdivides a single strand of hair into N segment curves by using the 3D curve information input from the initial value generator 10. As illustrated in
where L is an overall length of a strand of hair, N is the number of segment curves of hair strand, and Q is a Qth segment curve of the hair strand.
Here, the differential subdividing method is a hair expression method of improving reality of hair by reflecting properties of strands of real hair bending of which is gradually increased as goes from the vicinity of roots to ends of the strands of hair.
The initializer 201 models the Qth segment curves of the respective hair strands which are obtained by the above-mentioned manner into Fresnel-Cosserat curves as low degree-of-freedom elastic curves thicknesses of which may be almost ignored, twist and curling of which can be expressed, and which are not extensible, as illustrated in
CQ={τQ,κQ} [Equation 3]
where τQ is torsion describing twist and κQ is curvature describing curling. Here, since only degrees of freedom per a segment curve of strands equal to or less than two is used, time for calculation can be shortened.
The kinematics unit 203 uses the lengths lQ of the Qth segment curve obtained by equation 2 and simulation parameters to calculate constants such as stiffness matrix.
The kinematics unit 203 calculates a list of rotation vectors ΩQ based on a list of curvature vector CQ at every frame input from the initializer 201 or the dynamics unit 207, and calculates a list of rotation matrices PΩ
The kinematics unit 203 determines model curves rQ(s) of the Qth segment curves by using the following equation 4 with the rotation matrices PΩ
t
Q(s)=P(ΩQ,s)tQ-1(lQ-1)
r
Q(s)=rtQ-1(lQ-1)+R(ΩQ,s)tQ-1(lQ-1) [Equation 4]
where, in the Qth segment curve, rQ(s) is a position vector of a model curve, tQ(s) is a tangential vector, R(ΩQ,s) is a transition matrix in which P(ΩQ,s) is integrated with respect to s, tQ-1(lQ-1) and rtQ-1(lQ-1) are respectively a tangential vector and a position vector at an end point of (Q−1)th segment curve, that is, at a starting point of the Qth segment curve, s is a position parameter, and lQ is a length of the Qth segment curve.
Although the list of curvature vectors CQ input from the dynamics unit 207 to the kinematics unit 203 is changed at every frame, the list of curvature vectors input from the initializer 201 is determined only once. To this end, calculating from values of 3M variables in the set consisting of M sample points in equation 1 that values of 2N variables constituting with respect to N segment curves, is carried out only once. For this calculation, a minimizing technique is applied to a difference function g(τ1,κ1, . . . , τN,κN), that is, the following equation 5 is solved.
where r(s) and rin(s) are a model curve and a sample curve respectively, r(sκ)−rin(sκ) is an error, and it is understood that sum of square of error becomes the difference function g(τ1,κ1, . . . , τN,κN).
The geometry unit 205 calculates composite matrices U, V, and W, as expressed by equation 6, through differentiating and integrating geometric quantities by using the list of rotation matrices P(ΩQ,S) and the list of transition matrices R(ΩQ,s) which are at every frame input from the kinematics unit 203, and provides the composite matrices U, V, and W for the dynamics unit 207.
where ΩQα is α component of a rotation vector ΩQ, P (ΩQ,S) is a rotation matrix, R(ΩQ,s) is a transition matrix, and I3 is an equivalent matrix.
The dynamics unit 207 uses the composite matrices as outputs from the geometry unit 205 and a root motion of hair input from the body motion generator 40, that is, a curved shape of a frame at the current time to determine a shape of hair at a next time frame. In more detail, although the shape of hair must be determined in principle through a non-linear differential equation for expressing a motion derived from a physical model of a hair motion, since the non-linear differential equation is possible to obtain an analytical solution in only a special simple mechanical system, only shapes of hair at discrete time are determined by numerically approximating the shapes of hair into non-linear discrete equation. In applications of computer graphics, since a discrete method performed within a short time is allowed to use regardless of inferior precision, a physical motion non-linear differential equation is simplified into a linear discrete equation for the graphics animation application so that the shapes of hair can be determined.
In this case, a semi-implicit method is used as a discrete method and a model curve of a frame at every time is determined by 2N-dimension vector xt=(τ1,κ1, . . . , τN,κN)t and a curved shape of a strand of hair (xt+Δt) at a time (t+Δt) is obtained from a curved shape of a strand of hair xt at a time t through the following equation 7.
x
t+Δt
=x
t
+Δty
t+Δt
yt={{dot over (τ)}1,{dot over (κ)}1, . . . , {dot over (τ)}N,{dot over (κ)}N}t [Equation 7]
where Δt is a time interval and yt is a differential of xt with respect to time t.
yt+Δt of equation 7 is obtained by solving a linear equation, that is, equation 8.
Ay
t+Δt
=By
t
+f
t [Equation 8]
where matrices A and B may be respectively a mass matrix and a stiffness matrix of (2N)*(2N) matrices calculated using the composite matrices that are calculated in equation 6 by the geometry unit 205, ft is a restoring force due to an elastic force of a strand of hair, an inertial force caused by movement of a root connected to a body of the strand of hair, an external force such as gravity or wind, and a collision force between hair and the body of the strand or between hair and hair, and in order to calculate (2N) vector ft, the geometric composite 3*3 matrices calculated by the geometry unit 205 through equation 6 may be used.
Moreover, although any one of algorithms such as conjugate gradient (CG) method, Cholesky decomposition (CD), singular value decomposition (SVD), Gauss-Seidel relaxation, and a multi-grid algorithm may be used to solve the linear equation given by equation 8, a preconditioned conjugate gradient (PCG) method of using yt as an early estimation of yt+Δt is an effective method in the present invention.
Therefore, according to the present invention, a systemized pipeline for generating hair motion is provided so that manual operation can be miniaturized and calculation process can be effective. Since hair curves are subdivided differently according to distances from roots of the hair curves, detailed expression of hair is enabled by reflecting phenomena that a small change occurs at the roots and a considerable bending occurs near ends of hair.
Next, a graphic hair motion-generating procedure performed by the graphic hair motion generating apparatus constructed as described above will be described.
The initializer 201 of the graphic hair motion-generating unit 20 receives 3D curve information of initial strands of hair, which are generated by the initial generator 10, in the format of a set of M sample points expressed by equation 1 (S501). The initializer 201 subdivides a single strand of hair into N segment curves using the received 3D curve information such that a segment curve near to a root of the hair strand is relatively long and a segment curve near to an end of the hair strand is relatively short. The initializer 201 obtains a length lQ of Qth segment curves from equation 2 and models the obtained segment curved of the strand into Fresnel-Cosserat curve as low degree-of-freedom elastic curves as illustrated in
The kinematics unit 203 determines a list of rotation vectors ΩQ based on the list of curvature vectors CQ input from the initializer 201 or the dynamics unit 207 and calculates lists of rotation matrices P(ΩQ,S) and transition matrices R(ΩQ,s) based on the list of rotation vectors ΩQ,S (S505) to provide the calculated lists to the geometry unit 205.
The geometry unit 205 calculates composite matrices (S507) to be used in the dynamics unit 207 through differentiating and integrating geometric quantities expressed by equation 6 using the list of rotation matrices P(ΩQ,s) and the list of transition matrices R(ΩQ,s) which are at every frame input from the kinematics unit 203 and provides the calculated composite matrices for the dynamics unit 207. The geometry unit 205 provides a modified hair model curve rQ(s) obtained from equation 4 for the visualizer 30 (S511) finally.
The dynamics unit 207 uses the composite matrices received from the geometry unit 205 and a root motion of hair input received from the body motion generator 40, that is, a curved shape of a frame at the current time to determine a list of new curvature vectors as a shape of hair at a next time frame (S509) and provides the determined list to the kinematics unit 203. In other words, the output of the dynamics unit 207 is used again by the kinematics unit 203 like in the graphic hair motion generator 20. That is, the output of the dynamics unit 207 circulates a loop connecting the kinematics unit 203, the geometry unit 205, and the dynamics unit 207 and is used to generate the shape of hair with respect to continuous-time frames.
As described above, since a list of initial curvature vectors is automatically generated with respect to a sample input of an arbitrary initial hair curve, user's burden required to use a generalized coordinate model can be eliminated. It is possible to use only degrees of freedom less than two per a segment of a strand of hair so that time for calculation can be shortened. Moreover, the method and apparatus of the present invention are useful to visualize the motion of hair in a rapid and effective manner and are applied to a physics-based animation of human hair and animal fur in computer graphics resulting in effectively generating a high quality image of the human hair and animal fur.
While the invention has been shown and described with respect to the embodiments, it will be understood by those skilled in the art that various changes and modifications may be made without departing from the scope of the invention as defined in the following claims.
Number | Date | Country | Kind |
---|---|---|---|
10-2008-0130778 | Dec 2008 | KR | national |