• 沒有找到結果。

Chapter 5 Collision Detection and Response

5.2 Contact Force

Rather than impulse-based methods, force-based methods are easier to couple two system in different mechanism because interaction can be model as a force applied to each objects. After a particle is projected out of the rigid object, the particle should also push the rigid object back. This is completely based on the Newton’s third law: for every action there is an equal and opposite reaction. Then the magnitude and direction of the contact force should be calculated. There are three explicit methods to estimate the contact force.

First method is very trivial. It re-calculates the composition of forces for the particle after projecting and uses the sub-force which normal to the contact face as the contact force. As shown in Fig 5.10, F is the composition of forces such as spring force from mass-spring system, gravity, friction or other external force. If is the normal vector of the contact face, sub-force F can be calculated by following equation.

F =

(

Fnˆ

)

nˆ (5.7)

Then F is used as a contact force acting on the rigid object. This estimation is simple but inaccurate because it does not consider the change in velocity of the particle.

However, this estimation actually works for a coarse contact resolution.

Figure 5.10: Sub-force Fis used as contact force

The second method takes velocity into consideration. In physics, energy transfers from one to another by a force. After projecting the particle, the kinetic energy of the particle may be changed, either gained or lost. If an external work W acts upon this particle, it causes the kinetic energy of particle to change from Ek1 to Ek2.

2 1 2 1

If this external work is done by an external force along a path, the work can be defined:

where C is the path or curve traversed by the object, Fv

is the force vector and sv is the position vector. Force can be assumed constant and path can be assumed to be a line in discretized time step simulation so that the work can be simplified to:

W =Fv⋅dv (5.10)

where dv

is the movement of the particle in this time interval.

Figure 5.11: Particle and rigid object have same velocity direction

As shown in Fig 5.11, the particle moves from outside to inside of the rigid object, and then is projected out of the rigid object. First from Fig 5.11(a) to Fig 5.11(b), the velocity of the particle changes from vn to vtemp by external forces such as spring force and gravity except contact force. Because of the projection, the particle is moved out of rigid object and velocity is modified to the velocity of rigid object on the contact point. In conclusion, the velocity of particle changes from vn to vc by composition of forces, including contact force, working along a distance of d. The energy equation can be written as following.

Simply speaking, the sub-force of Fall which is parallel to d changes the kinetic energy of the particle and the sub-force of Fall which is perpendicular to d should be zero.

Base on these equations the contact force Fc can be calculated. However, this method underestimates the contact force in a situation illustrated in Fig 5.12. This property which comes from the scalar equation is inaccurate but can prevent system from divergence.

Figure 5.12: Particle and rigid object have opposite velocity direction

which it acts.

J =

Fdt=mΔv (5.12)

So that the equations used in the second method is rewritten.

The contact force can be applied not only after penetration but also before. The change of velocity in phase 1 can regard as a repulsion force which acts not only to particle but also to rigid body. However, energy-based method cannot estimate contact force in phase because there is no displacement. So we can combine impulse-based method in phase 1 to calculate the repulsion force.

Three methods proposed in the thesis are completely explicit and require only vector operator. Therefore, they largely reduce the computational burden of traditional constraint based methods. However, latter two methods sometimes produce force with noise in direction and may produce strange torque to the rigid object. The problem can be solved by only apply the sub-force which parallels to the normal of the contact point.

Chapter 6

Implementation and Result

In this chapter, the full algorithm used in this paper is presented in the first section. In the second chapter, we demonstrate the results in different situation. We will show the result of simulation which only applies phase 1. In this case, an obvious result for collision avoidance method can be observed. Then we will show the results of single rigid body interacting with cloth, and then the result for multiple rigid bodies.

Finally in the last section, we will discuss about the limitation of our method.

6.1 Implementation

In Figure 5.1, we outline the entire algorithm for simulating rigid body and cloth in contact. Note that in step 5, distance field functionD

( )

maps a position pv to a signed distanced and a normal direction. The function can be a formula for simple model or a volume texture pre-computed in step 1. d and can be stored in RGBA of a texel and d can be normalize within 0 to 1. With some branching factor, the full algorithm is potentially suited for parallel implementation. Every particle motion and contact force can be simulated independently by GPU textures. And the algorithm can exploit the efficiency of SIMD hardware.

PRE-COMPUTATION

1. Compute distance field as a volume texture..

COLLISION-FREE UPDATE 2. Evaluate forces.

3. Move rigid objects and cloth by chosen integration method.

COLLISION DETECTION

4. Execute broad-phase collision detection such as multi-resolution hash table space.

5. Execute narrow-phase collision detection by testing particle position with distance field d,nˆ =D(xvp)

COLLISION RESPONSE

6. If particle is near to rigid body surface within repulsion region, apply phase 1 to modify the velocity of particle d > −Crepvvp′ = αvvp + (1−α)vvc and calculate contact force to apply on rigid body.

7. If particle penetrates into rigid body, project particle out

c calculate contact force to apply on rigid body.

8. Repeats steps 2 to 7 for next time step

Figure 6.1: Summary of the Simulation Algorithm

6.2 Result

We have executed our experimentation on a dual cores 1.66 GHz Pentium4 processor with an ATI X1600 graphic card. We use Open Dynamics Engine (ODE) library to simulate rigid body dynamics and render results with Microsoft DirectX 9.0.

And all demonstrations are implemented in C++. The cloth in our demonstrations is constructed with 50×80 particles ordered in grids and the simulation time interval is 0.01 seconds per time step.

First of all, an exaggerated example is shown in Fig 6.2. The sphere radius is 3.0 and the radius of the repulsion region around particle is set to 5.0. In Fig 6.2(b) rigid object is within the repulsion region so that the velocity of some particle is slightly changed. And in Fig 6.2(e) the rigid object finally reaches the cloth and the velocity of contact particle is nearly the same to the velocity of the contact point of rigid body.

Although this is completely unrealistic, the effect of the repulsion region can be clearly observed. However, we usually set the radius of repulsion region to 1.0.

In Fig 6.3, we compare the situation of applying repulsion or not. In Fig 6.3(a), we use collision alleviation and produce a smooth contact. And in Fig 6.3(b), we close the repulsion effect, and then surface of cloth is obviously vibrating. Moreover, an unstable situation like Fig 6.3(c) happens more frequently with repulsion effect. These cases use the same parameters but the former one applies repulsion while the latter ones do not.

Next, we show the case that the rigid body will not be affected by the cloth in Fig 6.3. This is an example for some pre-animated objects such as character model or for a rigid body with extremely high weight. With the reinforcement of collision alleviation method in phase 1, the projection which moves particle out of rigid body can be smooth and stable. The rigid body is a brick-shaped object which falls from the upper side of the cloth in Fig 6.4 (a). It reaches the floor in Fig 6.4(b) and the cloth is drawn from the bottom of the object in Fig 6.4(c).

In the third demonstration, we compare the contact force which is estimated by different kind of method. The initial position is shown in Fig 6.5(a) and a series of

slightly different in direction and degree of the contact force. Energy-based method in Fig 6.5(d) underestimates the contact force in some situations so that the highest position is lesser than others while subforce-based method in Fig 6.5(b) overestimates contact force so that results in a higher position.

Finally, we show a multiple rigid body interacting with cloth in Fig 6.6. The size, the shape, initial position and initial velocity are randomly assigned. In Fig 6.6(a)(b)(c), the particles on the four corners of the cloth are fixed and then is released after Fig 6.6(d). Moreover, we analysis the relationship between number of objects and time used for simulation in seconds by incrementally adding an object into the system. As shown in Fig 6.7, the simulation time grows linearly while the number of object increases. According to the result we can conclude that the time cost for an object in one simulation step is about 0.000208 second. That is, we can simulate 80 objects simultaneously in a frequency of 60 simulation steps per second and may produce a runtime simulation.

(a) (b)

(c) (d)

(e) (f)

Figure 6.2: Example for repulsion with large radius

(a)

(b)

(c)

Figure 6.3: With or without repulsion

(a) (b)

(c) (d)

(e) (f)

Figure 6.4: Example for a rigid object which cannot be influenced by cloth

(a) Initial position

(b) Subforce-based method

(c) Impulse-based method

(d) Energy-based method

Figure 6.5: Three estimation of contact force

(a) (b)

(c) (d)

(e) (f)

Figure 6.6: Example for rigid body rain (20 objects).

Figure 6.7: Relationship between number of object and time used for simulation 0

0.002 0.004 0.006 0.008 0.01 0.012

1 4 7 10 13 16 19 22 25 28 31 34 37 40 43 46 49 52 number of object

seconds per simulation

Chapter 7

Conclusion and Future Work

In this thesis, we introduced a collision scheme for the interaction between rigid body and cloth. First, we partially avoid some collision in phase 1 by modified the velocity of particles when cloth and rigid body moving close. This method which also prevents drastic collision provides a smooth and stable contact for cloth and rigid body. Moreover, it prevents unstable divergence of the system which applies explicit method in phase 2. In phase 2, we exploit distance field to efficiently project penetrated particle and explicitly estimate the contact force. The simplified method can largely reduce the time wasted in contact resolution. We sacrifice a little accuracy but produce a stable, plausible and runtime simulation which is useful in game industry.

However, we did not consider friction in this thesis which is usually solved with constraint. The explicit method makes it difficult to estimate reasonable friction force.

Moreover, the explicit method may cause error direction while estimating contact force. In future work, we would like to extend our scheme to produce friction effect and reduce the error cause by explicitness. Furthermore, we will combine the continuous collision detection methods to deal with an extremely high speed collision.

References

[1] Anitescu, M. and Potra, F. “Formulating dynamic multi-rigid-body contact problems with friction as solvable linear complementary problems”. Nonlinear Dynamics, pp. 231-247, 1997

[2] Baraff, D. “Analytical methods for dynamic simulation of non-penetrating rigid bodies”. Proceedings of ACM SIGGRAPH, pp.223–232, 1989

[3] Baraff, D. “Coping with friction for nonpenetrating rigid body simulation”.

Computer Graphics 25, 4, pp.31–40, 1991

[4] Baraff, D. “Issues in computing contact forces for non-penetrating rigid bodies”.

Algorithmica 10, pp.292–352, 1993

[5] Baraff, D. and Witkin, A. “Partitioned dynamics”. Tech. Report CMU-RI-TR- 97-33, Robotics Institute, Carnegie Mellon University, 1997.

[6] Baraff, D., Witkin, A. and Kass, M. “Untangling cloth”. Proceedings of ACM SIGGRAPH, pp.862-870, 2003

[7] Bridson, R., Fedkiw, R. and Anderson, J. “Robust treatment of collisions contact and friction for cloth animation”. Proceedings of ACM SIGGRAPH, pp.594-603, 2002 [8] Erleben, K., Sporring, J., Henriksen, K. and Dohlmann, H. “Physics-based Animation”. Jenifer Niles, 2005

[9] Galoppo, N., Otaduy, M.A., Mecklenburg, P., Gross, M. and Lin, M.C. “Fast simulation of deformable models in contact using dynamic deformation textures”.

Proceedings of the ACM SIGGRAPH/Eurographics symposium on Computer animation, pp.73-82, 2006

[10] Guendelman, E., Bridson, R. and Fedkiw, R. “Nonconvex rigid bodies with stacking”. ACM Transactions on Graphics 22, 3, pp.871–878, 2003

[11] Hahn, J. K. “Realistic animation of rigid bodies”. Proceedings of the 15th annual

conference on Computer graphics and interactive techniques, pp.299– 308, 1988 [12] Hirota, G., Fisher, S., State, A., Lee, C. and Fuchs, H. “An Implicit finite element method for elastic solids in contact”. In Computer Animation, Seoulm South Korea, 2001

[13] Hirota, G. “An improved finite element contact model for anatomical simulations”. PhD thesis, University of N. Carolina, Chapel Hill, 2002

[14] House, D. H. and Breen, D. “Cloth Modeling and Animation”. A.K. Peters, 2000 [15] Hubbard, P.M. “Interactive collision detection”. Proceeding of the IEEE Symposium on Research Frontiers in Virtual Reality, pages 24-32, 1993

[16] Ilenkovic, V. J. and Schmidl, H. “Optimization-based animation”. Proceedings of ACM SIGGRAPH, pp. 37–46, 2001

[17] Jansson, J. and Vergeest, J. S. M. “Combining deformable and rigid body mechanics simulation”. The Visual Computer Journal, pp.280-298, 2003

[18] Mirtich, B. and Canny J. “Impulse-based simulation of rigid bodies”. Symposium on Interactive 3D Graphics, pp. 181–188, 1995

[19] Moore, M. and Wilhelms, J. “Collision detection and response for computer animation”. Proceedings of ACM SIGGRAPH, pp. 289–298, 1988

[20] O’Brien, J., Zordan, V. and Hodgins, J. “Combining active and passive simulations for secondary motion”. IEEE Computer Graphics and Applications, Vol.

20, No. 4, pp.86-96, 2000

[21] Open Dynamics Engine. Opensource Project, Multibody Dynamics Software, q12.org/ode/.

[22] OpenTissue. http://www.opentissue.org

[23] Pascal, V. and Nadia, M. “Simple linear bending stiffness in particle systems”.

[24] Pauly, M., Pai, D.K. and Guibas, L.J. “Quasi-rigid objects in contact”.

Proceedings of the 2004 ACM SIGGRAPH/Eurographics symposium on Computer animation, pp.109-119, 2004

[25] Provot, X. “Deformation constraints in a mass-spring model to describe rigid cloth behavior”. Proceedings Graphics Interface, pp. 147-154, 1995

[26] Sauer, J. and Schömer, E. “A constraint-based approach to rigid dynamics for virtual reality application”. ACM Symposium on Virtual Reality Software and Technology, pp. 153-161, 1998

[27] Stanford bunny, http://graphics.stanford.edu/data/3Dscanrep/

[28] Stewart, D. and Trinkle, J. “An implicit time-stepping scheme for rigid body dynamics with inelastic collision and coulomb friction”. International Journal of Numerical Methods in Engineering, 1996

[29] Stewart, D. and Trinkle, J. “An implicit time-stepping scheme for rigid body dynamics with coulomb friction”. IEEE International Conference on Robotics and Automation, pp. 162-169, 2000

[30] Sud, A., Govindaraju, N., Gayle, R. and Manocha, D. “Interactive 3D distance field computation using linear factorization”. Proc. ACM Symposium on Interactive 3D Graphics and Games, pp.117-124, 2006

[31] Terzopoulos, D., Platt, J. C. and Barr, A. H. “Elastically deformable models”. In Proceedings of ACM SIGGRAPH, pp.205–214., 1987

相關文件