1 / 41

Animacija tkanin

Animacija tkanin. (Cloth animation). Demo. Primeri animacije tkanin. Demo. Kakšna blaga imamo?. 2 osnovni obliki: pletenine in tkanine Omejimo se na tkanine. Proces tkanja. Osnove modeliranja tkanin. V splošnem se tkanine upirajo premikanju v 4 smereh. Raztegovanje v ravnini.

Télécharger la présentation

Animacija tkanin

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Animacija tkanin (Cloth animation) Demo

  2. Primeri animacije tkanin Demo

  3. Kakšna blaga imamo? 2 osnovni obliki: pletenine in tkanine Omejimo se na tkanine Proces tkanja

  4. Osnove modeliranja tkanin V splošnem se tkanine upirajo premikanju v 4 smereh Raztegovanje v ravnini Krčenje v ravnini Upogibanje iz ravnine Striženje v ravnini

  5. Osnovni model mas in vzmeti

  6. A whole line of points attached together with springs Simple to model, great for making realistic straps of bullets for chain guns, tails on animals, bungie ropes. The springs have a normal length of, say, one unit. If the adjacent points move further than one unit of length apart, they experience a force towards each other proportional to the extension of the spring that connects them. Likewise, if they move closer than one unit apart, they experience a force pushing them apart. Strune

  7. Two ways to model the force on the points With mass  If you are creating animations Without mass  If you are just trying to find the optimum shape of a string hanging over a certain object Strune Forces between Two Springs

  8. Strings without Mass Forces affect the position of the point i Normal length Small amount (0.01 or so): makes the string move slowly gravity

  9. Strings with Mass Forces affect the velocity of the point i • If you make a string like this, you will notice that it is extremely flexible. • To make it stiffer, you can compare each point with its 4 or even 6 closest neighbors, instead of 2. Damping (between about 0.95 and 0.99), is the energy loss from the string. If you set it to 1, then the string will never stop swinging around, and setting it to more than 1 will make the string increase its swing by itself and eventually fly off the screen.

  10. Simply a whole load of interwoven strings! We need to add an extra dimension to our string routine. Imagine a cloth to be a sheet of points all connected together by springs. If two points get pulled further apart, then they experience a force pulling them together and vice versa. This very simple model of a cloth is reasonably accurate! Tkanine (cloth)

  11. Obnašanje tkanine If you compare each point with its 4 nearest neighbors  a fisherman's net. If you compare each point with its 8 nearest neighbors  a very flexible cloth If you compare each point with its 24 nearest neighbors  a more realistic, stiffer cloth, though it's much slower to compute

  12. Every point on the cloth moves at a rate proportional to the sum of the forces acting on it from the neighboring points. Create a 2-dimensional array of co-ordinates to hold the x, y and z positions of the cloth in space. Initialize the values of cloth(p,q) to (p,q,0). We will need two of these arrays. One to hold the current state of the cloth, and the other to hold the new cloth that is being calculated. When we have finished calculating the cloth, copy all the values from our second array back to the first. Tkanina brez mase

  13. cloth1 (0 to 31, 0 to 31) cloth2 (0 to 31, 0 to 31) Variables: VECTOR: MovementVector VECTOR: SpringVector VECTOR: ForceVector VECTOR: Gravity (initialised to (0, 0, g) where g is gravity, 0.02 is a good number) REAL: Length REAL: ForceScaler REAL: NormalLength

  14. For every point (p,q) on the cloth: MovementVector = Gravity For each of the 24 neighboring points: SpringVector = (position in space of neighbour) - (position in space of point (p,q)) Length = length of SpringVector NormalLength = The length SpringVector would be if the cloth were unstretched ForceScaler = (Length - NormalLength) / NormalLength SpringVector = SpringVector * (1/Length) ForceVector = SpringVector * ForceScaler ForceVector = ForceVector * SmallAmount add ForceVector to MovementVector end of loop Add MovementVector to cloth1(p,q) and store it in cloth2(p,q) make sure this point does not move inside an object end of loop Copy all the values in cloth2 to cloth1 keep doing all this forever

  15. We will need some objects for the cloth to interact with. The simplest is a floor. Check each point on the cloth to see if it is below the floor, and if it is, then move it to the surface. It is quite easy to make a sphere for the cloth to fall over! Check each point to see if it is inside the sphere. If it is, then move it to the nearest point on the surface of the sphere. Tkanina, ki interaktira z objekti

  16. Cloth with Sphere REAL: Distance Distance = distance from the point(p,q) to the center of the sphere if Distance < (radius of sphere) then: ForceVector = (position of point in space) - (center of sphere) ForceVector = Forcevector / Distance * radius point(p,q) = (center of sphere) + ForceVector end if

  17. Adding wind to the cloth allows us to simulate the fluttering of flags and other cloth+wind kind of situations. This model is not totally accurate. The wind affects the cloth, but the cloth does not affect the wind, to do this would require a vast amount of fluid dynamic calculation. However, it produces reasonable looking fluttering effects. For this we will need to be modeling cloth with mass. Dodajanje vetra

  18. First the cloth must be broken down into triangles. This is easy to do, since the cloth is already described as an array of points. The effect of the wind on the cloth is calculated on each of these triangles individually. At each point of the cloth, the sum of the effect of the wind on the surrounding triangles is calculated. Dodajanje vetra

  19. The force acting on a triangle due to air molecules bouncing off it will always be in the direction of the normal vector of that triangle. The normal vector for each triangle will obviously have to be calculated every frame because it will be constantly changing. Dodajanje vetra

  20. The force will be proportional to the surface area of the triangle, the angle at which the wind hits the triangle, and the speed of the wind. When we use the Cross Product to calculate the normal vector of the triangle, the length of that vector is proportional to the area of the triangle, which makes things a little simpler. Dodajanje vetra

  21. VECTOR: force VECTOR: normal VECTOR: wind set force vector to (0,0,0) on all points on cloth loop through all triangles force = unitvector(normal) * dotproduct(normal, wind) add force to all points making up this triangle end of loop loop through all points on cloth add gravity to force add force to velocity end of loop -- rest of cloth routine --

  22. Osnovni problem Ko potisnemo del tkanine na ta način: pričakujemo to: Vendar bi v našem modelu z delci morali uporabiti močne sile krčenja, da bi dobili pomembne premike izven ravnine. To pa je “drago”.

  23. Togost v navadnih diferencialnih enačbah Primer navadne diferencialne enačbe: Analitična rešitev je: Še stabilna Rešujemo jo z Eulerjevo metodo: nestabilna Kaj se zgodi, če je

  24. Togost v tkaninah V splošnem se tkanine v ravnini malo raztegujejo Raztezanju nasprotujejo močne sile in je zato v tem smislu tkanina toga. Temu bi se radi izognili.

  25. Izogibajmo se togosti Alternativni pristop je, da uporabimo mehke vzmeti in “fiksiramo” rešitev na koncu časovnega koraka. Uporabljamo impulze in Jacobijevo iteracijo iteracija 1 iteracija 2 iteracija 3 (konvergirana)

  26. Metode, osnovane na delcih Model, osnovan na energiji Iščemo končni položaj z minimizacijo celotne energije v tkanini Ni dinamično!

  27. Odkrivanje trkov • Numerična kompleksnost • Izhaja iz velikega števila poligonov v mrežah objektov • in iz potrebe po hitrem ugotavljanju trkov med poligoni

  28. Odkrivanje trkov Spoznali smo to že pri objektih, ki se lahko deformirajo. Veliko teh metod velja tudi v tem primeru. Običajno moramo opraviti teste trkov trikotnik- trikotnik. Trk stranice s stranico Trk oglišča s ploskvijo

  29. Robustna detekcija trkov Če se trikotniki gibljejo prehitro, lahko prečkajo eden drugega v enem koraku To lahko preprečimo, če preverjamo trke med korakom. Tako trk oglišča s ploskvijo kot trk stranice s stranico nastopita, če so 4 točke v isti ravnini (so ko-planarne)

  30. Robustna detekcija trkov (2) Odkrivanje trenutka ko-planarnosti – med časovnim korakom predpostavimo linearno hitrost Problem se tako reducira na iskanje korenov kubične enačbe: Če najdemo te korene, nadaljujemo s testom soseščine trikotnikov

  31. Odziv na trk • 4 osnovne možnosti: • Temelječ na omejitvah (constraint based) • Kazenske sile (penalty forces) • Temelječ na impulzih • Dinamika trdnih teles

  32. Odziv, temelječ na omejitvah • Predpostavimo povsem neelastičen trk • Delec omejimo na lego na površini trikotnika • Prednosti: • hitro, ne vnaša togosti (stiffness) • Ni potrebno dodatno dušenje • Slabosti: • Podpira le trke oglišč s ploskvami • Omejimo stik, sprostitev vnaša nezveznosti (Težko dobimo prave konstante) • v splošnem ne moremo ugotavljati trkov s samim seboj • Povzetek: dobro za začetek, vendar premalo robustno za popolno izvedbo

  33. Kazenske sile • Uporabimo silo vzmeti, ki odriva delce med seboj • Prednosti: • Enostavno vstavljanje v obstoječi simulator • Uporabno za vse vrste trkov (uporabimo baricentrične koordinate za porazdelitev odziva med vozlišči) • Slabosti: • Težavno uglaševanje (če je sila prešibka, včasih ne deluje, če je premočna, bodo delci “lebdeli” ali “vijugali”

  34. Impulzi Hipna sprememba gibalne količine • Običajno uporabimo izven časovnega koraka simulatorja • Prednosti: • Korektno ustavi vse trke (nobenih splolzkih sil vzmeti) • Slabosti: • Numerično potratno • Slabo obravnava stalen stik

  35. Impulzi (2) Za odpravljanje vseh trkov moramo v splošnem uporabljati iteracije

  36. Trki trdnih teles • Osnovna zamisel: Če skupina delcev začne brez trka in se med časovnim korakom giblje kot trdno telo, tedaj končajo časovni korak brez trka. • Delce, ki so vključeni v trk, obravnavamo kot skupino in jih premikamo kot trdno telo (rigid body)

  37. Trk trdnih teles (2) • Metoda je povsem zanesljiva • Moramo iterirati, združevati cone trka (dokler cona trka ne vključuje vse delce, ki so trčili) • To metodo uporabimo kot izhod v sili, saj trdna telesa za prikaz tkanin niso privlačna.

  38. Kombiniranje metod Imamo torej: Kazenske sile (penalty forces) – niso robustne, nevsiljive Impulze – robustno (posebno z iteracijami), vsiljivi , vendar lahko ne konvergirajo Cone trdnih trkov - povsem robustno, zanesljiva konvergenca, vendar zelo vsiljivo Rešitev? Uporabimo vse tri metode

  39. Kombiniranje metod (2)

  40. Trk sam s seboj (selfcollision) To je trk med primitivi istega objekta (iste ploskve) Trke sosednjih algoritmov odkrivamo z običajnimi algoritmi Hočemo učinkovite algoritme Pri skoraj ploskih ploskvah ne prihaja do takih trkov Do trkov same s seboj prihaja le pri dovolj ukrivljenih ploskvah

  41. Učinkovito odkrivanje “samo-trka” Kombiniramo teste obsegajočega kvadra in teste ukrivljenosti

More Related