Dark Side of the Sun

Wednesday, November 25, 2009

In Defense of Proceduralism

When we have to do something in CG animation/VFX nowadays, be it modeling, animation or many other tasks, we are faced with two main ways to go about it:
  1. Manual
  2. Procedural
To explain the differences, I will use an example. Suppose that the goal to achieve is to place 10 trees on a hilly landscape:
  1. If we do a copy of a tree, then manually place it at some point of the landscape, making sure that it is in the right vertical position (not above or below the landscape's surface), then make another copy, place it, and so on until all 10 trees have been placed, that would be a manual approach.
  2. If we create a script which automatically creates the 10 copies, and places them at random points of the landscape, making sure they are correctly placed on the surface, that´s a fully procedural solution.
A middle ground would be to manually make the 10 copies (to modify them, for example, and make them different from each other) and then use a script to place them on random points of the surface. We can easily think about many more combinations and degrees of proceduralism in between.

Despite the title of this post, I have to say that some tasks are more suited to a manual approach, while others would be impossible to do without a high degree of procedurality. In my actual specialty as FX TD, proceduralism rules my world! Just think particles... the fully manual way to animate particles would be to hand-keyframe every one of the 1,000,000 raindrops falling in your shot. That would be insane! And what if the client/supervisor/director asks for a change, and wants the rain to be angled sideways, instead of fall vertically... if you work 100% manually, you will shoot yourself before you get that shot approved! Of course, that never happens...

This brings me to state the two main advantages of procedural methods:
  1. Reproducibility
  2. Ease and Speed of adaptation to new contexts or changing client's requests.
To go back to our landscape & trees example: if the modelers change the landscape, and you had placed your trees manually, you need to move every one of them up or down so they are again on the surface, or even move them around so they are not placed in brand new weird spots of the landscape... whereas, if your aproach was procedural, you would simply run the script again on the new landscape, and it would be solved. Faster and less tedious (some of us humans don´t like to repeat the same task over and over, whereas computers just love to do that!)

To illustrate this, I will use another example. A real and specific one this time. Hopefully, this one will also throw some light as to why in some occasions the approach to take is not too clear, and how to spot the signs that will lead you to the right use of procedurality, in those cases:

Less than a week ago, I uploaded the Autumn Leaves MEL script to my website. As I have stated before, it is based on a technique I developed to animate/simulate leaves in the movie Planet 51. It all started with having to simulate a few leaves, still on the ground, being swept away by a broom. So I devised the proxies + wrap to high-res nCloth sim technique that makes the core of Autumn Leaves. But I first tested it manually, making copies of the lowres and highres, grouping them, moving them about, then combining the low-res, setting nCloth sim, then applying wrap deformers, etc... until I had 4 or 5 leaves that moved the way I wanted and simmed fast enough. Then, I could have made the same with 10 or 20 more leaves, manually. That wouldn't have taken too long. But in the end, I wrote the script (which would be the prototype for Autumn Leaves), even though that took longer than setting the simulation for all the leaves in that shot manually. Why? 2 reasons:

  1. There were a couple more shots with leaves to do, where the same technique could be used (reproducibility). Making a script for only one shot is often not optimal. But once you have a procedural rig/script, making more shots with it can be extremely fast. So the more shots (or even different jobs!) you use a technique/element in, the more useful it will be to go procedural.
  2. A red alarm light switched on in my brain: What if the directors want any changes later? What if they want a different proportion in the different types of leaves, or just want more of them, or... a thousand changes like that could be asked for. My approach to optimize and combine all low-poly leaves into one single model and nCloth sim would severely complicate them... but if I did it procedurally, any change would be a piece of cake, and very fast to make.
And once again, proceduralism saved the day! The leaves models I was given were judged to be too small, and I was asked to make them much larger. It only took a few minutes to scale the base models up, run the script, run a new sim... change done. Just with that, and the speed at which I did the other leaf shots, the time I spent writing the script payed itself tenfold!

Got any good stories / examples about using procedural workflows? When did proceduralism save your day? When did you cry and wish you hadn't collapsed those stacks / deleted that history? When did you regret not taking the time to write a proper script, and then wasted 5 times more time doing modifications or doing the same thing over and over in other shots / jobs?


Matic3d said...

Nice summary. Procedural approaches have a lot of advantages, among those you listed as well as resource sharing, retasking, and re-use. The biggest down sides to me are 1) development time - often a good artist can get to a result much faster than a TD can build a procedural tool (although newer frameworks like Processing and ICE are cutting dev times down dramatically.) and 2) Subtle creative touches get lost - artists add detail and "feeling" into work as they create it where procedural tools tend to lose this human interpretation. This is an achilles heel which can be addressed by first having devs and TDs aware of the need for "artistic" input and also by developing procedural tools which take creative input and leverage it in a procedural fashion... using the computer to handle complexity while preserving human input to inject "creativity."

Mayec said...

Excellent comments and additions, Matic3d! I could not agree more with you. Indeed, the ideal solution is often-times a balance of procedural and artistic. Any good procedural tool/setup/rig should aknowledge this, and a TD should always have an eye on making their stuff as flexible and open as useful (too much can become daunting). That could probably lead to talking about another interesting topic (related to ICE, which you mentioned): modularity.

Masiakowski said...

I will discuss the procedural approach not in terms of the example (scripting the trees) but in a terms of a list of things in particular order that one can follow to achieve some sort of result.

Procedural approach is good when you are creating something with a larger group of people. Then everybody knows what they are supposed to do since everything goes along with 'the script', rules, list whatever it is.

For me, as a filmmaker and a production guy, proceduralism is a savior. It creates a frame within which I can move freely and get creative. Of course at the same time it limits the course of action to a single path since you can only follow a specific creation scenario. If I would use a free-from-frame way I would probably get more experimental, but that's just me. Going along with the filmmaking phases it makes easier to follow the whole process of creation so I think it's actually beneficial despite of the limiting factor.

Mayec said...

Masiakowski, that's also a very interesting point. Indeed, procedures are also a way to "script" people. :)

While being methodical and "procedural" about filmmaking can be seen by some as restrictive and limiting, it is percieved by more filmmakers (I'm one of them) as creatively stimulating and freeing. The planning/procedure-making is simply what we usually call pre-production, and is it not, often-times, where 3/4 of the movie is made?

Masiakowski said...

Exactly, I totally agree. Pre-production is the frame on which we paint... but for me it feels like that first step is actually the most extensive one, the biggest step forward for the film, the most creative since this is the time for the concept of the film to flourish and it becomes like a liquid substance full of ideas that could be used. Pre-production period contains the most significant decisions filmmaker has to make and therefore is crucial to the whole process. After all it's a world creation. That's what filmmakers do: create worlds. It takes a lot of time and intuition.

The liquid ever-changing substance of the film concept is intertwining, mutually connecting based on association (setting for the story and the plot itself is the binding factor for me). It's some sort of order in a chaos of creativity. As we're frantically trying to come up with a great concept, we mentally dive into these primal waters and find ourselves alone with the concept.

I think I bended the topic of proceduralism a bit into a slightly different direction...