2009 Sixth International Conference on Computer Graphics, Imaging and Visualization
A Method of 3D Garment Model Generation Using Sketchy Contours
Yaoye Zhang, Zhengxing Sun +, Kai Liu, Yan Zhang State Key Lab for Novel Software Technology, Nanjing University, 210093, P R China + Corresponding Author:
[email protected] users. Sketch is an intuitive and natural method of communications, and it becomes an important method to be introduced into garment design process to solve the existing problems. Sketch-based modeling systems have became popular for constructing 3D objects interactively from sketch [3][4]. There are several methods combined sketching with the garments modeling, we classify these methods to two categories: the first is gesture-based modeling, where the sketchy gestures are used to improve the interaction of the design systems, such as Igarashi [5] and Decaudin et al. [6]. The second is sketch-based garment modeling, where the 3D garment surface is constructed on a character directly from a 2D sketch. There are several problems within these methods. The sketch-based interface must be intuitive and convenient for designers; the modeling procedure should be in real time so that the designers can get feedback instantly; finally, the quality of the garment surface must adapt the underlying form of the character. Turquin et al. [7][8] proposed a method for constructing virtual garments from a 2D sketchy contour line. To accelerate the computing of the distance information around the character body, a distance field (DF) is introduced, so the garment surfaces can be constructed in only a few seconds. But the pre-computation of the distance field is very time-consuming, and it restricts the application of the method. Although the distance field can be computed in fractions of a second on a GPU now [9], it isn’t prevalent to compute distance field on GPU because the GPU device is more expensive. So a method to reduce the complexity of computing the distance field is needed. This paper presents a method to reconstruct a 3D garment model from a sketchy garment contour, there are three features with our method: firstly, a reference model of 3D human is established by restricting the direction of the distance field (only direction along z-axis is considered), and it makes the computation of distance field much easier; secondly, an efficient mapping from 2D sketch to 3D garment is established by using the relative position between sketched garment contour and the outline of human projection;
Abstract This paper presents a method to reconstruct a 3D garment model from a sketchy garment contour, there are three features with our method: firstly, a reference model of 3D human is established by restricting the direction of the distance field (only direction along z-axis is considered), and it makes the computation of distance field much easier; secondly, an efficient mapping from 2D sketch to 3D garment is established by using the relative position between sketched garment contour and the outline of human projection; thirdly, the 3D garment model is constructed according to the mapping between garment grids and the grids of human model, and it ensure that loose part of garments can be constructed correctly. The experiment results prove that the proposed method can generate a garment surface constrained by sketch and adapted the underlying form of character model, and the process can perform in real time. Keywords: Sketch-based interface, Garment modeling, Distance field, 2D-3D mapping.
1: Introduction The Garments is one of the most important characteristics to express an avatar. Garment design and garment modeling are important to describe a virtual character, and they have a wide range of applications in the fields of movies, games, designs and advertisements. The existing garment design systems mainly follow the “tailoring-sewing” style of traditional garment design procedure [1][2]: typically the users must draw each pattern piece on a planar virtual cloth, specify the edges to be stitched together, position the pieces around the virtual actor, and then simulate the garment around the character model to make them seem physically correct. The style described above includes pattern pieces design done in 2D environment and the sewing and dressing process accomplished in 3D environment, and the whole procedure is very tedious and requires high level of tailoring and 3D model editing expertise for 978-0-7695-3789-4/09 $25.00 © 2009 IEEE DOI 10.1109/CGIV.2009.58
205
Authorized licensed use limited to: Nanjing University. Downloaded on December 19, 2009 at 10:57 from IEEE Xplore. Restrictions apply.
include three aspects, which are mentioned as follows. (1). How to get a garment surface with considerable fidelity in real time. The garment surface should be with considerable fidelity to express the creative minds of the users, and the time of modeling the garment surface should be fast enough to make users’ interaction more convenient. The fidelity of the garment surface reconstructed by our method mainly depends on two factors: the resolution of distance field to represent the shape of underlying character model and the precision of the garment surface depend on the number of grids divided on xy-plane. The computation time of our method mainly depends on the number of grids and the complexity of the character model. So we should make trade-off between the fidelity of the garment surface and the computational time of our method. That means we should find an appropriate number of grids divided on xy-plane, so that the users can get a garment surface with considerable fidelity in real time. For different character models, the precision of the garment surface is irrelative to complexity of the character model, while the resolution of distance field is relative. So as the complexity of character model increases, only resolution of distance field should increase, and only computation time of distance field will increase. (2). How to establish the relationship between 2D sketch and 3D garment surface. According to the sketchy garment contour, the main clue we can used to infer the position of the garment surface is the relative position between the contour of garment and the outline of character, so we use the distance from 2D garment silhouette to outline of character to infer the variation of the distance between the remainder of the garment and the 3D character. There are four aspects of the problem. First, we should position the contour in 3D space according to their position in 2D xy-plane. We classify each segment of the contour into the silhouette-line and the borderline, and the position of each segment is respectively determined by their breakpoints. Second, we should get the distance information of each grid in xy-plane inferred from the distance-to-outline value of the contour. Third, we should compute the z-values of the garment grids, for which the distance information is computed. A distance field is computed to establish a reference model of virtual character, with which the computation of z-value is simplified to a trilinear interpolation. But the distance field takes a long time to pre-computed, so we modify the computation of the distance field to reduce its time complexity, and the distance field can be pre-computed within expected duration. Fourth, we should connect the contour and all the interior grids together to get a smooth garment surface, and a constrained Delaunay triangulation is performed to get a 3D garment surface. (3). How to deal with the loose part of the garment which has no “z overlap” with the mannequin. Our method can be regarded as making the garment
thirdly, the 3D garment model is constructed according to the mapping between garment grids and the grids of human model, and it ensure that loose part of garments can be constructed correctly. The experiment results prove that the proposed method can generate a garment surface constrained by sketch and adapted the underlying form of character model, and the process can perform in real time. The rest of this paper is organized as follows: in Sec 2 an overview of our method is given; in Sec 3 the algorithm used in our method is detailed, in Sec 4 is some experiments and the discussion; finally in Sec 5 a conclusion of our method and the future work is described.
2: Overview of the Proposed Method The essence of our method is to reconstruct a garment model constrained by users’ sketch and adapted the underlying form of the character model. As the frame illustrated in Figure.1, the garments modeling method we proposed is performed in two main steps: preprocess and garment modeling. 2D-3D mapping determination Sketch processing
User input
3D garment reconstruction
2D grids Creation
Stretch the distance field
Contour’s depth computation
Mesh’s depth Computation
Grids’ z-offset computation
Delaunay triangulation
Preprocessing Mannequin
Human Model
Distance Field
3D Garment Model
1. Framework of the proposed Method In preprocess, the outline of the orthogonal projection of human model has been extracted by Canny’s edge detection method [10], then it is supplied to users; the distance field is computed to be a reference model of human body with the distance direction constrained along z-axis. The garment is constructed in three steps. Firstly, the strokes sketched by users are processed into a group of closed garment contour segments according to their position. Secondly, the mapping from 2D sketch to 3D garment mesh is determined: the garment contour segments are divided into borders and silhouettes, and 2D grids are created in the area of garment; the z-offsets and depths of garment contour segments are computed according to their type, and the z-offsets are propagated to the whole garment grids. Thirdly, the depth of garment grids are computed by using the distance field, and the garment model is constructed: a mapping between garment grids and human body is constructed by stretching the distance field of human body to fulfill the garment area, and a degeneration coefficient is defined to modify the z-offsets; then the depths of garment grids is computed by interpolating with the distance field directly; a Delaunay triangulation is performed to get the final garment model. The main problems to be solved in our method
206
Authorized licensed use limited to: Nanjing University. Downloaded on December 19, 2009 at 10:57 from IEEE Xplore. Restrictions apply.
of an orthogonal projected character model, and the maximal and minimal z-values ( max_ z and min_ z ) of the character model. We use Canny’s edge detection [11] to find the outline of the orthogonal views of character model. 2). Divide the xy-plane to N × N (N is the resolution of the distance field) regular rectangles in 2D space, and classify all the vertices of the rectangles into two types: inside the outline and outside the outline. 3). For each 2D vertex ( x, y ) inside the outline, the distances from point ( x, y, max_ z) to the character along z-direction is computed, as well as the distance from point ( x, y, min_ z ) to the character. 4). For each 2D vertex ( x, y ) outside the outline, the distance from point ( x, y ) to the 2D outline is computed For a point ( x, y, z ) with the z-value unknown and the distance-to-body value of this point is dis , we can compute the z-value through the equation: z = z '− dis + dis ' , where z ' is max_ z (in back of the garment) or min_ z (in front of the garment), and dis ' is the distance information bilinear interpolated by the four vertices around ( x, y) . When the 2D point ( x, y) is outside the outline, we can also get its distance-to-outline value by bilinear interpolation with the four vertices around. The computation of the distance-to-body value of a point ( x, y, z ) with the z-value known is similar to the algorithm described above. As the octree-based algorithm used in original distance field, the distance field computation we modified can also employ a quadtree, so that the time complexity of distance field computation can be reduced to Ο ( n 2 lg n 2 ) . Moreover, when the side is determined (in the front or in the back), there is only one distance-to-body value corresponding to certain z-value at certain ( x, y ) .
mesh a smooth offset from the mannequin, but the loose part of the garment has no “z overlap” with the mannequin, so we can’t make offset with it directly. Because the surface of loose part of the garment also fit the shape of human body, and the z-values of the loose part of the garment increase when the distance between garment grid and human body becomes larger, we can approximately use part of the human body to instead the gap between outer point and the mannequin. In our method, we stretch part of the distance field to fulfill the loose position outside the mannequin, and make degeneration of the distance field value according to the distance between the outer points to the mannequin, so that all of the garment surface can be constructed by using the distance field directly.
3: Key techniques of the proposed method When a user draws a sketchy garment contour, it is processed into a set of ordered strokes according to their spatial position, and then the garment surface will be constructed. In particular, for the sake of clarity, we’ll assume that the character is aligned with the xy-plane, viewed along the z direction.
3.1: Modification of DF computation A distance field is a scalar field that measures the distance from a given point to an object, including information about the inside and outside of the structure. To accelerate the computation of z-values from the distance-to-body values, we can pre-compute a distance field of the character model, which stores the distance from every point of 3D grid around the model to the model’s nearest point. By using a distance field, the computation of z-values is reduced to trilinear interpolation of a regular grid. There are some drawbacks of the distance field. According to [10], the octree-based algorithm used to compute the distance field takes a O(n3 lg n3 ) time complexity where n is the dimension of 3D grids (the number of division along certain axis of the grids) around the character model [7]. That is, the computational of the distance field is very time-consuming. Moreover, the distance-to-body value on z-ray at certain ( x, y) corresponds to several z-values, and it will make the garment surface reconstructed through the distance field rough. Because the distance field is restricted by the two problems mentioned above, we modify the computation of distance field to make it more appropriate to garment modeling. The modification of distance field computation establishes a reference model of virtual character, in which only the distance along z-axis is considered. The modification of distance field computation is defined as 4 steps: 1). Compute the outline of the view
3.2: Computation of the offset of the garment When users finish their drawing, a closed contour line and the breakpoints of it are computed. Then we could compute the offset values of all the garment grids as follows: First, we should position all the segments of contour in 3D space, according to the relative position between the contour and the outline of the orthogonal views (which is computed in the computation of distance field) of the character. The algorithm used is described as follows: 1). The breakpoints are positioned in 3D space according to their 2D position in xy-plane. There are two types of position for certain point in 2D, inside the outline or outside the outline. If one breakpoint is inside the outline, it is assumed to be on the surface of the character, which means the distance-to-body value of the point is 0, and its z-value is assigned to be the body’s z-value which can be computed through the distance field. Otherwise, if the breakpoint is outside the outline, its z-value is assumed to be the same as the nearest point of outline,
207
Authorized licensed use limited to: Nanjing University. Downloaded on December 19, 2009 at 10:57 from IEEE Xplore. Restrictions apply.
those of it’s ‘I’ or ‘B’ orthogonal or diagonal neighbors. The iterations stop when the maximum difference between values obtained after two successive iterations are under a threshold, or if a maximum number of steps have been reached.
and the distance-to-outline value can be computed through distance field too. 2). All the segments of the contour are classified into two types: silhouette and borderlines. If the segment crosses the outline of the orthogonal views of the character, it is a borderline; otherwise, it is a silhouette line. 3). After the segments of the outline are classified, the xy-plane is divided into N × N grids, and the boundary of the grids is aligned by the coverage of garment contour, then the segment is re-sampled according to the grids, as shown in Figure.2. 4). The distance information and z-values of sample points are computed according to the two breakpoints at the extremities of each segment. For each silhouette line, we interpolate the z-values linearly along the edge between two breakpoints, and the distance-to-outline value can be bilinear interpolated through the distance field. For each borderline, the distance-to-outline values are interpolated first. The z-values of the sample points inside the outline of orthogonal views of the character can be computed directly through the distance field and for the sample points outside the outline, the z-values are interpolated linearly by the z-value that has been computed.
3.3: Distance field stretch and garment surface construction After the offset values have been computed, we should compute z-values of all the garment grids. By using bilinear interpolation from a distance field, we can get each grid’s z-value in real time. The z-values of garment grids are computed as follows: 1). the distance field should be stretched to fulfill the garment area so that we can use offset to compute all the z-values of the garment grids directly. For each human body, we can divide it into four limbs and a body, and we should stretch the each part of human body away from their skeleton to make the distance field stretched. Here we use a simple method to achieve this approximately. According to Figure.4, the human body is divided into 3 sections by explicit indication. In section 1, the distance field is stretched along horizontal direction, and in section 2 and 3, the distance field is stretched along vertical direction. For example, for some distance field grid ( x0 , y0 ) in section 1, the position after stretch will be ( x ', y0 ) , x ' = widthc × ( x0 − midx) / widthd + midx , where widthc is the width of garment contour on line y = y0 , widthd is the width of human body on line y = y0 , and midx is the middle x-value of the human body along the line. In section 2 and 3, the distance field is stretched along y-axis by the same method.
2. Divide grids and re-sample contour segment
Second, the distance-to-outline value should be propagated from contour to the interior grids of the garment. The propagation is done as follows: 1) We use the xy-plane grids nodes those inside the outline of orthogonal views of the character to represent the mesh nodes of the garment, so first we should classify the 2D grids into three types: ‘in’ (I), ‘border’ (B), ‘out’ (O). The ‘I’ grids are inside the contour, the ‘O’ grids are outside the contour, and the ‘B’ grids intersect with the contour. The classification is shown in Figure.3.
4. Stretch direction
2). for each grid of the loose part of the garment, a degeneration coefficient is computed. The degeneration coefficient represented the distance from outer point to the mannequin, and should be in the range of [0,1] . The degeneration coefficient is defined as follow: λ = diso /(diso + dism ) , where diso is the distance from outer point to garment contour and dism is the distance from outer point to the outline of the projection of human body. 3). for each garment grid outside the outline of the projection of the human body, the final offset value
3. Classification of 2D grids
2) The distance information of the silhouette and border lines which have been computed above are assigned to the ‘B’ grids, and the ‘I’ grids are initialized to the average value of the distance values around the contour. 3) Then the distance information is propagated the ‘I’ grids through several iterations. For each value, it will be recomputed as an evenly weighted sum (with coefficients summing to 1) of its current value and
208
Authorized licensed use limited to: Nanjing University. Downloaded on December 19, 2009 at 10:57 from IEEE Xplore. Restrictions apply.
is modified to dis ' = λ × dis , where λ is the degeneration coefficient of the outer points, and the z-values of all the ‘I’ grids can be computed by bilinear interpolation using the degenerated offset values. 4). a constrained Delaunay triangulation is performed on the contour and the ‘I’ grids to obtain the 3D model of the garment.
process. When the distance field has been computed, its resolution is irrelevant with the process of computing the offset of the garments surfaces. The number of grids is relative in some steps in our method, such as iteration of the distance information and z-values, and the process to computing the z-values of each grid. But all these steps takes a time complexity of Ο (1) for each grid, so as the number of grids increases, the time of modeling increases slowly, and even when 50 × 80 grids are used the total time of modeling is in 2 seconds.
4: Experiments and discussion There are some examples constructed by our method as shown in Figure. 5, the garments are drawn in several seconds, and users obtain the 3D garments model in less than one second each. As the examples shown below, the garments surfaces adapted the underlying form of the character model and exactly constrained by the sketches.
(a) Mini skirt
(a) Sketch-based trousers generation
(b) Close-up of the mini skirt
(b) Sketch-based shirt generation
(c) Loose shirt
5. Examples of sketchy garment generation
Figure.6 shows two examples of loose garment constructed by our method. Figure.6(a) shows a mini-skirt in which most region of the garment sketch has no “z-overlap” with the mannequin, and Figure.6(c) shows a loose shirt which has an inflated waist in the middle of the shirt. Figure.6(b) and 6(c) shows the close-up of the loose part of the garment from three different views. The examples shown in Figure.6 proved that our method works well in these two types of garments, and the loose part of garment has been constructed smoothly and fitted the shape of human body. We do some experiments to valid the fidelity and the computing time of the proposed method also. In our experiments, the character model we used has 4006 triangular facets, and the distance field is 128 ×128 , the grids divided in xy-plane are 30 × 30 . As mentioned in Section 2, when a 128 ×128 resolution of distance field and 30 × 30 2D grids are used for the character model, we find trade-off between the fidelity of the garment surface and the computation time of the method, so that we get a garment surfaces with considerable fidelity from a 2D sketch in real time. The time related to the two parameters configured by users mentioned above is not crucial in the modeling
(d) Close-up of the loose shirt 6. Examples of Loose Garment Construction
The distance field’s computation we modified for the garments modeling takes a time complexity of Ο ( n 2 lg n 2 ) , while the time complexity of distance field’s computation is O(n3 lg n3 ) . With the same resolution, the distance field that isn’t modified takes much more time to be computed. In our experiments, the character model we used in our experiments has 2500 vertices and 4000 triangular facets, and the computation of a modified distance field with the resolution of 128 × 128 based on the character model takes a time around 20 seconds, which is considered to be within expected duration. The distance field with the same resolution, which isn’t modified takes more than an hour to be computed with an octree-based algorithm, even a 32 × 32 × 32 distance field takes hundreds of seconds to be computed. The time costs of two types of computation are shown in Table.1 below,
209
Authorized licensed use limited to: Nanjing University. Downloaded on December 19, 2009 at 10:57 from IEEE Xplore. Restrictions apply.
experiment results prove that the proposed method can generate a garment surface constrained by sketch and adapted the underlying form of character model, and the process can perform in real time. There are also several drawbacks of our method. The sketch-based interface is not enough convenient for freeform sketch, and only one closed contour line is available now. We would like to allow users to sketch garment contour in more freeform style, and some gesture can easily add into the interface to make it more convenient.
with the resolution of 128 × 128 and 32 × 32 × 32 respectively: Table 1. Comparison of computation time of DF Facets Number
228
2576
4006
34684
Modified DF cost (s)
14.562
18.267
20.031
67.797
Original DF cost (s)
33.204
198.15
574.32
>5000
As shown in Table.1, when the complexity of character model increases, the time cost of modified computation of distance field increases slowly, while the other increases quickly. So the modification of distance field computation makes our method more general when different character models are used. In our method, the primary computational complexity of modeling garments on a character is to compute the z-values of the grid nodes inside the contour according to their distance information. If no accelerative methods are used, we will have to travel the whole character model to find the z-value of certain garment node. The operation of traversal of the whole character takes the time complexity of Ο(m) (m indicates the number of facets of the character model), and it is time-consuming so that users can nearly get the feedback from their sketch in real time, while the computation time of modeling with distance field is almost in real time. Table.2 shows the comparison of modeling time with the 2D grids divided in xy-plane is 30 × 30 . The third line shows the time cost without distance field but use the simplified distance from 3D points to the vertices of the characters to instead the distance from 3D points to the facets of the characters, which time cost shown in the third line. The simplified distance can reduce the time cost, but the fidelity of the garment surfaces will reduce a lot. By introducing a distance field, we can model a garment surface with considerable fidelity in real time. Table2.The comparison of modeling time Facets number
228
2576
4006
34684
Modeling With DF (s)
0.266
0.493
0.697
1.732
With simplified distance(s)
0.541
1.158
1.916
8.834
Without DF (s)
4.232
8.927
17.244
68.793
Acknowledgement This paper is supported by the grants from the National 863 project of China [No. 2007AA01Z334], the National Natural Science Foundation of China [Grants No. 69903006 and 60373065] and the Program for New Century Excellent Talents in University of China [Grant No. NCET-04-04605]
References [1] Hinds B., McCartney J.: Interactive garment design. The Visual Computer 6(1990), 53-61 [2] Bonte T., Galimbertia., Rizzi C.: A 3D graphic environment for garments design. Kluwer Academic Publishers, 2002, pp. 137–150. [3] Zeleznik R. C., Herndon K., Hughes J. F.: Sketch: An interface for sketching 3d scenes. In Computer Graphics Proceedings, SIGGRAPH’96 (New Orleans, Louisiana, August 1996), Annual Conference Series, ACM. [4] Igarashi T, Matsuoka S, Tanaka H: Teddy: a sketching interface for 3d freeform design. In: Proc. of the 26th annual conference on Computer graphics and interactive techniques (1999), ACM Press, pp. 409–416. [5] Igarashi T., Hughes J. F.: Clothing manipulation. In Proceedings of the 15th annual ACM symposium on User interface software and technology (2002), ACM Press, pp. 91–100. [6] Decaudin P, Julius D, Wither J, Boissieux L, et al.: Virtual Garments: A Fully Geometric Approach for Clothing Design. Computer Graphics Forum, 2006 [7] Turquin E, Cani M P and Hughes J: Sketching Garments for Virtual Characters. Proc. Eurographics Workshop Sketch-Based Interfaces and Modeling, Eurographics, 2004, pp. 175-182. [8] Turquin E., Wither J., Boissieux L., Cani M.P.: A Sketch-Based Interface for Clothing Virtual Characters. IEEE Computer Graphics and Applications, 2007, 72-81 [9] Sud A, et al., DiFi: Fast 3D Distance Field Computation Using Graphics Hardware, Eurographics 2004, Volume 23 (2004), Number 3, pp557-566. [10] Mark W Jones and Richard Satherley: Using Distance Fields for Object Representation and Rendering, Dept. of Computer Science, University of Wales Swansea United Kingdom SA2 8PP March 12, 2001 [11] Canny J.: A computational approach to edge detection, IEEE Trans. on PAMI, 8(6), pp679-698, 1986.
5: Conclusions and future work This paper presents a method to reconstruct a 3D garment model from a sketchy garment contour, there are three features with our method: firstly, a reference model of 3D human is established by restricting the direction of the distance field (only direction along z-axis is considered), and it makes the computation of distance field much easier; secondly, an efficient mapping from 2D sketch to 3D garment is established by using the relative position between sketched garment contour and the outline of human projection; thirdly, the 3D garment model is constructed according to the mapping between garment grids and the grids of human model, and it ensure that loose part of garments can be constructed correctly. The
210
Authorized licensed use limited to: Nanjing University. Downloaded on December 19, 2009 at 10:57 from IEEE Xplore. Restrictions apply.