Multi-Layer Implicit Garment Models Roberto E. P´erez-Urbiola Isaac Rudom´ın G. Instituto Tecnol´ogico y de Estudios Superiores de Monterrey Campus Estado de M´exico Km. 3.5 Carretera Lago de Guadalupe Atizap´an de Zaragoza, Estado de M´exico, CP 52926. M´exico
[email protected] [email protected]
Abstract This paper presents a new way to model clothing worn by articulated implicit characters. A scalar field is produced using ellipsoids as primitives. Isosurfaces are then used to place garments in one or more layers. As each implicit surface is independent, collision detection is not needed. The cloth is a polygonal mesh whose vertices are in turn moved towards their destination isosurface using the gradient of the scalar field. In order to maintain the cloth’s shape and size a net of simple springs is used. We improve appearance by adding noise to simulate wrinkles and light wind.
1. Introduction Computer animations that we can see today consist mostly of rigid solid objects. Lately, however, we are starting to see flexible objects being used more often. Solid objects are usually described by a polygon mesh that is too complex to manage in a vertex by vertex way, as is often the case when dealing with flexible characters. Implicit surfaces can be used to model them. An implicit surface is defined as all the points that satisfy the condition F (x; y; z ) = k in a given three dimensional scalar field. Different constants k refer to separate isosurfaces. In order to create realistic articulated soft objects, we can use ellipsoids in combination with blending functions to shape the scalar field. Our articulated model is similar to Wilhelms’ [21] and includes a skeleton, joints and muscles. Many researchers are working in the cloth design, modelling and animation [4][10], with various approaches. Both physical and geometric methods have been used to model cloth. Geometric approaches try to imitate the shape of cloth. For example, Weil [20] uses catenary curves to ap-
proximate the appearance of hanging cloth from its corners. Hybrid techniques combine geometric approaches with some sort of physical phase. Rudom´ın [13] approximates the initial state of draping cloth on an object with its convex hull, then continues with physical simulation. Terzopoulos et al. [14] generalised deformable model was one of the first physical methods introduced. Nevertheless, it requires solving a large system of simultaneous ordinary differential equations. Since then, physical methods have been commonly simulated by calculating the actual forces and energies involved in a grid of particles. For static views of cloth, a minimum energy state is searched. For dynamics, it is necessary to integrate the equations using Euler or Runge-Kutta. Breen et al. [5][9] employ an interacting-particle model which is based on the microstructure of woven cloth. The modelling of clothing worn by virtual actors has been investigated by Thalmann et al. [19]. Their algorithm is generic enough to handle cloth by itself (i.e. clothing without a person under it) [15]. They pursue physically accurate clothing coupled with an optimised algorithm for collision detection [16]. References to their hierarchical collision detection solution and other algorithms can be found in [17]. Their clothing systems [19][18] include a collision detection engine, a mechanical simulation engine, software for human body modelling and deformation, garment design and simulation, and a graphical interface. Garments are first assembled from panels and latter placed on a human model. Baraff et al. [1] has dramatically reduced the time needed to perform implicit integration which allows the simulation to advance in larger steps that with either Euler or RungeKutta. Nevertheless, the issue of multiple layers of clothing has not yet been addressed. The problem is the large amount of time needed for calculating collision detection.
In this paper, we propose a hybrid method where we take advantage of the scalar field generated by the implicit surfaces to handle multiple layer clothing. This method avoids the computation of collisions since each layer is placed on a different isosurface. The isosurfaces are obtained from the same ellipsoidal primitives that we use to model the characters. A polygonal mesh with springs is used to maintain the cloth’s shape and size. Moving the cloth is simplified by storing the vertex’s positions relative to local coordinate system of the nearest ellipsoid. Optionally, sinusoidal noise is added to increase realism. The rest of the paper is organised as follows: we first introduce the use of implicit surfaces to model clothing. Then, we outline the articulated objects used. We continue with the garments’ design, placement and appearance. Next, we summarise the implementation and results, and finally, we discuss future work.
2. Implicit Surfaces for Modelling Clothing The fundamental idea behind the work described in this paper is to use implicit surfaces for modelling clothing of implicit articulated characters. Clothing is usually worn by humans in layers, however, in computer graphics this is hardly ever animated due to the time needed for calculating collision detection. We solve the problem by using isosurfaces that surround the subject. As the scalar field can not have two different values for a given point, we conclude that we can place each layer of clothing in different isosurfaces without having to worry much about collisions. See figure 1. To accomplish this, we first have to create a scalar field. We designed our character using ellipsoidal primitives blended together using a formula introduced by Blinn [2]:
g(r) = ae,br
Figure 1. Using isosurfaces to place garments
root controls the position and orientation of the character. Each segment is a local coordinate system whose origin is used as a joint. Ellipsoids are specified by the two ends of the main axis, the volume, the orientation of a second axis and the ratio between the second and third axis. The coordinates are given in the local coordinate system of the segment to which they are attached. It is possible to specify different segments for each end point. See figure 2.
2
In our case, r is the distance to the centre of a sphere, while the constants a and b equal one and 0.8 respectively. The sphere is also scaled and rotated to adjust it to the axis and orientation of the desired ellipsoid. Each layer of clothing is assigned to a different isosurface. In order to maintain a similar distance between the layers, offset isosurfaces were considered, but discarded later because the required numerical method was too expensive. Instead, long ellipsoids where replaced by two or three more spherical ones.
Figure 2. The three points shown, the volume and the ratio of axis 1 and 2 define an ellipsoid.
3. Implicit Articulated Objects The model for implicit articulated objects used is a simplification of the one presented in Wilhelms’ article [21]. A hierarchy of skeleton elements is implemented where the
The character is animated by changing the joints’ angles and axes of rotation. This data was stored in a text file. As the animation proceeds, ellipsoids are automatically moved and reshaped without any other user intervention. We calcu-
late the lengths of the three axes to preserve the volume of the individual ellipsoids at each frame. Nevertheless, the final volume might vary due to the blending operations. In [6] local volume variations are corrected but were not implemented for this research. Blending groups (of ellipsoids) and the following steps avoid unwanted joining of nearby members:
To calculate the value of the scalar field at a point (x; y; z ): – Compute the sum of all the ellipsoids in each blending group. Ellipsoids can belong to more than one group. – We select the highest value from the groups.
We first used marching cubes [3] to display the isosurface of the character, but later we changed to pieces of “skin” placed as we describe in section 5.
4. Garment Design Garments consist of pieces of clothing to be worn on different layers. The design of each piece is performed in a Computer Aided Design program, using quadrilateral and triangular elements. See figure 3.
Figure 4. Correspondence between polygons, springs, triangles and vertices.
We found that the cloth’s shape didn’t need to be a perfect match with the isosurface, because we kept the cloth attached to it. Nevertheless, any extra cloth was cut in order to prevent the mesh from folding over itself.
5. Garment Placement Pieces’ vertices are locked to the respective isosurface using the gradient of the scalar field, like in Witkin and Heckbert [22][8]. So far, the number of particles remains constant but multi-resolution extensions of the method presented in this article could change that. The gradient is easily calculated due to the nature of the blending function (an exponential, already described in section 2). The direction in which we have to move a particle that is outside or inside the target isosurface is decided by comparing the scalar field value at the particle’s position with the desired value of the isosurface. The isosurface-locking algorithm is:
Figure 3. A sample garment before using isosurfaces. Springs are added to each side of the polygons and between opposite corners in the quadrilateral elements as shown in figure 4.
For each vertex: – The value of the scalar field is calculated at the vertex’s position. – If the value is close enough to the target isosurface, we are done with this vertex. – The gradient at the point is obtained.
– If the value of the field is higher than the isosurface sought, we subtract from the vertex’s position the unitary vector of the gradient multiplied by a small predefined distance. Otherwise, we add this same vector. – If a maximum number of iterations has been reached, we continue with the next vertex. The method combines the isosurface’s lock that holds the pieces in place with springs that approximately preserve cloths’ size and shape. The algorithm for the springs is simple. All the springs try to move their vertices in order to arrive to a rest distance. The sum of the effect of all the springs is what finally adjusts the positions. The spring algorithm follows:
The displacement variable for all vertices is set to zero.
6. Appearance
For each spring: – We accumulate the distance that the vertices i and j of the spring r will move:
jvj , vi j , r ) r jvj , vi j (jv , v j , r ) r djr , = (vj , vi ) j i jvj , vi j dir + = (vj , vi )
system of the nearest ellipsoid in the vicinity (more about this below). After the joints have been calculated the world coordinates of the vertices are updated. This allows the majority of the vertices to be very close to their final position for the frame. With vicinity in the previous paragraph, we refer to the fact that a vertex is restricted to move from adjacent blending groups only. That is, a vertex whose coordinates were assigned to the isosurface of an arm can only stay there or move to the elbow, it can not jump to the isosurface generated by the thorax ellipsoids. The final corrections and movements of the clothing are done combining the isosurface-locking algorithm with the spring algorithm. In our model we use an I-S-I-S-I combination per frame where I is an execution of the isosurfacelocking algorithm and S is a run of the spring algorithm.
(
Where dir is the displacement that vertex i (of spring r) will have. vi , vj are the positions of the vertices expressed in terms of the global coordinate system. r is the rest distance of spring r. r controls the amount of movement. Finally += and ,= are the usual C language operators. Optionally, we check that no vertex is moved more than a user-defined distance. This is especially useful when the constant r is greater than 0.20. We can restrict the displacement direction to the tangent plane of the isosurface. This is expensive because we need to calculate the gradient for every vertex even when the final position is close enough to the isosurface. In our tests, it was faster to let the isosurfacelocking algorithm take care of the errors. The vertices’ positions are updated according to the final values of the displacement variables.
Before the first frame, it is necessary to position the cloth close to the object, and then run the previously described algorithms many times until we reach a stable initial state. During the animation, a great amount of movement occurs that would be expensive to compensate only by means of the above algorithms. Instead, before each frame, the position of each vertex is saved in terms of the local coordinate
In order to improve the appearance of clothing it is necessary to simulate the wrinkles and some sort of wind-like movement. We considered some alternatives. We could use a texture map, either bump or displacement based. Unfortunately the time (in the order of minutes) required for displacement mapping using flow fields [11] is beyond our goals. In general, displacement textures using the normal of the surface could be used but would have problems with multi-layer clothing, as collisions are likely to occur. Bump mapping would require the recalculation of the texture bitmaps in order to produce moving wrinkles. Finally, applying textures directly to the isosurface proves too costly (also in the order of minutes per frame), because a parameterisation is required as shown in [12]. We settled for the option of adding noise to the scalar field, as it is simple and it can be controlled to give the impression of light wind. In addition, the noise function can be designed to be continuous so that the layers do not collide even after it is added. A noise scalar field is generated from the ellipsoids, where each one contributes with six sinusoidal functions that vary in frequency and amplitude. Even these characteristics vary in time to avoid cyclic effects and achieve windlike movements of the cloth. The noise is consistent in time, as it is based on the ellipsoids. It moves with the character’s limbs. For example, a wrinkle in an arm doesn’t suddenly disappear as the arm moves. The noise is added to the value of the isosurface searched. This could cause some self-collisions between adjacent layers, but was, in most cases, solved by calculating the noise before every iteration of the isosurface-locking algorithm, this way, the layers converge into a non-penetrating state. In
Method
Noise & spring-projection Noise only Spring-projection only Plain algorithm
Seconds including 1 second to write the VRML file to disk. 7.7 sec/frame 6.4 sec/frame 4.6 sec/frame 3.3 sec/frame
Table 1. Statistics of a 40-frame animation. the few cases where they didn’t, it was because not enough iterations were made or because the triangles intersected due to the curvature.
7. Implementation and Results The code was written in C. VRML was output with a speed of 6.4 sec/frame (5.4 sec discounting the VRML generation), considering a total of 12,000 triangles in three cloth layers with noise (quadrilaterals were split to display them). See Colour Plate 1. The tests were done in a Pentium II at 233Mhz with 96MB RAM. Clothing without wrinkles was as fast as 2.3 sec/frame, discounting the time needed to write the VRML file. Table 1 contains more details. In the table, noise refers to the sinusoidal functions added to improve appearance, while the spring-projection constrains the movements caused by the springs to the plane tangent to the isosurface. As we can see, the spring-projections lowers the amount of displacements towards the isosurface but requires too much time. The animation was performed without collision detection, but as desired, the layers of clothing behaved well thanks to the isosurface-locking algorithm. It is possible to use parallelism, as each garment is independent, they can be computed separately. The springs helped, mainly at the joints, to adjust the garments’ size and prevent polygon deformation. The clothing automatically followed the character, while maintaining its shape and size closely. The constraint that avoids a vertex to jump to the wrong isosurface worked well but not perfectly, still if the concavities are very pronounced the vertices may move from vicinities and not be able to find their way back naturally. Our model required some finetuning of the ellipsoids and blending groups in the armpit section. Texture was added experimentally, simply by specifying it in the VRML file (see Colour Plate 2). While VRML did a fine job showing the textures’ potential, it doesn’t map the texture consistently and uniformly throughout the frames. This isn’t a limitation of the model, the mesh can be parameterised for texture mapping as any other, but for now, we didn’t implement this.
Colour Plate 3 shows the same character and clothing with wrinkles, rendered with BMRT (Blue Moon Rendering Tools). The use of shadows enhanced the overall appearance.
8. Conclusions and Future Work When working with multiple layers of clothing, collision detection is usually a time consuming process. We presented a method that combines implicit surfaces with multiple-layer garment modelling that makes that phase unnecessary. The algorithms presented are focused in clothing for articulated implicit characters. Special attention was given to the garments’ size, shape and placement. This approach can be complemented by more investigation in the following areas:
Lower cost noise, one that doesn’t need to be constantly calculated in order for the layer to converge into a nonpenetrating state or one that does not use the expensive sine functions. Textures should be mapped correctly to the garments. Modelling software designed for this approach would provide better-looking characters and clothing for the animations. Some springs calculations could be avoided, at least in the second iteration of a frame, if we identify the springs that affected insignificantly their vertices in the previous iteration. Adding physics and other effects could be investigated. For example, by applying deformations from impacts directly to the isosurface as in [7]. Shapes that differ from the character’s silhouette can be implemented. For example, skirts could benefit from modifications made to the scalar field after the character has been polygonized. Likewise, Flared trousers can be modeled by adding some ellipsoids to the legs or by letting the vertices move using physics, but limited between two isosurfaces. See figure 5. Resolution of the mesh could vary depending on the curvature of the isosurface. Buttons, pins and alike can be added. Collisions could be avoided by generating an extra contribution to the scalar field before attaching the next clothing layer. Clothing by itself using isosurfaces, with no character wearing it, is still an open research subject. Dressed avatars could be obtained with a simplification of this approach and a lower resolution.
Figure 5. Flared trousers. A) Using an extra ellipsoid. B) Using two isosurfaces as boundaries.
9. Acknowledgements This article is a summary of the Master thesis presented by R. P´erez, who thanks his thesis advisor I. Rudom´ın for the insights given, and the reviewers for the corrections.
References [1] D. Baraff and A. Witkin. Large steps in cloth simulation. In M. Cohen, editor, SIGGRAPH 98 Conference Proceedings, Annual Conference Series, pages 43–54. ACM SIGGRAPH, Addison Wesley, July 1998. [2] J. F. Blinn. A generalization of algebraic surface drawing. ACM Transactions on Graphics, 1(3):235–256, July 1982. [3] J. Bloomenthal. An implicit surface polygonizer. In P. Heckbert, editor, Graphics Gems IV, pages 324–349. Academic Press, Boston, 1994. [4] D. E. Breen, J. W. Eischen, M. Kass, N. Magnenat Thalmann, and M. Vecchione. Can we get there from here?: Current challenges in cloth design, modeling, and animation. Computer Graphics (SIGGRAPH ’97 Proceedings), 31(3A):437–439, August 1997. [5] D. E. Breen, D. H. House, and M. J. Wozny. A particle-based model for simulating the draping behavior of woven cloth. Textile Research Journal, 64(11):663–685, November 1994. [6] M. Desbrun and M.-P. Gascuel. Animating soft substances with implicit surfaces. Computer Graphics (SIGGRAPH ’95 Proceedings), 29:287–290, August 1995.
[7] M.-P. Gascuel. An implicit formulation for precise contact modeling between flexible solids. Computer Graphics (SIGGRAPH ’93 Proceedings), 27:313–320, August 1993. [8] P. S. Heckbert. Fast surface particle repulsion. In SIGGRAPH ’97, New Frontiers in Modeling and Texturing Course, pages 95–114. ACM Press, August 1997. [9] D. H. House, R. W. DeVaul, and D. E. Breen. Towards simulating cloth dynamics using interacting particles. International Journal of Clothing Science and Technology, 8(3):75– 94, February 1996. [10] H. N. Ng and R. L. Grimsdale. Computer graphics techniques for modeling cloth. IEEE Computer Graphics and Applications, 16(5):28–41, September 1996. [11] H. K. Pedersen. Displacement mapping using flow fields. Computer Graphics (SIGGRAPH ’94 Proceedings), 28:279– 286, July 1994. [12] H. K. Pedersen. Decorating implicit surfaces. Computer Graphics (SIGGRAPH ’95 Proceedings), 29:291–300, August 1995. [13] I. Rudom´ın. Simulating cloth using a mixed geometricphysical method. Ph.D. thesis, Department of Computer and Information Science, University of Pennsylvania, August 1990. [14] D. Terzopoulos, J. Platt, A. Barr, and K. Fleischer. Elastically deformable models. Computer Graphics (SIGGRAPH ’87 Proceedings), 21(4):205–214, July 1987. [15] P. Volino, M. Courchesne, and N. Magnenat Thalmann. Versatile and efficient techniques for simulating cloth and other deformable objects. Computer Graphics (SIGGRAPH ’95 Proceedings), 29:137–144, August 1995. [16] P. Volino and N. Magnenat Thalmann. Efficient self-collision detection on smoothly discretised surface animations using geometrical shape regularity. Computer Graphics Forum (Eurographics ’94 Proceedings), 13(3):155–166, September 1994. [17] P. Volino and N. Magnenat Thalmann. Collision and selfcollision detection: Efficient and robust solutions for highly deformable surfaces. In D. Terzopoulos and D. Thalmann, editors, Computer Animation and Simulation ’95, pages 55– 65. Eurographics, Springer-Verlag, September 1995. [18] P. Volino and N. Magnenat Thalmann. Developing simulation techniques for an interactive clothing system. In International Conference on Virtual Systems and Multimedia ’97 Proceedings, pages 109–118, Geneve, Switzerland, September 1997. International Society on Virtual Systems and Multimedia. [19] P. Volino, N. Magnenat Thalmann, S. Jianhua, and D. Thalmann. An evolving system for simulating clothes on virtual actors. IEEE Computer Graphics and Applications, 16(5):42–51, September 1996. [20] J. Weil. The synthesis of cloth objects. Computer Graphics (SIGGRAPH ’86 Proceedings), 20(4):49–54, August 1986. [21] J. Wilhelms. Animals with anatomy. IEEE Computer Graphics and Applications, 17(3):22–30, May/June 1997. [22] A. P. Witkin and P. S. Heckbert. Using particles to sample and control implicit surfaces. Computer Graphics (SIGGRAPH ’94 Proceedings), 28:269–278, July 1994.