14
Deformed Distance Fields for Simulation of Non-Penetrating Flexible Bodies Susan Fisher Ming C. Lin Department of Computer Science University of North Carolina at Chapel Hill U. S. A. Abstract We present a novel penetration depth estimation algorithm based on the use of deformed distance fields for simulation of non-penetrating flexible bodies. We assume that the continuum of non-rigid models are discretized using standard tech- niques, such as finite element methods. As the objects deform, the distance fields are deformed accordingly to estimate penetration depth, allowing enforcement of non-penetration constraints between two colliding elastic bodies. Our approach can automatically handle self-penetration and inter-penetration in a uniform man- ner. We demonstrate its effectiveness on moderately complex animated scenes. 1 Introduction Due to recent advancements in physically-based modeling, simulation techniques have been increasingly used to improve the quality and efficiency of producing computer animation for major film productions, medical simulation and computer games. These techniques produce animation directly from input objects, simulating natural motions and shape deformations based on mathematical models that specify the physical be- havior of characters and complex structures. Modeling deformation is a key component of physically-based animation, since many real-world objects are not rigid. Some examples include realistic motion gen- eration of articulated characters with passive objects (such as clothing, footwear and other accessories), deformation of soft tissues and organs and interaction among soft or elastic objects. Automatic, predictable and robust simulation of realistic deformation is one of the many challenges in computer animation and medical simulation [8]. One of the most difficult issues in generating realistic motion of non-rigid objects is to simulate contact between between them. When two flexible objects collide, they exert reaction forces on each other resulting in the deformation of both objects. Simi- larly when one flexible body self collides, multiple portions of the object may deform. The reaction force is called the contact force, and where the two surfaces touch is often called the contact surface. Simulating such events is non-trivial. It is known as the contact problem in computational mechanics, and has been actively investigated for

Deformed Distance Fields for Simulation of Non …geom/DDF/CAS01.pdfDeformed Distance Fields for Simulation of Non-Penetrating Flexible Bodies ... As the objects deform, ... In our

  • Upload
    vankiet

  • View
    221

  • Download
    5

Embed Size (px)

Citation preview

Deformed DistanceFields for Simulation ofNon-Penetrating Flexible Bodies

SusanFisher Ming C. Lin

Departmentof ComputerScience

Universityof NorthCarolinaatChapelHill

U. S.A.

AbstractWe presenta novel penetrationdepthestimationalgorithmbasedon the use

of deformeddistancefields for simulationof non-penetratingflexible bodies.Weassumethatthecontinuumof non-rigidmodelsarediscretizedusingstandardtech-niques,suchasfinite elementmethods.As theobjectsdeform,thedistancefieldsaredeformedaccordinglyto estimatepenetrationdepth,allowing enforcementofnon-penetrationconstraintsbetweentwo colliding elasticbodies. Our approachcanautomaticallyhandleself-penetrationandinter-penetrationin a uniform man-ner. We demonstrateits effectivenessonmoderatelycomplex animatedscenes.

1 Intr oductionDueto recentadvancementsin physically-basedmodeling,simulationtechniqueshavebeenincreasinglyusedto improve the quality andefficiency of producingcomputeranimationfor majorfilm productions,medicalsimulationandcomputergames.Thesetechniquesproduceanimationdirectly from input objects,simulatingnaturalmotionsandshapedeformationsbasedon mathematicalmodelsthat specify the physicalbe-havior of charactersandcomplex structures.

Modeling deformationis a key componentof physically-basedanimation,sincemany real-world objectsarenot rigid. Someexamplesincluderealisticmotion gen-erationof articulatedcharacterswith passive objects(suchasclothing, footwearandotheraccessories),deformationof soft tissuesandorgansandinteractionamongsoftorelasticobjects.Automatic,predictableandrobustsimulationof realisticdeformationis oneof themany challengesin computeranimationandmedicalsimulation[8].

Oneof themostdifficult issuesin generatingrealisticmotionof non-rigidobjectsis to simulatecontactbetweenbetweenthem. Whentwo flexible objectscollide, theyexert reactionforceson eachotherresultingin thedeformationof bothobjects.Simi-larly whenoneflexible bodyself collides,multiple portionsof theobjectmaydeform.Thereactionforceis calledthecontactforce, andwherethetwo surfacestouchis oftencalledthe contactsurface. Simulatingsucheventsis non-trivial. It is known as thecontactproblem in computationalmechanics,andhasbeenactively investigatedfor

decades[5]. Thedifficulty of thisproblemfor modelingdeformationof non-rigidbod-iesarisesfrom unclearboundaryconditions;neitherthecontactforcenor thepositionof thecontactsurfaceis known apriori.

Ideally, no two objectsshouldsharethe samespace.This is the non-penetrationconstraint. The non-penetrationconstraintcanbe imposedusingtechniquessuchasconstrainedoptimizationtechniquesor penalty-basedmethods.Dueto dualunknownsin thecontactproblemfor deformablemodelsmentionedabove, penalty-basedmeth-odsareoften preferred.Whenusinga penaltybasedmethod,a penetrationpotentialenergy must first be definedthat measuresthe amountof intersectionbetweentwomodels,or the degreeof self-intersectionof a deformablebody. Oneof themoreac-curatemeasurementsof theamountof intersectionis thepenetrationdepth,commonlydefinedasthe minimum (translational)distancerequiredto separatetwo intersectingrigid objects.No generalandefficient algorithmfor computingpenetrationdepthbe-tweentwo non-convex objectsis known. In fact,an

���������timeboundcanbeobtained

for computingtheMinkowski sumof two rigid, non-convex polyhedrato find themin-imum penetrationdepthin 3D [7]. Neithera complexity boundfor this problemnor aformaldefinitionof penetrationdepthfor deformablemodelshasyetbeenestablished.

1.1 Main ContributionWepresentanefficientalgorithmbasedon theuseof deformeddistancefieldsfor sim-ulatingdeformationbetweennon-penetratingelasticbodies.Theunderlyinggeometricmodelsarecomposedof polygonalmeshes.Modelsconsistingof implicit representa-tionsor parametricsurfaces,suchasNURBS,canbetessellatedinto polygonalmesheswith boundederror.

We assumethat eachnon-rigid body is modeledusing finite elementmethods(FEM) [5] in our currentimplementation[11], but the algorithm itself is applicableto other discretizationtechniques,suchas finite differencemethodsor spring-masssystems.We employ theFastMarchingLevel SetMethod[18, 19] to precomputetheinternaldistancefield of eachundeformedmodel.Whentwo flexible bodiescomeintocontactanddeform, the precomputeddistancefields are likewise deformedto com-pute the estimatedpenetrationdepthbetweentwo deformingobjects. This penetra-tion measurecanbeincorporatedinto a penalty-basedformulationto enforcethenon-penetrationconstraintbetweentwo elasticbodies.This enablesefficient computationof contactforcesandhelpsto yield aversatileandrobustcontactresolutionalgorithm.Wehavesuccessfullyintegratedourpenetrationdepthestimationalgorithmto computecollision responseof two elasticbodiesefficiently. Specifically, our penetrationdepthestimationalgorithmhasthefollowing characteristics:

Both self-collisionsandsoft object contactsarehandledin a uniformmanner. No prior assumptionor knowledgeaboutthelocationsof contactsis required. Thealgorithmcantrade off accuracyfor speedor storageif desired.

1.2 OrganizationTherestof thepaperis organizedin thefollowing manner. We briefly survey thestateof the art in section2. In section3, we give an overview of our algorithm and the

basicterminologiesusedin this paper. Section4 describesthenumericalmethodusedto pre-computethe distancefield andhow it is updatedon the fly as the objectsde-form. Section5 presentsour new penetrationdepthestimationmethodfor deformableobjectsbasedon linear interpolationof precomputeddistancefieldsandtheresultingcollision response.Section6 describesthe systemimplementationanddemonstratestheeffectivenessof ouralgorithm.

2 RelatedWork

2.1 Penetration Depth ComputationThenotionof penetrationdepthbetweenoverlappingobjectswasintroducedby Buck-ley andLeifer [2] andCameronandCulley [3]. Several algorithms[7, 9, 15] havebeenproposedfor computingameasureof penetrationdepthusingvariousdefinitions.Agarwal, et al. proposeda randomizedalgorithmthatcomputespenetrationdepthbe-tweentwo convex polyhedrain

������ �������� �������������������������expectedtime for any

constant����� [1], where

and�

arethe numberof verticesof the two polyhedra.However, all existing methodsassumethatat leastoneof theinputmodelsis a convexpolytope.

It is well known thatif two polytopesintersect,thenthedifferenceof theirreferencevectorslies in their convolution or Minkowski sum[10]. Theproblemof penetrationdepthcomputationreducesto calculatingtheminimumdistancebetweentheboundaryof theMinkowski sumof two polyhedraanda point insideit. However, theconstruc-tion of theMinkowski sumcanbequiteexpensive. In three-dimensionalspace,thesizecanbeeasilyquadraticevenfor two convex polyhedra.An

���������time boundcanbe

obtainedfor computingtheMinkowski sumof two rigid, non-convex polyhedrato findtheminimumpenetrationdepth[7], where

�is thenumberof verticesfor eachpoly-

hedron.Thereseemsto be little hopeto computethe penetrationdepthat interactiveratesbasedon someof thesewell-known theoreticalalgorithms.

Few methodshave beenproposedto computethe penetrationdepthfor NURBSmodelsor othernon-rigid modelrepresentations.As it standstoday, interactivecom-putationof penetrationdepthbetweentwo generalgeometricmodelsof highcomplex-ity remainsanopenresearchissue.

2.2 DistanceFieldComputingtheminimumgeodesicdistancefrom a point to a surfaceis a well knowncomplex problem[16]. OsherandSethian[18, 19], introduceda new perspective onthisproblemby usingapartialdifferentialmethodto performcurveevolution. Hoff, etal. introducedthe useof graphicshardwareto computegeneralizedVoronoidiagramandits correspondingdiscretizeddistancefield [12]. Recently, this approachhasbeenappliedto performgeneralproximity queriesin 2D [13]. Frisken,et al. alsopresentedanadaptive techniqueto computedistancefields[4].

3 PreliminariesIn this section,we definebasicnotationsandmethodologiesusedin this paper, givea brief overview of the simulationframework usedto testour algorithm,andgive anoutlineof ourapproachfor estimatingpenetrationdepthbetweendeformablemodels.

3.1 Discretization MethodsDeformationinducesmovementof everyparticlewithin anobject.It canbemodeledasamappingof thepositionsof all particlesin theoriginalobjectto thosein thedeformedbody. Eachpoint is movedby thedeformationfunction ! �#"$� :

&%'! ��(*) �

where representstheoriginal position,and ! ��(*) � representsthepositionat time(.

We limit thediscussionto thestaticanalysishere,hence(

is omitted: &%+! � � .Simulatingdeformationis in factfinding the ! ��" � thatsatisfiesthelawsof physics.

Sincetherearean infinite numberof particles, ! �#"$� hasinfinite degreesof freedom.In orderto modela material’s behavior usingcomputersimulation,sometypeof dis-cretizationmethodmust be used. For simulationof deformablebodies,spring net-works,thefinite differencemethod(FDM), theboundaryelementmethod(BEM), andthefinite elementmethod(FEM) haveall beenusedfor discretization.

3.2 Tetrahedral ElementsIn ourprototypesimulator, wehavechosenFEM asthediscretizationmethoddueto itsgeneralityanddiversity. TheFEM usesa piecewiseapproximationof thedeformationfunction ! ��" � . Each“piece” is called an element,which is definedby several nodepoints.Theelementsconstituteamesh.

OuralgorithmusesaFEM with 4-nodetetrahedralelementsandlinearshapefunc-tions. Other non-linearshapefunctionscan be usedas well, but the updateof thedistancefield computationastheobjectsdeformwill beaffected(section5).

Thedeformationfunction ! ��" � mapsapointin atetrahedralelementat &,.- / )�01)�24365to anew position ! � � . As shown in Fig. 1, by definition, ! �#"$� movesfour nodesof anelementfrom their originalpositions

798 ,.- ��:<;=)���:?>@)���:?AB3 5 )BCEDGFHDJIK)to thenew positions

L798 ,.-�M��:<;=) M��:?>@) M��:?AB3 5 )BCEDGFHDJIKNThedisplacementsof thefour nodesdueto deformationis

O 8 , -$P :<;=) P :<>@) P :?AQ3 5, -RM��:<;TSU��:<;K) M��:?>VS&��:?>@) M��:?AWSU��:<AB3 5 )QCXDYFZDJI[N

n

n

U

U

nn

1

4

2

n

n

U 2

1

4

n1 2

3

4

U3n3

~

~

~~

Figure1: \�]_^ ` mapsfour nodesof a tetrahedralelement,a�bdcfegehegc�aji to their new positionatka b clehegegc ka i . m b cfegegehc�m i arethecorrespondingdisplacementvectors.

3.3 Simulation FrameworkGiven the basicsof FEM, we reformulatethe problemof simulatingdeformableob-jectsasa constrainedminimizationproblemusingConstitutiveLaw [5]. Detailsof thesimulatoraregivenin [11]. Herewegiveabrief overview of thesimulatorusedto testouralgorithmfor computingestimatedpenetrationdepthbetweenflexible models:

1. Generateaninternaldistancefield for eachinputobjectusingtheFastMarchingLevel SetMethod(sec.4).

2. Constructa tetrahedralelementmeshfor eachobject.

3. Apply finite elementanalysis:

(a) Estimatethepenetrationdepthbasedonthedeformeddistancefields(sec.5)for penetrationavoidance.

(b) Minimize thetotalenergy dueto deformation,takinginto accountall mate-rial propertiesandexternalforces,usingoursynthesizednumericalmethod[11].

4. Incrementallyupdateportionsof thedistancefields,giventhenew positionsandorientationsof thedeformedbodies.

3.4 Algorithm OverviewAs two objectscomeinto contactanddeform,thealgorithmuses

1. A hierarchical sweep-and-prune[14] when the NURB representationsof themodelsaregiven;

2. A lazyevaluationof possibleintersectionsusingboundingvolumehierarchiesofaxis-alignedboundingboxes[20].

The collision detectionmodule identifiesthe “regions of potentialcontacts”,aswell as the intersectingtetrahedralelements. The intersectingtetrahedralelementsare thenusedto computethe estimatedpenetrationdepthbasedon the pre-assigned

distancevaluesat the nodesof eachelement(sec.5). This is a fastoutput-sensitivecomputationrequiring

���Rn&�time, where

nis the numberof pairs of intersecting

tetrahedralelements,andis normallysmallcomparedto thenumberof elementswithineachmodel.

Sincethepre-assigneddistancevaluesateachnodeof thetetrahedralelementsmayno longerbe valid after the deformation,we needto either recomputeor adaptivelyupdatethesedistancevalues.Sincerecomputationof theentireinternaldistancefieldfor eachdeformedmodelcanberatherexpensive,we performa partialrecomputationof distancefield only at and nearthe regionsof potentialcontactsindicatedby thecollision detectionmoduleandFEM simulation. We alsoensurethe continuity anddifferentiability of the distancefield at the boundaryof theseregions. The valuesofupdateddistancefieldsarethenusedfor thenext simulationstep.

Thisprocesscontinuesiteratively to estimatethepenetrationdepthbetweenelasticbodiesquickly andefficiently duringthesimulation.

4 Inter nal DistanceFieldsTheFastMarchingLevel SetMethodwasfirst designedto tracktheevolutionof frontsthrougha 3D space.In our application,thesurfaceof anarbitrary3D objectis treatedasa front. Thesurfaceis propagatedinwards, oppositeof thedirectionof thesurfacenormal. As the surfaceevolveswith uniform speed,distancevaluesfrom the surfaceareassignedto pointsona discretizedgrid.

The input to the FastMarchingLevel SetMethodconsistsof a polygonalmesh.Modelsconsistingof implicit representationsor parametricsurfaces,suchasNURBS,canbetessellatedinto polygonalmesheswith boundederror. Theusermayalsospecifytheresolutionof the3D grid, tradingaccuracy for speed.Theoutputof themethodisadiscretizeddistancefield for thevolumeencompassedby the3D surface.In practice,interpolationmethodsareusedwhensamplingthedistancefield for penetrationdepthcomputations.

Severalkey termsareusedin thepresentationof this algorithm. A gridpointmaybe marked with oneof threelabels: ALIVE, NARROW BAND, or FAR AWAY. AnALIVE point representsagrid point thathasalreadybeenassignedadistancevalue.ANARROW BAND point representsapointon theevolving front. A FAR AWAY pointrepresentsa pointwithout anassigneddistancevalue.

4.1 InitializationTo computedistancevaluesfor anarbitraryobjectrequiresinitializing the locationofthesurfacewithin a 3D grid. For eachtriangleof thepolygonalmesh,anaxis-alignedboundingbox is created.Distancevaluesfor eachgrid point in theboundingbox arethendefined.Whentheinitialized valueis greaterthanor equalto zero,thegrid pointliesoutsideof theobjector onthesurface.Thesegrid pointsaremarkedALIVE. Whenthe distancevalue is negative, it lies inside the object,and the grid point is markedNARROW BAND.

Thesetof NARROW BAND pointsrepresentsthosewithin a neighborhoodof thezerolevel set. Restrictingwork to only this neighborhoodof thezerolevel setyieldsa considerablereductionin computationalcost.This methodof computationis knownasthenarrowbandapproach, andis discussedin detail in [19].

4.2 Mar chingOncethe3D grid hasbeeninitialized, themarchingphaseof thealgorithmmaycom-mence. At eachstep, the grid point with the minimum distancevalue is extractedfrom thesetof NARROW BAND grid points.Thedatastructureunderlyingthisphaseof the algorithmis discussedin section4.3. Upon selectionof the minimum valuedNARROW BAND grid point, it is markedALIVE, andany FAR AWAY neighborsaremovedto thesetof NARROW BAND points.Thedistancevaluefor eachneighboringNARROW BAND point is thenupdatedby solving for o in the following equation,selectingthelargestpossiblesolutionto thequadraticequation:C

p :$qlr ,ts u �Yvw�Y�where

ux, ��y{zd|��R}�~ ; o ��� /� }�~ ; ~ ; o )�} �;o �.� /� } � ; � ; o ) � ���#�

wherethefinite differencesaregivenby

} � ; , o : ��� S o� /}�~ ; , o S o : ~ �� /} � ; � ; , o : � � S � o : �9� � o� � /} ~ ; ~ ; , o S � o : ~ � � o : ~j�� � /

Similarly,

v , �Ry{zd|��R}�~ > o �.� 0� }�~ > ~ > o )�} �>o ��� 0� } � > � > o ) � ���#�

� , ��y{z�|���}�~ A o � � 2� }�~A ~ A o )l} �

Ao � � 2� } �

A � A o ) � ���#�

The termp :$qlr

representsthespeedof thepropagatingfront. Becausewe wish tofind thedistancefrom eachpoint to thesurface,this valueis uniform (constant)in ourapplication.The equationsusea secondorderschemewhenever possibleto producehigheraccuracy. That is, both o : � � and o : ��� must be ALIVE in order to compute}�� ; � ;

,}�� > � >

or}�� A � A

, where o : � � �+o : ��� . The choiceof when to use thesecondorderschemesimply dependson whethertwo known (ALIVE), monotonicallyincreasingvaluesexist asneighborsof thetestpoint. If not, thenthefirst orderschemeis used.

This processof selectinga minimumNARROW BAND point,markingit ALIVE,andupdatingneighborscontinuesuntil no NARROW BAND pointsremain. This al-gorithm to computean internaldistancefield for eachobjectcanbe summarizedasfollows:

GridPoint G;InitializeGrid();heap = BuildHeap(); //NARROW_BAND POINTSwhile (heap.isEmpty() != TRUE){

G = heap.extractMin();G.status = ALIVE;markNeighbors(G);updateNeighbors(G);

}

4.3 Data StructuresWith eachstepof the algorithm, the minimum valuedNARROW BAND grid pointmustbeextracted.Theneedfor anefficientextractionoperation,aswell asanefficientinsertionoperationmakestheuseof a heapideal.However, oncetheminimumvaluedgrid pointNARROW BAND grid pointhasbeenidentified,thealgorithmupdateseachneighboringpoint. Thus,in additionto theneedfor anefficient sorteddatastructure,wemustalsoretainspatialinformation.

Our solutionis simply to usebotha minimumheapstructureanda 3D array. Eachheapnodecontainsa pointerto the 3D arraygrid point that it references.Similarly,eachNARROW BAND grid point in the3D arraypointsto anodein theheap.ALIVEandFAR AWAY pointshave NULL pointersasonly NARROW BAND pointsarein-cludedin theheap.

4.4 Partial Updateof DistanceFieldWhenan objectdeforms,the simulatorusethe collision detectionmoduleto quicklyidentify theneighborhoodwherepartialupdateof distancefield needsto beperformed.This informationalsofinds the instanceswhereboundarynodespenetrateotherele-ments.

4.4.1 Collision DetectionFor collision detection,we usethe hierarchical sweep-and-prunedescribedin [14],whenthe original, correspondingNURB representationsof the modelsareavailable.Eachsurfacepatchis subdivided into smallerpatchesandrepresentedhierarchically.Eachleaf nodecorrespondsto a splinepatchwhosesurfaceareais lessthanan inputparameter� usedin generatingthe polygonalmeshesof the patch. The resultingtreehasa shallow depthandeachnodecanhave multiple children. An axis-alignedboundingbox is computedfor the control polytopeof eachpatchand dynamicallyupdated. At eachlevel of hierarchy, the sweep-and-prune[6] is usedto checkforoverlapof the projectionsof the boundingboxesonto / SX)�01SX)�2[S axes. Only whenthe boxesoverlapin all threedimensions,a potentialcontactis returned.Coherenceis exploitedto keeptheruntimelinear to thenumberof boundingboxesat eachlevel.The resultinghierarchicalsweep-and-prunecanbe efficiently employed to checkforpotentialoverlapsof thehierarchies.

If theNURB representationsof themodelsarenotavailable,welazily constructtheboundingvolumehierarchies(BVHs) basedon axis-alignedboundingboxesfor eachmodelon thefly andcheckfor collision betweenthemusingthesebinaryBVHs. Formoredetails,we referthereadersto [20].

4.4.2 Lazy EvaluationGiven the regionsof potentialcontactsreturned(asoneor moreboundingboxes)bythecollision detectionmodule,we performpartialupdateof theinternaldistancefieldby only recomputingthedistancevaluesat eachgrid point within theseregions.WithsuchmethodsasFEM andfinite differencemethods,this informationis easyto obtain.Thesemethodstreatobjectsvolumetrically, andthereforethey retaininformationonhow far theeffectsof deformationhavepropagatedthroughouttheobject.

Given the boundingbox, a second3D grid is createdthat overlaysthe first. Thealgorithmto computethis partialgrid is thesamealgorithmpreviously described;thesavings in computationtime comesfrom the reductionof the numberof grid pointsbeingcomputed. Oncethe marchingcompletes,we combinetwo setsof computeddistancevalues(onefrom theprecomputationandonefrom thepartialupdate),whilepreservingthecontinuityanddifferentiabilityof thesolutionsthatarecrucialfor com-putingcollision responserobustly [11].

In practice,thesetwo separatedsetsof distancevaluesarealmostalwayscontinu-ous.We verify continuityby examiningthegradientacrosstheborderof thetwo sets.In rarecaseswherethedistancevaluesarediscontinuous,otheroptionsareavailable.

Oneoptionis to linearinterpolatethetwo datasetsto obtainacontinuoussolution.This optionis only viablewhenthedegreeof discontinuityis low. In caseswheretheresultingdatasetis highly discontinuous,the entireobjectis recomputed.In our testapplications,this situationneveroccurred.This is dueto theaccuracy of theboundingboxesfor partialupdategeneratedby ourcollision detectionandFEM algorithm.

Withoutpartialupdates,thedistancefield canbecomelessandlessaccurateduetolarge deformationsasthe simulationproceeds.Eventuallythe accumulatederrorsintheresultingdistancefieldscancausevisually disturbingartifactsin simulations.

5 Penetration Depth EstimationWhenusingthepenaltybasedmethod,we needto first definea penetrationpotentialenergy ���Q�#�4�_� ��" � that measuresthe amountof intersectionbetweentwo polyhedra,or the degreeof self-intersectionof a singlepolyhedron. This definition requiresanefficient methodto computeit, andits first andsecondderivatives,for computingthecollision responserobustly [11].

5.1 Defining the Extent of IntersectionThereareseveralknownmethodsto definetheextentof intersection.Thenode-to-nodemethodis thesimplestway to compute���B���4�_� �#"$� . This methodcomputes���Q�#�4�_� ��" �asafunctionof thedistancesbetweensampledpointsontheboundaryof eachobjects.Thedrawbackof thismethodis thatonceanodepenetratesboundarypolygons,there-pulsiveforceflips its direction,andinducesfurtherpenetration.Suchpenetrationoftenoccursin intermediatestepsof theaggressivenumericalmethods.Furthermore,onceanodeis insidea tetrahedralelement,it is no longerclearwhich boundarypolygonthenodehasactuallypenetrated.

Themostcomplicatedyet accuratemethodis to usethe intersectionvolume. Us-ing this method, � �B���4��� �#"$� is definedbasedon the volume of intersectionbetween

two penetratingpolyhedra.Sincepolyhedradeformassimulationstepsproceed,it isdifficult to createandreusepreviousdatafrom the original model. Furthermore,it issusceptibleto accuracy problemsanddegeneratecontactconfigurations.As a result,efficientcomputationof theintersectionvolumeis ratherdifficult to achieve.

We have chosena methodthat providesa balancebetweenthe two extremesbycomputingan approximatepenetrationdepthbetweendeformableobjects. With ourmethod,���B���4�_� ��" � is definedasa functionof distancesbetweenboundarynodesandboundarypolygonsthatthenodespenetrate.We define

� �B���4�_� �#"$� ,��X��� � (1)

where � is theminimumdistancefrom a boundarynodeto the intrudedboundaryand� is a penaltyconstant.

5.2 Estimating Penetration DepthSupposea boundarynode � is within an elementwith nodes7�� ) 79� ) 79� and 7�� asshown in Figure2. Usinga linearshapefunction, � canbewritten in termsof linearinterpolationof 7�� )QNBNQN�) 7�� :

��,�� � 7�� � � � 7�� � �j� 7�� ���#C�S � � S � � S �1� � 7�� (2)

n 2

n

n

n

4

3

1 m

Figure2: A nodem penetratesinto anothertetrahedralelement.Thedistancebetweenm andtheredtriangleis thepenetrationdepth.

Our algorithmestimatesthecomputationof thepenetrationdepth � by replacingitwith M� at � usingthelinearinterpolationof pre-assigneddistancevalues:

M��,�� � � � � � � � � � �1�H��� ����C�S � � S � � S �1� � �4  (3)

where � � ) � � ) � � and �   aredistancevaluesat the four nodesof eachtetrahedralele-ment.Thesedistancevaluesaresampledfrom thedistancefield generatedby thefastmarchinglevel setmethodasdescribedin section4. � � ) � � and �1� aretheinterpolationparametersderivedfrom theshapefunctionsof theelementsby solvingEqn.2:

- � � ) � � ) � � 3 5 ,�¡ ~ � - � S 7 � 3 (4)

where ¢ ,£- 7 � S 7 � ) 7 � S 7 � ) 7 � S 7 � 3Thus, M��,¤- � � S �¥  ) � � S �¥  ) ��� S �4  3 ¡ ~ � - � S 7�� 3=� �¥  (5)

Oncean accuratevalueof distanceis assignedto eachnode,no matterhow themeshis deformed,the valueof M� is quickly computedat any point insidethe object.Figure3 showsanexamplewherethedistancefield of asphereis quickly re-computedasthespheredeforms.

Figure3: LEFT: Thedistancefield of asphere.RIGHT: Thedistancefield of adeformedspherecomputedusinglinearinterpolationof theprecomputeddistancefield.

This approximateddistancefield sharesa few propertieswith the exact distancefield. Someof thesepropertiesareessentialfor propercomputationof penaltyforcesandtheir derivatives:

1. It vanisheson theboundarypolygons.

2. It is twicedifferentiableinsidetheelementsand ¦E§ continuouseverywhere.

���B���¥�_� �#"$� is computedby using M� insteadof � in Eqn.1. This algorithmis insen-sitive to which object(or connectedmesh)the nodes� and 7 belongto. Therefore,self-intersectionsandintersectionsbetweentwo objectsaretreatedin a uniform man-ner. It is alsorobustenoughto recover from penetrationsof significantdepth.

6 SystemImplementation and ResultsWe have implementedthealgorithmdescribedin this paperandhave successfullyin-tegratedit into a moderatelycomplex simulationwith videoclipsshown at ourprojectwebsite:

http://www.cs.unc.edu/¨ geom/DDF/

We usedMaya developedby Alias ©Wavefront to generatethe modelsusedin oursimulationsequences.We useda public domainmeshgenerationpackage,SolidMesh[17], to createtetrahedralelementsusedin our FEM simulation. Renderingof thesimulationresultswasdisplayedusingOpenGLona 300MHZ R12000SGI IR.

6.1 SystemDemonstrationFigure4 showsa largedeformationsimulatedby ouralgorithm.Two setsof positionalconstraintswerespecifiedfor internalnodesin the headpart andthe tail part. Giventhepositionalconstraints,theheadof snakeis forcedto movetowardits tail. Thesnakemodelhasabout14,000elements.Our algorithmsenablesthesimulationto automat-ically generatethenaturalcoiling deformation.It is not obviousfrom the images,butmany smallself-penetrationswereresolvedduringthedeformation.

Figure5 aresnapshotsfrom a simulationsequencewherea snake swallows a de-formableredapplefrom a bowl of fruit. Thesnake andtheapplemodelshave a total

Figure4: LargeDeformation:A snake coiling up

Figure5: A snake swallowing anapplefrom a bowl of fruits

of 23,000elements.Eight majorkeyframeswereusedto setthepositionalconstraints.Thedeformationof theappleandthesnake wascomputedby thesimulatorusingouralgorithmto estimatepenetrationdepthsbetweendeformablebodies.

6.2 Choiceof Grid ResolutionThechoiceof thegrid resolutionhasa significanteffect theruntimeperformanceandaccuracy of the distancefield computationusingfastmarchinglevel-setmethods.Infact,fastmarchinglevel-setmethodsrunsin

��� � � � � worst-casetimeusingthe“narrowbandapproach”[19], giventhegrid resolutionof

�x�

x�

and � is thenumberof cellsin thenarrow band.Table1 givesanexampleof thecomputationtime usingdifferentgrid resolutions

�x�

x�

on asphereofC �¥�4� triangleswith thecorrectdistancevalue

of 1.0 at the centerof the spherefor the entiredistancefield vs. updatingCdªd«

of thedistancefield.

Note that thecomputedvaluesfor the internaldistancefield aremuchmoreaccu-rateat theregionsnearthesurfaceof theobject.This is appropriatefor ourapplicationwherethepenetrationis normallynotdeep.Thedeviationbetweenthecorrectdistance

Resolution Valueat Center Dist. Field 1/8 D. Field

60x60x60 0.921986 57.4696sec 2.02469sec55x55x55 0.916389 28.9428sec 1.16319sec50x50x50 0.912209 17.4810sec 0.71547sec40x40x40 0.898008 3.81680sec 0.29566sec30x30x30 0.878681 0.52117sec 0.08658sec20x20x20 0.875549 0.10853sec 0.02734sec

Table 1: The effect of grid resolutionson the accuracy and performance(in seconds)of adistancefield & partialupdatecomputations

valueandthecomputeddistancevalueat thecenterof thesphereindicatesthemaxi-mumerrorpossibledueto theaccumulationof numericalinaccuracies,asthelevel-setcomputationmarchingin towardthecenter.

6.3 Partial Updateof Inter nal DistanceFieldsTable1 alsoillustratesthe performancegain in computingpartial updatesof the dis-tancefield over the recalculationof the entiredistancefield. The last two columnsof Table1 give the computationtime (in seconds)requiredfor computingthe entiredistancefield of the spherevs. updatingonly

C�ªd«of its distancefield. Thespeedup

is quite substantial,especiallyfor thosewith highergrid resolutions.The betterper-formancegainon gridswith higherresolutionis dueto fastercacheaccessfor smallerdatasets.

The timing (in seconds)for partialupdatevs. completerecomputationof thedis-tancefields for variousmodels,including a torus,an appleanda deformedsphereisgivenin Table2. Notethatthetorusmodelwith moretrianglesandthesamegrid res-olution takeslesstime to computethana simplerapplemodelwith far lesspolygons.This is dueto thefactthatthetorusmodelactuallyonly occupiesasmallportionof thegridsallocated;while theappleoccupiesmajorityof thegrid spaceallocated.

Model Resolution Tri’s Dist. Field 1/8 D. Field

Torus 50x50x50 2048 1.04334sec 0.290281secApple 50x50x50 384 10.6384sec 0.958958secSphere 50x50x50 972 5.21021sec 0.516960sec

Table2: Timing (in seconds)onpartialupdateof thedistancefield vs. therecomputationof theentiredistancefield

6.4 DiscussionAlthoughourcurrentimplementationis basedon theuseof aFEM simulator[11], ouralgorithmcanbeappliedto simulationmethodsusingfinite differencemethods(FDM)andwill requirelittle modification.Onecanreplacethelinearinterpolationstepusingshapefunctionsof FEM (explainedin section5) with a linearinterpolationsuitableforFDM. For the spring-masssystems,eachmasscanbe consideredasa nodeof eachfinite elementandthesameformulationwill apply.

Thereis somelimitation to our approach.Our methodcomputesthe internaldis-tancefields within eachobject. Therefore,it is not best suited for handling self-penetrationof very thin objects,suchas cloth or hair, which are often encounteredin characteranimation.

7 SummaryIn thispaper, wepresentanovel geometrictechnique,whichfirst precomputesinternaldistancefieldsfor eachobject,deformseachfield onthefly, andthenlaterutilizesthemfor enforcingthenon-penetrationconstraintsbasedonapenaltymethod.By takingad-vantageof precomputeddistancefieldsthatdeformasthefinite elementmeshdeforms,ouralgorithmenablesefficientcomputationof penaltyforcesandtheirderivatives,andyieldsaversatileandrobustcontactresolutionalgorithm.

This algorithmcanbeusefulfor many applications,suchassimulationof passivedeformabletissuesin computeranimation. It canalsobe incorporatedinto medicalsimulationusedfor multi-modalimageregistration,surgicalplanningandinstructionalmedicalillustration.

AcknowledgementsWe wish to thankGentaroHirota for theuseof hissimulatorandhisassistancein test-ing our algorithm,andtheanonymousreviewersfor their feedback.This implementa-tion alsobenefitedfrom discussionswith David Adalsteinsson.This researchis sup-portedin part by ARO DAAG55-98-1-0322,NSF DMI-9900157,NSF IIS-9821067,ONRN00014-01-1-0067andIntel.

References[1] P. Agarwal, L. J.Guibas,S. Har-Peled,A. Rabinovitch, andM. Sharir. Penetrationdepthof two convex polytopesin

3d. Nordic J. Computing, 7:227–240,2000.

[2] C. E. Buckley andL. J. Leifer. A Proximity Metric For ContinuumPath Planning. Proc. of Int. Conf. on ArtificialIntelligence, 1096-1102,1985.

[3] S. Cameronand R. K. Culley. Determiningthe minimum translationaldistancebetweentwo convex polyhedra.Proceedingsof InternationalConferenceonRoboticsandAutomation, pages591–596,1986.

[4] S. Frisken, R. Perry, A. Rockwood,andT. Jones”, Adaptively sampleddistancefields: a generalrepresentationofshapesfor computergraphics.Proc.of ACM SIGGRAPH, pages249–254,2000.

[5] P. G. Ciarlet andJ. L. Lions, editors. HANDBOOKOF NUMERICALANALYSIS, volumeI - VI. Elsevier ScienceB.V., 1994.

[6] J. Cohen,M. Lin, D. Manocha,andM. Ponamgi. I-collide: An interactive andexact collision detectionsystemforlarge-scaleenvironments.In Proc.of ACM Interactive3D GraphicsConference, pages189–196,1995.

[7] D. Dobkin,J.Hershberger, D. Kirkpatrick, andS.Suri. Computingtheintersection-depthof polyhedra.Algorithmica,9:518–533,1993.

[8] S. F. GibsonandB. Mirtich. A survey of deformablemodelingin computergraphics. TechnicalReportTechnicalReport,MitsubishiElectricResearchLaboratory, 1997.

[9] E.G.GilbertandC.J.Ong.New distancesfor theseparationandpenetrationof objects.In Proceedingsof InternationalConferenceon RoboticsandAutomation, pages579–586,1994.

[10] LeonidasJ. GuibasandJ.Stolfi. Ruler, compassandcomputer:thedesignandanalysisof geometricalgorithms.InR. A. Earnshaw, editor, Theoretical Foundationsof ComputerGraphicsandCAD, volume40 of NATO ASISeriesF,pages111–165.Springer-Verlag,1988.

[11] G. Hirota,S.Fisher, andM. C. Lin. Simulationof nonpenetratingelasticbodiesusingdistancefield. Technicalreport,Departmentof ComputerScience,Universityof NorthCarolina,2000.

[12] K. Hoff, T. Culver, J. Keyser, M. Lin, andD. Manocha. Fastcomputationof generalizedvoronoi diagramsusinggraphicshardware.Proceedingsof ACM SIGGRAPH1999, pages277–286,1999.

[13] K. Hoff, A. Zaferakis,M. C. Lin, andD. Manocha. Fast andsimplegeometricproximity queriesusinggraphicshardware.Proc.of ACM Symposiumon Interactive3D Graphics, 2001.

[14] M. Hughes,C. Dimattia, M. Lin, and D. Manocha. Efficient and accurateinterferencedetectionfor polynomialdeformationandsoftobjectanimation.In Proceedingsof ComputerAnimation, pages155–166,Geneva,Switzerland,1996.

[15] K. Sridharan,H. E. Stephanou,K. C. Craig andS. S. Keerthi Distancemeasureson intersectingobjectsandtheirapplications.In InformationProcessingLetters, Vol. 51,Aug. 1994,pp.181-188.

[16] R. Kimmel, A. Amir, andA. M. Bruckstein. Finding shortestpathson surfacesusinglevel setspropagation.IEEETransactionson PatternAnalysisandMachineIntelligence, 17(1),1995.

[17] D.L. MarcumandN.P. Weatherill.Unstructuredgrid generationusingiterativepoint insertionandlocal reconnection.AIAAJournal, 33(9),September1995.

[18] S. J. OsherandJ. A. SEthian. Frontspropagatingwith curvaturedependentspeed:Algorithms basedon hamilton-jacobiformulations.J. of Comp.Phys., 1988.

[19] J.A. Sethian.LevelSetMethodsandFastMarchingMethods:EvolvingInterfacesin ComputationalGeometry, FluidMechanics,ComputerVision,andMaterialsScience. CambridgeUniversityPress,1999.

[20] A. Wilson,E. Larsen,D. Manocha,andM. C. Lin. Partitioningandhandlingmassivemodelsfor interactive collisiondetection.ComputerGraphicsForum(Proc.of Eurographics), 18(3):319–329,1999.