This application claims the priority of Korean Patent Application No. 2004-12985, filed on Feb. 26, 2004, and No. 2004-15607, filed on Mar. 8, 2004, in the Korean Intellectual Property Office, the disclosures of which are incorporated herein in their entirety by reference.
1. Field of the Invention
The present invention relates to rendering of three-dimensional graphics data, and more particularly, to a data structure for graphical cloth animation which allows a graphical cloth to be realistically animated in real time, and an apparatus and method of rendering three-dimensional graphics data using the data structure.
2. Description of the Related Art
In order to read data from files which store data regarding a three-dimensional (3D) graphical image (hereinafter 3D graphics data) and to output the data to a screen, an apparatus is required which analyzes the 3D graphics data and records the 3D graphics data on a video memory for storing data to be output to the screen. In general, the apparatus is called a 3D graphics rendering engine.
In general, the 3D graphics data comprises information on the geometry of an object located in a three-dimensional space, a material of the object, a position and characteristics of a light source, and variation of such information with time. Examples of the information on the geometry of the object comprise locations of 3D fixed points forming the object, links of the fixed points, etc. Examples of the information on the material of the object comprise colors, the light reflectance of a surface, etc. Such information is represented in an intuitively or logically understandable structure so that users can create and modify the 3D graphics data easily. The structure is typically referred to as a scene graph, which has an acyclic tree structure. The scene graph is composed of nodes comprising information on the geometry or material of the object, and information on links of the nodes. In other words, the node is one of the elementary components of the scene graph. Fields define specific characteristics of the node.
Recently, as rendering processors for 3D graphics data have improved in performance, the desire for a more realistic representation of natural objects has increased. Conventional 3D graphics techniques have animated 3D models in a simple manner. In recent years, it has become easy to create adequate virtual environments and to express the imagination of a developer by representing natural phenomena, such as running water, wind, and smoke, and the motion of a person's hair or clothes.
In representing the motion of cloth, both intrinsic characteristics of the cloth and external physical factors such as gravity, wind, acceleration, and air resistance must be considered. In addition, effects of contact with external objects on the cloth should be considered.
Recently, a number of methods of taking these physical factors into consideration in animation have been proposed. However, since the proposed methods are performed in their own formats, it is impossible to render and animate general purpose 3D graphics models. In addition, it is difficult for users to write adequate programs due to the complicated physical characteristics of objects. In addition, rendering tools and authoring tools are incompatible because they use different formats. In addition, there has been a problem in that created models cannot be reused.
Accordingly, it is an aspect of the present invention to provide a data structure for animating a graphical cloth which defines nodes and fields for a realistic and real-time animation in commercial programs such as virtual reality modeling language (VRML), moving picture experts group (MPEG), 3D MAX, MAYA, etc.
It is also an aspect of the present invention to provide an apparatus and method of rendering 3D graphics data which renders a 3D cloth model into a 2D image by using the data structure for cloth animation.
Additional aspects and/or advantages of the invention will be set forth in part in the description which follows and, in part, will be obvious from the description, or may be learned by practice of the invention.
The foregoing and/or other aspects are achieved by providing a data structure for animation of a cloth comprising: a vertical granulation field which defines granulation along the vertical axis of a planar mesh of the cloth; a horizontal granulation field which defines granulation along the horizontal axis of the planar mesh of the cloth; a height field which defines a height of the planar mesh of the cloth; a width field which defines a width of the planar mesh of the cloth; and a physical characteristics node which defines values for physical characteristics used to calculate external and internal forces acting on the cloth, a shift position of the cloth due to the forces, and a shift position of the cloth due to a collision of the cloth with an object.
The physical characteristics node, in order to calculate the external forces acting on the cloth, may comprise a gravitational acceleration field which defines a gravitational acceleration used to calculate a gravitational force; a wind velocity field which defines a wind velocity used to calculate an air resistance; a buffer coefficient field which defines a buffer coefficient used to calculate an external buffering force; and an air resistance coefficient field which defines a resistance coefficient used to calculate the air resistance. In addition, the physical characteristics node, in order to calculate the internal forces acting on the cloth, may comprise a maximum elongation field which defines a maximum elongation of a spring linking mass-points on a lattice composing the planar mesh of the cloth; a planar force resistance coefficient field which defines a resistance coefficient of a spring linking each mass-point in the lattice with first neighboring mass-points directly on the right, the left, above, and below; a shift deformation resistance coefficient field which defines a resistance coefficient of a spring linking each mass-point with neighboring mass-points in a diagonal direction; and a torsion resistance coefficient field which defines a resistance coefficient of a spring linking each mass-point with every second mass-point on the right, the left, above, and below the first neighboring mass-points being therebetween. In addition, the physical characteristics node may comprise an inverse mass field which defines an inverse mass of each of mass-points in a lattice used for obtaining acceleration used to calculate the shift position of the cloth due to the forces acting on the cloth. In addition, the physical characteristics node may comprise a time interval field which defines a time interval used to calculate the shift position of the cloth.
The data structure may further comprise a fixed edge field which defines an edge of the mesh of the cloth that is fixed. In addition, the data structure may further comprise a collision node used to calculate the shift position of the cloth due to collision of the cloth with an object and to represent the object. The collision node may comprise a friction coefficient field used to calculate a shift velocity of a point at which the object collides with the cloth; a kinematics node which defines a virtual object colliding with the cloth; and a visible shape node used to actually represent the object colliding with the cloth.
The foregoing and/or other aspects are also achieved by providing a 3D graphics data rendering apparatus comprising: an analyzer to output a scene graph obtained by discriminating nodes and analyzing fields from 3D graphics data having a data structure for the cloth animation; a calculator to calculate physical quantities for animation of a cloth from the nodes and the fields of the scene graph and to output the scene graph comprising the calculated physical quantities; and a converter to convert the scene graph comprising the calculated physical quantities into a 2D image and to output the 2D image. The calculator may comprise a cloth discriminating unit to discriminate the nodes of the scene graph; a cloth mesh creating unit to create a mesh of the cloth according to the nodes and the fields; a colliding object discriminating unit to discriminate whether the object is colliding with the cloth; a collision detection unit to determine whether the cloth collides with the object; a physical quantity calculating unit to calculate physical quantities which represent the internal and external forces acting on the cloth and shift position of the cloth due to the collision with the object; and a cloth mesh deforming unit to deform the structure of the cloth by applying the shift position of the cloth calculated by the physical quantity calculating unit to the mesh of cloth, and to output the scene graph comprising the physical quantities. The collision detection unit detects whether the cloth collides with the object defined by a kinematics node. In addition, the collision detection unit detects a location of a collision point when the cloth collides with the object defined by a kinematics node.
According to another aspect of the present invention, there is provided a 3D graphics data rendering method comprising: outputting a scene graph obtained by discriminating nodes and analyzing fields from 3D graphics data having a data structure for the cloth animation; calculating physical quantities for animation of a cloth from the nodes and fields of the scene graph and outputting the scene graph comprising the calculated physical quantities; and converting the scene graph comprising the calculated physical quantities into a 2D image and outputting the 2D image.
The above and/or other aspects and advantages of the present invention will become more apparent by describing in detail exemplary embodiments thereof with reference to the attached drawings in which:
Reference will now be made in detail to the embodiment of the present invention, an example of which is illustrated in the accompanying drawings, wherein like reference numerals refer to the like elements throughout. The embodiment is described below to explain the present invention by referring to the figures. First, a physical model of cloth is set forth.
First, springs which link a mass-point (i, j) to mass-points (i+1, j), (i−1, j), (i, j+1), and (i, j−1), which are the thickest solid lines in
mij{umlaut over (x)}ij=Fij [Equation 1]
where m ij denotes the mass of a mass-point (i, j) in a lattice, xy denotes a spatial position vector of the mass-point, and Fij denotes the net force vector acting on the mass-point.
Internal and external forces act on each mass-point. The internal forces are produced by the elastic links between neighboring mass-points. The external forces comprise gravity, air resistance, buffering force, etc.
The internal forces are now set forth. Let T(i, j) be a set of mass-points (k, l). The mass-points (k, l) are linked to the mass-points (i, j) by springs. In this case, the internal forces, Fijint, acting on the mass-points (i, j) can be calculated as follows:
where Kijkl denotes the stiffness (spring constant) of a spring linking the mass-point (i, j) with the mass-point (k, l), Lijkl denotes the length of the spring in an equilibrium state, rij denotes a position vector of the mass-point (i, j), and rkl denotes a position vector of the mass-point (k, l).
Next, the external forces can be largely classified into gravity, buffering force, air resistance, and relative acceleration.
The force of gravity, Fijg, is defined by Equation 3.
Fijg=mijg [Equation 3]
where mij is mass of a mass-point (i, j), and g is the vector acceleration due to gravity.
The external buffering force, Fijd, is defined by Equation 4.
Fijd=−μvij [Equation 4]
where μ is a buffer coefficient, and vij=rij is a velocity vector of the mass-point (i, j).
The force of air resistance, Fija, is defined by Equation 5.
Fija=c(nij−(uw−vij))nij [Equation 5]
where c is a resistance coefficient, nij is a normal vector of the mass-point (i, j), and uw is a wind velocity vector.
The force due to relative acceleration, Fijr, is defined by Equation 6.
Fijr=−mij(a0+ε×rij+ω×(ω×rij)+2ω×vij) [Equation 6]
where a0 is a linear acceleration vector, and ω and ε are angular velocity and angular acceleration vectors, respectively, in a coordinate system in which the motion of a portion of the cloth is considered.
The net force, Fij(t), is obtained by summing up the internal and external forces as follows:
Fij(t)=Fijint+Fijg+Fijd+Fija+Fijr [Equation 7]
In order to calculate the shift positions of the mass-points, Euler's method, an elementary numerical analysis method, is used. The spatial location vector, rij, and the velocity vector, vij, for all mass-points are assumed to be known at time t. The location and velocity vectors for all mass-points at time t+τ are calculated as follows:
rij(t+τ)=rij(t)+vij(t)τ [Equation 8]
vij(t+τ)=vij(t)+aij(t)τ [Equation 9]
Next, a collision of the cloth with another object is set forth. It is assumed that the cloth collides with a rigid body having a predetermined shape, such as sphere, cone, cylinder, or rectangle.
At this time, two operations should be performed. A first operation is to detect whether a certain mass-point of the cloth is located in the colliding object, in order to determine whether a collision in fact occurs. A second operation is to detect a colliding location on a surface of the colliding object on which a certain mass-point of the cloth is projected, in order to calculate the shift position of the cloth due to the collision.
According to such a method, the shift position of the mass-point of the cloth can be calculated without detecting a penetration moment.
When the position vector of the mass-point of the cloth, yij, is located on the colliding object, the velocity vector, vij, is calculated as follows:
When positions of all mass-points of the cloth at time steps are obtained according to Euler's method, the position vector of the mass-point of the cloth, yij, can be obtained at time t+τ as follows:
yij(t+τ)=xij(t)+τvij(t) [Equation 12]
Meanwhile, a data structure for the cloth animation can be defined by several nodes as described below. These nodes comprise the ClothAnim, clothAnimPhys, and colliders nodes.
As described above in conjunction with
The ClothAnim node is composed of field values for the mass-points which represent the cloth having the mesh structure of
An example of the nodes and field values used for the ClothAnim node is shown in
The planar mesh of the cloth in
The clothAnimPhys node defines physical characteristics of the cloth. Several ClothAnim nodes may share the clothAnimPhys node. If the clothAnimPhys node is NULL as shown in
The constrain field has any one of “left”, “right”, “top”, and “bottom” strings. The constrain field defines a fixed edge in the mesh of the rectangular cloth. When the field is set to “left”, the left edge does not move but all other edges can move in the mesh of the cloth. The constrain field can be used in animation in which a flag fixed to a flagpole flutters in the wind. However, if the string is not defined in the constrain field as shown in
The colliders node has a “Kinematics” node to be considered in collision detection, which is described later.
The motion of the cloth is determined by internal forces between the mass-points and the external forces such as gravity, air resistance, and buffering force. The clothAnimPhys node has values for these forces.
An example of field values used in the clothAnimPhys node is shown in
Among these fields, the gravity field defines a gravitational acceleration vector, g, and is used for calculating gravity. The wind field defines a wind velocity vector, Uw, and is used for calculating air resistance. The timeStep field defines a time interval, τ, used for calculating the location and velocity of the mass-point according to Euler's method. The dissipativeCoeff field defines a buffer coefficient, μ, which is used for calculating the external buffering force. The nodeMassInv field defines the inverse mass of the mass-point, m−1, and is used for calculating the acceleration due to the internal and external forces. Assuming that the density of the cloth is uniform, the mass of each of the mass-points can be regarded to be the same. The airResistCoeff field defines a resistance coefficient, c, which is used for calculating the air resistance. The maxElongation field defines a maximum elongation of a spring which links the mass-points. If the spring is over elongated, it retracts forcibly. The stiffnessStructH field defines the stiffness of the spring along the “z” axis. The spring resists tension within the plane surface of the cloth. The stiffnessStructW field defines stiffness of the spring along the “x” axis. The spring resists tension within the plane surface of the cloth. The stiffnessShear field defines the stiffness of the spring which links mass-points in a diagonal direction. The value corresponds to the shift deformation (shear) within the plane surface of the cloth. The stiffnessBendH field defines the stiffness of the spring which links every other neighboring mass-point in the direction of the “z” axis. The spring resists torsion from the outside of the plane of the cloth. The stiffnessBendW field defines the stiffness of the spring which links every other neighboring mass-point in the direction of the “x” axis. The spring resists torsion from the outside of the plane surface of the cloth. The stiffnessStructH field, stiffnessStructW field, stiffnessShear field, stiffnessBendH field, and stiffnessBendW field are Kijkl used for calculating the internal force.
The colliders node defines a collision of the ClothAnim node. An example of the colliders node and field values is shown in
The kinematics node defines a virtual object colliding with the ClothAnim node. There are two methods of defining the kinematics node.
First, the DEF name of the kinematics node can be defined in a field of the colliders node in the ClothAnim node. In this field, the kinematics node can have two geometry nodes which are already defined in the VRML standard. These are the Box and Sphere nodes. The Kinematics node also has a geometry node which is not defined in the VRML standard. This is a TruncatedCone node. In the case of the “Sphere” node, the radius of the sphere should be defined and the sphere has the same shape as the Sphere node used in the VRML standard. In the case of the “Box” node, the size of the box should be defined and the box has the same shape as the Box node used in the VRML standard. In case of the “TruncatedCone” node, the height and the radii of the upper and lower surfaces of the curve should be defined. If the radii of the upper and lower surfaces are the same, the node has the shape of a cylinder. If the radius of either the upper surface or the lower surface is 0, the node has the shape of a cone. An example of the TruncatedCone node is shown in
Second, the kinematics node can have a value for the clothAnimModel field which defines a virtual object which collides with the ClothAnim node. An example of the kinematics node is shown in
The visibleShape node is used for showing the object which collides with a real cloth on a screen and has the Shape node defined in the VRML standard.
Next, a rendering apparatus and method according to the embodiment of the present invention will be described in detail with reference to FIGS. 6 to 13.
The analyzer 610 outputs a scene graph which is obtained by discriminating nodes and analyzing fields from the 3D graphics data IN having the data structure for the cloth animation. The calculator 620 calculates physical quantities for the cloth animation from the nodes and fields of the scene graph and outputs the scene graph comprising the calculated physical quantities. The converter 630 converts the scene graph comprising the calculated physical quantities into a 2D image OUT and outputs the converted image.
The node discriminating unit 710 discriminates nodes from the 3D graphics data IN (operation S1000). The character and bit sequences discriminating unit 730 analyzes character sequences of the node input from the node discriminating unit 710 and outputs the analyzed character sequences of the node to the node discriminating unit 710. According to the discriminated nodes, the node discriminating unit 710 can discriminate whether the 3D graphics data is information on the geometry of an object, the material of an object, etc. Next, a space to be filled with fields is created in the node analyzed in the node discriminating unit 710 (operation S1010). The character and bit sequences discriminating unit 730 analyzes characters or binary bit sequences of the fields input from the field analyzing unit 720 and outputs the analyzed sequences to the field analyzing unit 720. The field analyzing unit 720 analyzes the 3D graphics data to fill the space with the field values (operation S1020). The scene graph drawing unit 740 outputs the scene graph OUT1 constituted by inserting nodes having the analyzed field values (operation S1030). The scene graph has nodes comprising information on the geometry of mass-points composing the cloth, such as positions and links of the mass-points, material of the cloth, and so on. Next, in the analyzing process, it is determined whether the 3D graphics data has more nodes to be analyzed (operation S1040). If the 3D graphics data has more nodes to be analyzed, the analyzing process returns to operation S1000 and is repeated. If not, the analyzing process ends.
The cloth discriminating unit 810 discriminates the nodes of the cloth in an input scene graph IN (operation S1100). The cloth mesh creating unit 820 creates a mesh of the cloth according to the nodes and fields analyzed in the analyzer 610 (operation S1110). Next, the colliding object discriminating unit 830 determines whether there is an object colliding with the cloth in the input scene graph IN2, that is, whether there is a colliders node (operation S1120).
If there is no object colliding with the cloth, the calculating process proceeds to operation S1150. If there is an object colliding with the cloth in operation S1120, the geometry of the colliding object is discriminated from the information on the geometry of the colliders node (operation S1130). The collision detection unit 840 detects whether the object collides with the cloth (operation S1140). More particulary, the collision detection unit 840 detects whether a virtual object defined by the kinematics node collides with the cloth. If the virtual object collides with the cloth, the collision detection unit 840 detects the position of the collision point.
Next, if there is an object colliding with the cloth, the physical quantity calculating unit 850 calculates the physical quantities such as the internal and external forces, the shift position of the cloth due to these forces, the shift position of the cloth due to the collision, etc. If not, the physical quantity calculating unit 850 calculates the physical quantities such as the internal and external forces, the shift position of the cloth due to these forces, etc. (operation S1150). The calculated forces and shift position are the same as described above. The cloth mesh deforming unit 860 deforms the structure of the mesh of the cloth on the basis of the calculated physical quantities, and outputs the scene graph comprising the calculated physical quantities (operation S1160). Next, the calculating process determines whether there are more objects to collide with the cloth (operation S1170). If there are more objects to collide with the cloth, the calculating process returns to operation S1130. If not, the calculating process determines whether there are more nodes to calculate (operation S1180). If there are more nodes to calculate, the calculating process returns to operation S1100. If not, the calculating process of the scene graph ends.
The material information reading unit 910 reads information on the material of the node from the scene graph IN3 input from the calculator 620 (operation S1200). For instance, the information on the material of the node comprises texture, transparency, etc. The object converting unit 920 converts the scene graph having the information on the physical quantities calculated by using the information on the material into a 2D image OUT3 through an appropriate conversion of coordinates, and outputs the converted image (operation S1210). Next, the material information reading unit 910 determines whether there are more nodes to convert (operation S1220). If there are more nodes to convert, the converting process returns to operation S1200 and is repeated. If not, the converting process ends.
The embodiment of the present invention can be implemented as computer-readable codes stored on computer-readable recording media. The computer comprises all apparatuses having the function of information processing. The computer-readable recording media comprises all kinds of recording apparatuses for storing data which can be read by a computer system. Examples of the computer-readable recording apparatuses comprise ROM, RAM, CD-ROM, magnetic tape, floppy disks, optical data storage apparatuses, etc.
According to the embodiment of the present invention, the nodes can create 3D graphics from the lattice-shaped cloth and describe the internal characteristics of the cloth. In addition, it is possible to realistically represent motion by considering forces acting on the cloth, such as gravity, air resistance, the force of the wind, etc., and forces associated with a collision with an external rigid body. In addition, it is possible for anyone to produce a desired animation easily by simply changing node and field values, since the entire animation is possible by changing only several field values on the node. In addition, the volume of data is small as compared to a conventional interpolator animation, since it is possible to produce a desired animation by changing field values only. In particular, the VRML and MPEG-4 standards, which are regarded as standards in 3D graphics, fail to support the animation of cloth. However, the present invention can represent the node according to these standards. While the present invention has been described with reference to exemplary embodiments thereof, it will be understood by those skilled in the art that various changes in form and details may be made therein without departing from the scope of the present invention as defined by the following claims.
Number | Date | Country | Kind |
---|---|---|---|
10-2004-0012985 | Feb 2004 | KR | national |
10-2004-0015607 | Mar 2004 | KR | national |