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.
This worked okay, although there were intersection issues within the wing membrane itself since the geometry was double-layered:
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.
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.
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.
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.
(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.
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: