<H1>5. Fitting</H1>
        The key question of how well a given model describes a particular piece of cloth is answered by fitting the model to the measurement data: adjusting its parameters to minimize the difference between the model’s predictions and the measured behavior, both in position and force. We do this by solving an optimization problem, leveraging that the cloth is at static equilibrium at the measured configurations. In principle all parameters of a cloth model can be fit to a sufficiently rich single deformation sequence, but this can result in a problem fraught with local minima. In order to achieve stable fits, we have designed an incremental optimization procedure that fits model parameters a few at a time using the isolated deformations described in Section 3.2.
      
      
        <H2>5.1. Optimization Problem</H2>
        For each different cloth sample, we have created a simulated replica with the same mass, uniformly distributed, and the same 100mm square geometry, discretized with a regular 25 × 25-node mesh, connected either with springs or with quadrilaterals split into triangles, depending on the model. In each measurement sequence, a different set of nodes is fixed to rigid bodies representing the clips. For the bending measurement sequences (see Figure 4 ), we fix all cloth nodes above the edge of the table. The measured pulling forces of the cords are applied as point forces on the rigid bodies at known locations, with known magnitudes and orientations. Given a set of captured static deformation frames, we wish to know the (nonlinear) stress-strain curves for the deformation components of a cloth model, such that a simulated cloth matches known positions and forces as well as possible. Specifically, we minimize the weighted error of cloth positions and clip forces over a sequence of measurement frames, subject to the constraint of static equilibrium on all frames. For the formulation of the objective function, we concatenate in vectors the positions, x n , and the net forces, F n , of free cloth nodes at all frames, as well as the forces, F c , applied by the cords on the clips. Due to equilibrium, the net force on the clips, produced by cord forces, gravity, and forces from fixed cloth nodes, must be zero. We indicate with x n and F  ̃ c , respectively, the known cloth node positions and clip forces, measured as described in Section 3. We also concatenate in a vector k the (unknown) stiffness values at the control points of the nonlinear stress-strain curves for the deformation components of the cloth. Since the pieces of cloth are homogeneous, we use a single curve for each deformation component for all frames and all cloth elements. Then, the computation of model parameters based on the minimization of position and force errors subject to the static equilibrium condition can be formulated as the following nonlinear constrained least-squares problem: k = arg min μ x n (k) − x n 2 + λ F c (x n , k) − F  ̃ c 2 ,
        
          6
          s.t. F n (x n , k) = 0.
        
        In this optimization problem, we use the measured clip positions, x c , as known boundary conditions. For stretch tests, the objective function is based only on clip forces, i.e., μ = 0, λ = 1, while for bend tests it is based only on cloth positions (since there are no measured forces), i.e., μ = 1, λ = 0. For shear tests, the objective function is based only on clip forces parallel to the direction of the clips themselves. We observed that, in situations of near-homogeneous shear, the clip-parallel forces are dominated by shear, while clip-orthogonal forces are dominated by stretch. Then, by fitting only clip-parallel forces we reduce the sensitivity to potential errors in stretch stiffness. The optimization problem contains two unknowns: the parameter vector k and cloth node positions x n . We solve the optimization in an iterative manner, refining k and x n separately on two nested loops. In an outer loop, we refine k by local minimization of the error function and, in an inner loop, we recompute x n to satisfy the equilibrium constraint. Outer Loop. Assuming cloth positions that satisfy the (nonlinear) equilibrium constraints on all captured frames, we locally linearize those constraints w.r.t. both k and x n . As a result, we obtain a linear expression that relates node positions to parameter values:
        
          7
          −1 ∂F n ∂F n ∂F n ∂F n ∆x n + ∆k = 0 ⇒ ∆x n = − ∆k. ∂x n ∂k ∂x n ∂k
        
        We also locally linearize clip forces,
        
          8
          ∂F c ∂F c ∆F c = ∆x n + ∆k, ∂x n ∂k
        
        and we turn (6) into a linear least squares problem, which we solve to refine the parameters k(i + 1) = k(i) + ∆k, with: −1 ∆k = arg min μ x n (i) − x n − ∂F n ∂F n ∆k 2 + ∂x n ∂k
        
          9
          −1 λ F c (i) − F  ̃ c + ∂F c − ∂F c ∂F n ∂F n ∆k 2 . ∂k ∂x n ∂x n ∂k
        
        We terminate the outer loop (and hence the overall optimization) when the residual is reduced by less than 1% between two consecutive iterations. To ensure convergence of the Newton-like iterations and to enforce non-negativity constraints on the components of k, we execute a line search from k(i) to the solution of (9) if the residual grows or if the solution violates some constraint. The solution to the linear least squares problem requires solving a system Ak = b, where the size of A is given by the number of unknown stiffness values, |k|. In our test examples, this number was always below 10, and we solved the linear systems using LDL factorization. The formulation of A, on the other hand, requires solving |k| linear systems of type ∂F n y = b, which ∂x n we did using the conjugate gradient method. Inner Loop. Once the parameter values k(i + 1) are refined, we bring the cloth to a static equilibrium position, x n (i + 1). We do this by solving quasi-static simulations until convergence on all captured frames, starting always from the measured configuration x n and using the measured clip positions x c as boundary conditions. We consider that a piece of cloth has converged to equilibrium when F n &lt; 10μN. The quasi-static simulations involve linear-system solves with the cloth stiffness matrix ∂F n . We found that, during inter∂x n mediate iterations, the stiffness matrix may not always be well conditioned, therefore we have solved the quasi-static equilibrium problems using additive Levenberg-Marquardt, which effectively produces a modified stiffness matrix of the form ∂F n + μI. For improved conditioning, we also use this ∂x n modified stiffness matrix in the outer loop.
        c 2012 The Author(s) c 2012 The Eurographics Association and Blackwell Publishing Ltd.
        Miguel et al. / Data-Driven Estimation of Cloth Simulation Models
      
      
        <H2>5.2. Incremental Parameter Fitting</H2>
        The nonlinearity of cloth deformation, together with the complex interplay of various deformation components in the resulting forces and positions, make the optimization problem above extremely complex in the general case, prone to falling in local minima and sensitive to initialization values. However, we largely alleviate these issues with the design of the five isolated deformation measurements described in Section 3.2, which allow us to separately fit stiffness curves for the six deformation components described in Section 4.1, following an incremental parameter fitting procedure. First, we fit in parallel the weft-stretch stiffness curve, k s,u (ε s,u ), for the weft-stretch sequence, and the warp-stretch stiffness, k s,v (ε s,v ), for the warp-stretch sequence. We ignore shear and bend parameters for stretch fits, as we have observed that they have little effect. Second, using known stretch stiffness curves, we fit the shear stiffness k s,uv (ε s,uv ), for the shear sequence. Third, we fit in parallel the weftbending stiffness k b,u (ε b,u ), for the weft-bending measurement sequence, and the warp-bending stiffness k b,v (ε b,v ), for the warp-bending sequence. Finally, we fit the diagonalbending stiffness curve k b,uv (ε b,uv ), using both weftand warp-bending measurements. To better account for crossinfluence of shear and bending, we use their estimated values as initial guesses and run another fitting iteration. To fit each stiffness curve k i (ε i ), we iteratively subdivide the Hermite spline adding more control points until the residual error function (6) is reduced by less than 1% or a speci- fied maximum number of points, usually 4 or 5, is reached. First, we evaluate the strain histogram for the corresponding measurement sequence, and we determine maximum and minimum strains after removing outliers. We initialize the stiffness curve with one control point (i.e., constant stiffness), and subsequently we subdivide the strain range with equidistant control points.
        10 cord 1 8 cord 2 (N) 6 cord 3 cord 4 tension 4 2 0 0 2 4 6 8 10 12 14 stretch (%)
        
          Figure 6: Raw force measurements for X stretching in Sample #18. Cloth is held by two bar clips, with two cords attached to each clip.
        
      
      
        