Blender

Durian DVD

Follow our progress!

  • on Twitter
  • on Identi.ca
  • Follow our commits on Twitter!

    “Wing Simulation” or “Gaaaaaah…”

    on July 5th, 2010, by nathan

    On Big Buck Bunny we did the wings of both the flying squirrel and the bird with hand animation. In the case of the bird, that went really well. But for the flying squirrel it imposed a lot of limitations on us and made things just generally a huge pain for both animation and rigging.

    So for Durian I decided to use cloth simulation for the membrane of the dragon wings. This has led us down a long, winding, extremely annoying road. I thought it was going to be easy. Little did I know…

    —-

    The early tests of the dragon wings went quite well, as you can see in the video below. The wings were simulated in a separate mesh, and then mesh-deform was used to transfer those deformations to the dragon mesh.


    early_wing_tests.ogv

    This worked okay, although there were intersection issues within the wing membrane itself since the geometry was double-layered:

    Here is a crappy diagram of a cross-section of the arm/wing geometry, and what happens when the wing membrane gets deformed:

    There were also intersections of the wing membrane with the body.

    For the final setup I added a body collision object so that the wings wouldn’t intersect with the body, and I also added a displacement modifier to “puff” the wings out to resolve membrane self-intersections:

    This sometimes looks weird, but it seems we’re able to get away with it in most shots.

    We also used an awesome new feature of Blender’s cloth sim that lets you specify a shape key as the “rest” shape of the cloth. This, for example, lets me make the wing membrane taut (in the initial tests above it was too loose) even in the default pose of the model simply by making a shape key where the membrane is shrunk and assigning that as the rest shape. It also helped me tweak other simulation issues, where the wing membrane would sometimes bend in ways that looked weird.

    Here are some silly tests of the feature. The first shows a cube whose base shape is quite small, but I’ve set its rest shape to be quite large. So when the simulation begins, it explodes.


    cloth_kaboom.ogv

    The second shows the opposite. The base shape is large, but the rest shape is small. This causes the cloth to shrink-wrap over the monkey head when the simulation starts.


    cloth_shrink.ogv

    —-

    After all of this I figured it would be clear sailing! But not so. Doing simulations in the actual scenes turned out to be a hair-pulling exercise.

    First we had to make wing sim work with linked models. Fortunately this turned out not to be quite so bad. But we had to set things up with Python. You can only modify linked properties through python, and even then they don’t get saved to disk and will revert upon reloading the file. So what Campbell did was he created some scripts that run every time the blend file is loaded that set the appropriate properties to the appropriate values. It works like a charm, although it’s quite production-specific. At this point Campbell has made scripts that even go through and bake all of the wing sim in a batch process. It’s pretty sweet. But, again, very techie and production-specific.

    It would be nice to find a more general and user-friendly solution to all of this in the future.

    Anyway, once we got that working our problems weren’t over. Managing collisions for cloth sim is extremely tedious, and requires making sure that there are no intersections at the beginning of the simulation, and that no forced intersections happen during the simulation.

    A simulation can easily start with intersections. We have very basic rigging on the wings that just gets them in roughly the right position as a starting point for the simulation. Often this basic rig causes the wings to intersect with the body or themselves depending on the dragon’s starting pose.

    starting_intersection

    To combat this we’ve been going into every animation file with the dragon and–before the start of the animation–creating a 30-ish frame transition between the default pose (guaranteed no intersections) and the start pose of the animation. And then we include those frames in the simulation. This is pains-taking and annoying, and it makes our simulations take longer. But it usually gets the job done.

    The other problem that can happen is forced intersections. This can happen a lot, since animators cheat a lot. And animators should be able to cheat. But unfortunately they can’t in this case. What can happen is, say, the rigid hand-animated parts of the wings might penetrate the dragon’s body, and the cloth sim has no way to deal with the properly. It literally forces the wing membrane to intersect.


    cloth_sim_snag.ogv

    (Yeah, this is contrived, but it shows the problem more clearly than the actual production examples.)

    And once that intersection happens, it gets stuck. It can’t get free without quite a bit of force. It “snags” on the dragon.

    To combat this problem we do the simulations once, see if anything snags, and then go try to fix the forced intersections in the animation. This is also really pains-taking and annoying.

    And part of the problem with these two issues is that no matter how correct or accurate the collision detection in Blender is, these two issues will persist.

    A shout-out to the Blender devs: if anyone is interested, there is a cool paper from Pixar and a related paper from Stanford that address precisely these issues. If we could get that sort of functionality into Blender, it would go a huge way towards making Blender cloth really production-ready. Far more so than having more “correct” or “accurate” collision detection in the traditional sense. Forced intersections and starting intersections are a fact of life in production, and really need to be addressed directly. I will be forever indebted to anyone that takes this on.

    But even with all of that taken care of we still have lots of problems. Like the wings disappearing or exploding.


    08.2r_messed_up.ogv

    And in those cases I’ve just been running the exact same simulation over and over again. It gives different results somehow. And I just wait until I get one that doesn’t explode or disappear. It would be cool to get this fixed as well. πŸ˜‰

    In the end, I think it’s been worth it. We’ve identified some important areas of cloth sim that need to be improved, and this will be helpful to developers in the future. And with a bit of hair-pulling we’ve managed to get some pretty good results:


    08.2r.ogv

    β€”Nathan

    59 Responses to ““Wing Simulation” or “Gaaaaaah…””

    1. Davis Says:

      No wonder Joe Eagar was hired to help with cloth!

    2. D Says:

      Yay! Finally a cloth post! πŸ˜€ Thanks for the in-depth insight, Nathan! Thanks to all the team for going through all that so we one day won’t also have to!

      And finally a dragon video! Awesome! πŸ˜€ Hoping that was a sped-up version of the dragon snapping.

    3. Vending Says:

      arf! arf! Cloth bending sure is fun, right πŸ˜€ –sorta like airbending, water bending and fire bending.. oh ooh!! and earth bending too πŸ˜€

      oh yeah.. fabric bending can go places >.>

      -on a more serious note : Congrats guys!

    4. J. Says:

      Seems to be a hell of a job, but I have full confidence that it’s gonna look awesome on the silver screen!

    5. J. Says:

      @Vending:
      Coming soon: The Last Dragonbender
      Starring: Nathan Vegdahl πŸ˜€ πŸ˜€ πŸ˜€

    6. Tim Blokdijk Says:

      Still, compared to Franky’s wings.. visually cloth simulation > hand animation. And I’m quite willing to sacrifice some of your hair for the result. πŸ™‚

    7. J. Says:

      Then I hope he washed it! πŸ˜‰

    8. Alex_blender_juca Says:

      Well done guys! This all looks challenging im still wondering how the hell to model reali complicated models than render them. Bt u guys rock whoop whoop!

    9. Consideringthepickle Says:

      “But even with all of that taken care of we still have lots of problems. Like the wings disappearing or exploding.”
      It sounds like you guys have been having a lot of fun over there.

      It looks well worth it.

    10. JuppieOnTheRocks Says:

      Nevertheless, the dragon itself looks awful!!
      Just like a bat!! A lordly dragon looks different.

    11. Xels Says:

      Interesting and entertaining post I must say. I always thought “pros” like you don’t cheat around, but you guys also got tons of problems which seem insurmountable. It makes me feel a bit better πŸ™‚

      @JuppieOnTheRocks: Yes, I’d also took another style for the dragon, also I would want Sintel to be more realistic, not this slighty comic/anime style. But overall it isn’t bad in my opinion.

      What would be interensting too would be a blog post about smoke-sims *hint* πŸ˜‰

    12. belich Says:

      wow!!
      thanks for this tour on the produccion, really usefull info!

      i hope that cloth sim would be improve by some one too, also would be nice to have tearing cloth.

      great work

    13. nawabz Says:

      wow excelent. ive been waiting for more developement in this field.

    14. Dennis Says:

      The final reslut is awesome!

      How much time was schedule for this part(the wing simulations)?
      You must have went far beyond what you had in mind at the first place. Strong of you to getting trough such a issue. I’m impressed.

    15. ZeroO Says:

      Wow Nathan!

      How on earth did you manage to blog that, AND smile to Beorn’s camera at the same time!?

      You are the greatest!

    16. Lyle Walsh Says:

      Thanks for documenting this so well. So many of us have had troubles with cloth its really nice to see you working hard on the system.

      Soooo: could you make a list of tips for us? eg things to avoid, ways around certain problems (eg your pre-roll for the sim start) etc.

    17. Snapai Says:

      Good to see you all mentioning the Pixar untangling paper, I was reading the problems you were having and immediately thought “Huh, sounds like no-one’s implemented Pixar’s flypapering/detangling methods yet”.

      Here’s hoping someone gets it coded for everyone- I remember a classmate in college going through all the frame-by-frame fixing you’re dealing with – it was a staple chore of clothsims prior to Pixar’s paper.

      (Hey, if you have any idea how they did the drag-the-mesh rig towards the end of http://graphics.pixar.com/library/HarmonicCoordinatesB/HarmonicCoordinates.divx – at 4:32 – that’d be awesome to know too! Never seen a rig mesh where you could just grab any part and it would move-as-if-jointed before. Not the actual harmonic coordinates thing, but where he says “I crudely articulated the cage” and then makes it behave better than ANY animation rig I’ve ever worked with)

    18. oxigen Says:

      Oh, thank you Nathan that you pulled that out! I didn’t want to bother coders for a ‘feature requests’ when i used cloth sim once.. πŸ˜›

    19. ralmon Says:

      I don’t want to trouble you but… I guess your experiencing the problem already. I have this problems since months ago. I was trying to simulate a thick quilt draped to a person sleeping. I thought it would be quite straightforward, just apply cloth simulation. How hard could it gets? … It was near impossible!

      I made tests first with a subdivided plane that I extruded to add thickness and drape it over a sphere… and all test went horribly wrong. There are intersections happening all over, and if I turn on self collision it explodes into a pillow form and then rest to a shapeless mess. I think I made a request at thinker code about simulating thick fabrics for situations like this.

      I wonder if softbodies will work better but I get tired of experimenting and deemed the venture a failure.

    20. B.Tolputt Says:

      Interesting article, light on the technical details (though I’m looking into the two papers linked for my mathematical fix -laugh-) but showing some interesting improvements on the basics.

      The rest shape idea is pretty cool and I will be looking into how it can be used in other ways. I will be most interested in seeing how the cloth performs visually in the movie. The videos here are somewhat minimal on that (for good reason), so seeing how the tweaks and hacks worked out in the end will be nice.

      The reason I mention this is that I’ve seen the use of “cloth as a membrane” simulations look pretty sub-par before (in non-Blender animations), so a decent result here would be good to validate the method.

    21. Domy_graphy Says:

      this time I have the dragon project ..
      thanks for Confidently

    22. loramel Says:

      Oh my, this is like a dejavu. I can relate to each and every point you made here, especially the hair pulling.
      I had hoped that the blender 2.5 implementation is more usable than in 2.49, but it seems you have to fight the same issues, although the shape key definition is a col thing to have.
      I have gone through the exact same iterations and solutions in my current project (python scripting substituted with manual work πŸ™‚ ) and your post is a good confirmation, that there doesn’t seem to be a better way.
      Any way the result you produced was worth the effort I would say.
      And I wonder how many your hair you left on your scalp for the (I guess) similar tedious work with the hair simulation ….

    23. Jonathan Merritt Says:

      If I’m reading it correctly, the proposed algorithm requires quite robust computation of mesh self-intersection. If I had the time, this is where I would start. With robust implementations of all the mesh intersection requirements, the rest of the algorithm looks straightforward (but time-consuming, of course).

    24. maskotti Says:

      See, that’s really the problem with these open movies – problems are found, but not fixed! πŸ™

    25. notmaskotti Says:

      @maskotti: they do find and fix *many* problems, for bigger ones as this one, the time doesn’t allow to fix them properly, but before these open movies the problems were not found even!

    26. nathan Says:

      @maskotti:
      What notmaskotti said.

      A lot of issues have been addressed in Durian. And especially we’ve gotten 2.5 pretty much back up to 2.4x levels, which was a huge undertaking. You have to think of 2.5 itself as being one of the “features” of Durian in this case.

      But yes, there is still a long way to go before cloth simulation (and I dare say simulation in general) in Blender is really production ready. I would not want to use cloth/hair sim in its current state on another production.
      But we’ve managed to identify a lot of the issues that need to be resolved, and we have demonstrated that they need to be resolved, and that’s pretty huge. I am confident this issues will be resolved in due time, at which point we’ll have pretty kickin’ cloth simulation.

    27. acro Says:

      Nathan, every Blender user in the world thinking of using cloth, even users who don’t know it yet, appreciate the pain you’ve gone through so that somehow, some day, we won’t have to! Seriously, thank you.
      I’d find it very interesting to hear a similar level of detail on how you all got on with controlling (and/or rendering) Sintel’s hair, as I’m sure someone has mentioned issues with that, and the Pixar reference above reminded me of their Volumetric Hair paper which I’d read with great interest last year.

    28. dd Says:

      where’s Joe Eagar ?, working hard for cloth?

    29. JustinBarrett Says:

      I would have used cages, and shape keying, with some cloth sim blending…..but that is a workaround and hardly the point…thanks for sharing.

    30. gimcan Says:

      @ dd:
      yes, I second that, where is Joe? Is he still at the institute working on particle/cloth? Or when he left, if so?

    31. Ton Says:

      Joe would only be here for a few months, he’s back home again!

    32. coleril Says:

      Oh, bit of a sad news, I think his help to the team has been very important past months, but………. this should mean he can come back to coding B-Mesh, right? πŸ˜‰

      Yu-huuuu!

    33. jirms Says:

      Wow! As a blender newbie I am amazed at the amount of work that has to go into something like this!

      Now that I have revealed that about myself I have a question someone will hopefully be kind enough to answer. I have skimmed the whitepapers by pixar/stanford and am imagining a totally different solution by implementing a cloth “thickness,” “fold” and “crease” algorithms – as I write this I am looking at the flabby part of skin between thumb and index finger moving my fingers around. Basically the idea would not be to eliminate the problem but improve control over it.

      Would alternative workarounds like this be welcome?

    34. Vending Says:

      Blender is slowly tipping the scales *hint hint* in 3d land.

    35. LordScorp Says:

      Hey guys, I was so anxious about this post… cloth is one of my favorite features in Blender.
      I’m pretty sure you all are having a lot of trouble on solving this new version issues, yet I know you can do it! =D
      That’s it, keep up the good work and this awesome animation will be as cool as we all expect =]

      Regards

    36. Nik Says:

      Was doing the hair also as β€œGaaaaaah…” as cloth? I hope it gets better eventually… This shows how Durian is not only a movie project, but also a way to test the software in a real production environment and iron out all the bugs.

    37. rogper Says:

      WARNING
      Silly comment follows, read at your own risk:

      Something cool for cloth would be a force field that would be a mix of the Cloth, Solidify and Lattice modifier. Cloth Simulation algorithm would run only in a simple flat mesh and then the lattice would deform everything we put inside the “force field”, cloth, pockets, zips, etc accordantly πŸ™‚

      Please don’t complain you were warned πŸ˜›

    38. BX Says:

      Should you add some wind facing the direction of the movement to simulate air resistance, since wind gonna fill the wing when moving quickly.

    39. Bert Says:

      I ran into a lot of these same issues when doing my own personal animation in 3ds max. But in max there were a lot of ways to control the simulation. It was still a pain in the ass.

    40. TechMage89 Says:

      I think the bottom line is that cloth is hard: not all that surprising. Fortunately, it seems like all this mucking around has allowed the team to collect significant data on a number of ways the cloth sim can fail spectacularly :P. This ought to help the devs make the cloth sim fail less spectacularly :P.

      I have to imagine simulation requires a lot of time, testing, and expert manpower to get right. I’m eager to see how the Blender devs can improve it in the future, because it looks very promising, even if it is a bit flaky in the real world.

    41. Eibriel Says:

      “To combat this we’ve been going into every animation file with the dragon and–before the start of the animation–creating a 30-ish frame transition between the default pose (guaranteed no intersections) and the start pose of the animation.”

      I’ve see this technique on Star Wars (or some other major production) behind scenes XD. Is not too bad πŸ˜›

    42. Jeroen Bakker Says:

      Nathan,

      thanks for the post, it has a lot of interesting stuff in it. I was wondering if the clothsim was designed to have a a “cloth intensity texture” and a “initial simulation force texture” to identify what parts of a mesh should be influence by the clothsim. How much problems would be reduced. You have one manageable mesh, the full mesh would be inside the clothsim. And parts can be influenced by animators.

      You still need to solve tons of probs, but perhaps it will be more suitable for skins-like simulations.

      Cheers!

    43. max Says:

      good luck!

    44. Kai Kostack Says:

      Nice article. I can remember facing the same self-intersecting wing problems half a year ago, when I’ve done the trailer for ZOTAC. Luckily I didn’t had to do as many dragon shots as you. πŸ™‚

    45. Giovanni Lanfiuti Says:

      Couldn’t you only simulate a single side of the wing and then simulate the other one with the previous side only working for collision? It wouldn’t be so realistic, but from the camera you usually see only a side of the wing…

    46. OneEyedOdin Says:

      Ahh. For a minute I was expecting to hear the bad news:

      “Soo… we decided to just scrap the ‘dragon with wings’ idea and go with a ‘land’ dragon. The cloth stuff can wait til next project.”

      I’m glad you all decided to just pull through.

    47. Dwayne Says:

      solution: go film a real dragon and comp it in… :/

    48. creek23 Says:

      The Kaboom and the Shink-wrapping could actually be used for animation effects. Haven’t thought of one practical purpose, yet, but the effect is there.

      Good job on accidentally producing those effects!

    49. nathan Says:

      @jirms:
      I think you may misunderstand the problem. The problem is forced intersections. Like, imagine a character wearing a shirt, and another character poking him in the chest. If the finger intersects with the chest even a tiny bit (and animators often want to do this to give a better sense of contact), it would force the shirt to intersect with either the chest, the finger, or both. These sorts of forced-intersections are important for the cloth system to be able to handle gracefully.

      @Giovanni Lanfiuti:
      We already only simulate a single layer. But we have to transfer the deformation of that single-layer simulation to the double-layer membrane of the model. And it’s that transferring process that introduced the subtle self-intersection.

      If we simulated both layers then we would get all kinds of weird problems, since they would move independently.

    50. Stephen Says:

      I’ve been having some fun using the soft body instead of the cloth for creating some wings, the length value can keep it tight and you can also set some of the verts to bones, to gently persuade the membrane to go the direction you want… I am a complete noob to this though, so there probably are many reasons why you need to use the cloth instead, I’ll see if I can come up with some good examples.

    51. kopi Says:

      I hope there will be a decent tutorial on all this exciting stuff!

    52. Stephen Says:

      Had a quick play with the soft body for wings during me dinner break, took about 30 mins: http://vimeo.com/13179083

      Kopi, I’d say the best way to learn the cloth and soft body is set up a test rig, and change the values one at a time, its a shame that the soft body doesn’t have a preset like the cloth… been working on my jiggle physics πŸ˜€

    53. jirms Says:

      Thank you Nathan! Sounds like my plan of building an AI that uses weight painting to control cloths was a fairly dumb idea. From a programming standpoint it sounded fun though.

      If I understand the problem correctly now we are talking about polymorphism / decoupling Object Oriented concept issues. If you want to see programmers cry tell them this should be easy …

    54. wo262 Says:

      hey. i found some secrets. this is AWWEESSSSSOOMMMMMA’H http://www.licuadorastudio.com/blog/wp-content/uploads/2010/07/sintel_5.3b_0129_compara.jpg
      http://www.licuadorastudio.com/blog/wp-content/uploads/2010/07/sintel_5.3a_0076_compara.jpg
      post MOAR please

    55. D Says:

      SECRETS YEEEAAAAAHHHHHHH!!!!!!!!
      πŸ˜€

    56. jay Says:

      off the top of my head, this would be a nice use-case scenario for the use of bones with dynamic constraints. One could rig the wing membranes with bones, animate it, bake the animation, then simply tweak the bad parts. Might be something more feasible for the mechanical-minded among us. If anyone is interested in this concept I can make up a mock up.

    57. Cedal Says:

      hey
      first thing to be said is that you all are doing a great job there in Amsterdam(n).
      second thing is in the screenshots it appears to be some rain in Sintel… will we be able to animate rain easier than now? Because the reactor particle system is gone now in 2.5 I don’t really see how you guys do that.
      greats cedal

    58. Stephen Says:

      Tried using cloth, it was a real pain, any reason you diddn’t use soft bodies? it was quite easy to do this batwing, and diddnt have the intersection issues:

      http://vimeo.com/13280878

    59. shashu Says:

      Nice technique