• 沒有找到結果。

CHAPTER 1 Introduction

1.3 Thesis Organization

The rest of this thesis is organized as follows. In chapter 2, we introduce some background knowledge for cloth simulation and wavelet transform. In chapter 3 there are some related works about integration method and adaptive mesh proposed before.

In chapter 4, we explain the combined algorithm for integration. Chapter 5 has our new approach as content, including process of segmentation and interpolation to save times. Then experimental results of our system are shown in chapter 6. Finally, chapter 7 is the conclusions and future works.

Figure 1.1 The System flowchart

CHAPTER 2 Background

In this chapter, we introduce the background knowledge of real-time cloth simulation and wavelet transform. We simulate cloth as a deformable object because it folds and wrinkles easily for out-planes forces. But on the other hand, cloth has large strain and stress under in-plane forces. Moreover, in real-time simulation, we have to compute the result efficiently. But modeling fabrics as a traditional continuum and employing finite element method (FEM) has drawbacks. This approach needs a very fine mesh or high resolution.

2.1 Mass-Spring System

There are many different approaches to simulate cloth. Mass-Spring system is one of them which are efficient and easy to implement. It was widely-adopted for real-time cloth simulation recently. We assume a piece of cloth as a group of arranged nodes. Then, we apply springs between nodes to produce and propagate internal forces. Since forces between nodes can be classified into three types: stretch, shear, and bend, as shown in Fig 2.1.

Figure 2.1 Three representations of internal forces

We also add springs in three ways of connection to simulate these forces, as shown in Fig 2.2.

Figure 2.2 Structure of mass-spring system

When simulation, we use Hooke’s law to calculate spring forces between nodes:

x k F = −

For common simulation, we first integrate spring forces as internal forces

stretch shear bending

according to spring length. Then, we use these forces to compute velocities and positions of each node for the next render.

2.2 Wavelet Transform

Wavelet transform is widely used in digital signal processing for many years.

Wavelet transforms are classified into discrete wavelet transforms (DWTs) and continuous wavelet transforms (CWTs). CWTs operate over every possible scale and translation whereas DWTs use a specific subset of scale and translation values. In our approach, since the dimension of cloth is an integer, we use the discrete wavelet transforms.

The Haar wavelet is the first known wavelet and was proposed in 1909 by Alfred Haar. It is also the simplest possible wavelet. The disadvantage of the Haar wavelet is that it is not continuous and therefore not differentiable. The Haar wavelet finds averages and differences between samples repeatedly. For a two-dimensional array of values, we can perform a 2D Haar transform by first performing a 1D Haar transform on each row, and then on each column.

Since the Haar wavelet transform is fast, simple, and does not occupy extra memory space, we chose it for building the hierarchy structure in our approach.

CHAPTER 3 Related Works

3.1 Integration Method

In this chapter, we introduce related works about numerical integration method used in cloth or deformable object simulation. All useful methods should be convergence, which means, that for time slice h → 0, the numerical solutions meet the analytical. Besides, accuracy, stability, and efficiency are also the necessary characteristic of a good solution.

Additionally, we can take advantage of adaptive mesh to make simulation more flexible. By refining or simplifying part of the mesh in different situation, we can both have coarse mesh to get efficiency, and delicate one to get detail accuracy.

3.1.1 Euler Method

The oldest and most simple method of integration is the so called forward or explicit Euler method, used by Carignan et al. [4]. This method computes the state of the next time step out of a direct “extrapolation” of the previous states using derivative evaluations. Thus it has high efficiency, but not accurate comparing with Implicit Euler method.

Implicit simulation methods are currently widely used in applications involving garment simulation, from real-time animation systems in Virtual Reality applications [5] [11] [13] to accurate garment simulation for design and prototyping applications [17]. They were introduced by Baraff et al [1] in the field of cloth simulation. Stability is the most advantage of this method. Simulation errors, which usually break the stability of explicit integration methods, only appear there as a form of “numerical damping” that does not prevent convergence to equilibrium. Therefore, we can use larger simulation timesteps and decrease computation times as a result.

Many different implicit method are now available for cloth simulation, they are differ in complexity, accuracy, and stability. The most widely-used method is approximated implicit Euler method [1, 5, 11, 13]. Since in implicit method, to simulate a cloth object with N mass-points, we have to compute an N×N matrix H for each time step, but Hij is 0 when the i-th and the j-th mass-points are not linked with a spring. Thus, implicit method can be approximated by computing only non-zero elements of the matrix.

Desbrun in [13] splits the forces acting on a node into two parts, the linear one and nonlinear one. The linear part is easy to integrate, while the non-linear force just rotate without varying in magnitude. Thus, in order to preserve momentum, it also needs to correct linear and angular momentum additionally. However, in [10], Cho and Choi simplified the formula of velocity change directly, and makes the model working in O(n) times with high stability.

3.1.2 Verlet Method

e.g. by collision response or use input lead to instabilities. To cope with this, Desbrun [13] proposed to correct the velocities by position change after each time step. The effect of this correction is that the velocities are given only by the particle positions and forces at that time. So changes in position directly affect the velocity of the next time step, therefore increases the stability. This integration scheme is equal to the Verlet integration [15] which updates the position without computing any velocities.

This method has been very popular in molecular dynamics for decades and has recently been proposed in the context of physically-based simulation of cloth [7, 12]. Although Verlet method may not have credible accuracy, it has advantages of stability and efficiency for its brief formula.

3.2 Mesh Adaptation

Physical accuracy of mass-spring system is lower than that of deformable models using Finite Element Methods (FEM) for its coarse sampling. However, FEM requires solving a large sparse system which results in incompatible with real-time applications. Some previous work uses LOD (Level Of Detail) to locally refine a deformable model in regions of interest. Most of them concentrate on how to build reversible hierarchy structure to manage varying mesh topologies, and algorithms about polygonal refinement.

Mass-spring structure will produce inaccurate results if too coarse a mesh is employed, especially when collision occurs. Hutchinson et al. [8] represent a piece of draped cloth by adaptive mass-spring model which refines the regions of high

curvature. Their approach first finds the point which has inaccurate position. Between each node linked to the inaccurate one, new points are activated and new masses are introduced. Choi and Hong [2] refine meshes locally using surface wavelet to reduce the computational effort while ensuring a same global behavior for the deformable object as shown in Fig 3.1. Volkov and Li describe a general method which can be used with a variety of regular refinement rules [16]. This approach costs less time for the whole simulation which includes hierarchy construction and destruction as mesh adaptation. However, it still can not reach the speed as interactive or real-time simulation.

Figure 3.1 Triangular subdivision in [14]:

(a)Initial face of j-1 level (b) the new mesh created by splitting step (c) the mesh of j level created by the averaging step.

Totally, in contrast to these approaches which refine the regions of high curvature, our method tends to rebuild the hierarchy every time and down-sampling regions of the mesh to save computation. Because our method does not change mesh topologies, taxing operations to update and reverse the hierarchy representation, which needs frequent disk access, is unnecessary.

(a) (b) (c)

CHAPTER 4 Fast and Stable Integrator

In this chapter, we introduce our new integrator from combining approximated implicit Euler method and verlet method, in order to get higher stability for real-time simulation.

4.1 Approximated Implicit Euler Integrator

4.1.1 The explicit method

A simple straight-forward approach for cloth simulation is using the explicit Euler integration: mass-point at time t, and h denotes the time interval between simulation steps. By this (1)

simple method, we can easily calculate

x

ti h

+ , the location of the i-th mass-point at the

next time step t+h with current state values

x

ti,

v

tiand

F

ti.

However, this simple integration scheme can not be applied to cloth simulation unless the time step h is very small, because the explicit method becomes unstable easily when the stiffness (as spring constant) is increased. This unstable problem is revealed from the assumption of the fixed forces during the time interval between the current simulation and the next simulation. Therefore, the explicit method is not an appropriate integration model for the real-time or interactive cloth animation systems which require very large time steps to achieve fast animation.

4.1.2 The implicit method

In consideration of stability and accuracy, it is generally regarded that the implicit method is a much better choice for the fast simulation of cloth.

With the implicit Euler method, the updated formula can be rewritten as follows:

i

simple change enables unconditionally stable integration [16][17].

The implicit method involves

F

ti+h, which cannot be calculated at the current step. However,

F

ti+hcan be approximated by a first-order derivative:

(2)

where Fi,t denotes the internal forces consisting of all the internal forces Fit, on the i-th mass-point (i.e.F =t [F1t,F2t,...,Fnt]T), and similarly, ∆xt =[∆x1t,∆x2t,...,∆xtn]T.

4.1.3 The time-consuming matrix computation

x can easily be updated with Eq.3. Therefore, the simulation can be reduced to finding the value of∆

v

t+h. After ignoring

hHv

t as viscous forces, Eq.3 can be written

However, the critical problem is that Eq.4 involves

4.1.4 Approximation method for efficiency and stability

(4)

(5)

Desbrun [13] approximated the Hessian matrix H by spitting the spring force into two

However, the inverse matrix of

is not necessarily a sparse matrix,

even though

is sparse. Thus, the calculation would require O(

n

2) times

as long as the settings are changed.

The velocity change of the i-th mass-point can be updated by considering only the linked mass-points, because Hij is 0 when the i-th and the j-th mass-points are not linked to a spring. Therefore, Choi [10] proposed another approximation scheme.

If i≠j (6)

i denotes the number of mass-points that are linked to the i-th mass-point, the Hessian matrix can be written as Hij=kand Hii=kni from Desbrun in [4]. The update formula was written as follows:

i leapfrog or Stoermer-Verlet method, which uses centered differences at a staggered grid to derive results.

(7)

(8)

(9)

Figure 4.1 Staggered grids for the Verlet method

Assume that we now approximate v at t+(2i+1)h/2 and x at t+ih by centered differences as shown in Fig 4.1:

i

Then substitute Eq.12 into Eq.13 resulting in the second order centered difference

i

from previous position and forces but velocities. If the velocities are in need for collision detection, it can be compute easily from position differences in the time interval. As described in [7], the Verlet integration scheme is one of the best choices for problems with low or no damping because of efficiency, stability, and accuracy.

4.3 Combine the Integration Methods

Since both approximate implicit method and Verlet method are stable and efficient, we try to merge them and result in a suitable integrate scheme for our multi-level system.

4.3.1 Position Change Calculation

As the common integrate scheme, when

∆ v

ti+h has been determined,

v

ti+h

and

x

ti+h are also available from Eq.1. However, because our system changes node positions directly that may cause spring shivering especially with high stiffness. We need more stable method to compute positions and ease the effect of interpolation.

Since Verlet method has high stability for cloth simulation, we want to take advantage of this method and provide advance in numerical integration. However, what the point of Verlet method is that velocity change is not necessary to be calculated. Additionally, if we use only the Verlet method as integration, our system will not simulate correctly, because the vertex position in consideration may be unreliable after interpolation. In order to merge

∆ v

ti+hfrom approximate implicit method, we substitute Eq.1 into Eq.15 and then yield:

) new idea. After calculating

∆ v

ti+h approximately, we did not use it to calculate new positions directly. However, we leave it for the next time-step simulation, and update position with current velocity using explicit Euler method, because errors of position from interpolation should not affect other nodes in the next time step. On the other side, position change after interpolation may not be reliable, so we can not calculate velocities from current position. Therefore, the velocity change

∆ v

ti+h is used to update next time-step velocity, which will also be used to calculate position in the next simulation. With this modification, our system has higher stability when normal difference threshold increased. The simulation results show the enhancement in Fig 4.2.

Figure 4.2 (a) Use approximate implicit method only (b) After our modification from verlet method

(16)

(a) (b)

method to correct the velocity in each simulation by

h

x v x

h t i t t i i

=

However, in our system, positions are possibly to be interpolated directly, and errors caused by interpolation should not effect the following simulation. Since the position change may not follow physical principles, it is better to use velocity approximated previously than calculate from positions as in Eq.17.

Therefore, our integration method was complete for multi-level interpolating system. Even under large time step and stiffness, our simulation remains stable and efficient.

(17)

CHAPTER 5

Speed Up by Segmentation and Interpolation

This chapter introduces another contribution about multi-level interpolation. First, we use wavelet transform to built hierarchical structure of the cloth object, and traverse it to find regions which are suitable for interpolation. Then the rest node without being interpolated will be calculated accurately by numerical integration. By this approach, we do not need to do any integration for each particle, and save time with interpolation instead.

5.1 Segmentation Use Wavelet Transform

In original, since cloth has bending forces and limited buckling as a result, regional surface with low or zero curvature should be possibly and frequently appear during cloth simulation. Therefore, we want to find segments like this and thus we can use interpolation to get approximate position for these nodes. The segmentation must meet these requires:

samples, while cloth object in simulation is a fine mesh for good visual quality. In order to compatible with our real-time system, the segmentation method must not cost too much times.

2. Nodes in the same segment must be connected: If segment element as nodes are separate one from another, interpolation can not performs efficiently and have more complexity if some elements are connected.

3. Not all of the nodes should be classified into a segment: There are still nodes may have high curvature with neighboring ones. For these element, we should calculate position for them accurately.

From above, many traditional segmentation methods do not meet these characteristics.

We use wavelet transform to reach the purpose, which is simple and fast.

The Harr wavelet is the earliest wavelet and its transform is simple to implement.

Basic 2D image compression method is based on Haar wavelet transform. Only averages and differences are needed to be calculated to construct higher level. Small differences will be ignored as 0, and only notable part remains. The structure after transform is closed to a hierarchy tree. Mesh vertices represent as leave node, and each parent node has its child leave nodes connected. Therefore, from traversing the tree, we can easily find connected segment for interpolation. If traverse goes to the leave nodes, their position should be calculated accurately.

For the cloth object, we choose 2D wavelet transform to build the hierarchical structure. Because what we want to find is a continuous region, and 1D transform will lost the particle topology information about rows and columns. Fig 5.1 shows leveling relation of 2D wavelet transform.

Figure 5.1 2D wavelet transform in hierarchy

When local surface is closed to flatness, normals between neighboring nodes will have small differences in direction. To analysis degree of surface flatness, we take normal of vertices to do wavelet transform, thus each higher level has average normal and normal differences between average normal and vertex normal of lower level.

Therefore, the normal differences information can be use to determine if the region is suitable for interpolation as shown in Fig 5.2.

Figure 5.2 Normal differences

depth-first order and determine if the region can be interpolated for approximation.

Once the value of a tree node is smaller than the threshold, traverse no any child node.

5.2 Interpolation of Particle Positions

When the normal differences of a region are small, it is suitable for interpolation.

Our interpolate scheme is simple in order to save more time. However, if we use interpolation for all nodes within the region, it will result in hackly configuration full of flatness. When two interpolated regions share the same edge, definitely it is not proper to use interpolation directly. What should be done first is finding correct position of the edge, and then interpolating nodes within. Steps are shown below.

1.Calculate the accurate position of the node on the edge of the region, as show in Fig 5.3.

Figure 5.3 Preprocessing of interpolation

2.Use bilinear interpolation to fill positions of internal nodes, as show in Fig 5.4

Figure 5.4 Interpolate internal nodes

As we use 2D wavelet transform, normal differences between rows and columns are available individually. This makes the system be able to do bilinear interpolation with different weights in rows and columns. For example, if normal differences between nodes in the same row are smaller than those in the same column, row interpolation will have higher weight when averaging with column interpolation.

5.3 Following Benefit

Except time saving, interpolation also brings another enhancement in stability and accuracy. In mass-spring system, as shown in Fig 5.5, forces are propagated by springs iteratively for a couple of simulations. Over-length springs due to rapid forces usually make integration fail, or produce inaccurate visual results with too much flexibility. In order to correct the elongation, position-based and velocity-based corrections are proposed. However, both of them cost too much for iteratively operation, and may effect or be effected by collision response. For the same purpose, bilinear interpolation here also provides correction in spring length as shown in Fig

For another aspect about bending forces, our interpolation method also provides help. There existing a problem in mass-spring system that when connected polygons bend in a small angle, as shown in Fig 5.7, bending forces will cause nodes moving in deflective direction. Many proposed approaches aim to this disadvantage and tried to solve it. However, that usually costs too much time for accurate result. With our method, the polygons will be possibly chosen for interpolation for its small cross angle, as shown in Fig 5.8. Therefore, our approach will prevent part of nodes from

For another aspect about bending forces, our interpolation method also provides help. There existing a problem in mass-spring system that when connected polygons bend in a small angle, as shown in Fig 5.7, bending forces will cause nodes moving in deflective direction. Many proposed approaches aim to this disadvantage and tried to solve it. However, that usually costs too much time for accurate result. With our method, the polygons will be possibly chosen for interpolation for its small cross angle, as shown in Fig 5.8. Therefore, our approach will prevent part of nodes from

相關文件