Archive for Simulation
Two of 3 spots. “Evolution” was a small team, 3 weeks, lighting and effects with Softimage and Arnold.
I love small but intense projects like this.
“Run” was primarily Maya/Vray with a touch of ICE. The studio (Royale) is only 6 years old but advancing fast, and it’s been a real pleasure working with them. For their first exploration of ICE, Royale invited in some familiar SI friends – Ciaran Moloney, Steven Caron, Leonard Kotch, Billy Morrison and yours truly doing a first gig start to finish as a CG sup (which with guys like this mostly involved saying “go for it.”)
Like the Psyop “Telstra” spot, this commercial essentially required us to create a system for knitting cloth from massive numbers of strands. Leonard Kotch wrote a system which performs many of the same tasks as the Psyop “Entwiner” tool, but he took a slightly different direction, it was fascinating to compare how the two diverged. The progressive animation required for these two shots resulted in a pretty flexible and broad system, which we are currently using for the last of the three spots, which will wrap in production soon.
Royale has been an enthusiastic and fun group to work with and it’s been great getting to show a studio as strong as they are in design some of the possibilities ICE can bring to jobs like this. Expect to see some version of Leonard’s “LKFabric” system gifted to the community before long – very cool Royale, thanks! (They also throw good parties, their 6′th birthday celebration was impressive and… unusual.)
The simulation is “meh”, but it was a test. This scene wasn’t originally about particle clumping, either: that was just put in as a way for me to play with the idea but not really my original focus. I was using it as a testbed for a homebrew collision/bounce node, which functions, but in the end that part wasn’t anything particularly special or even sophisticated. The clumping part is more interesting in the long run.
Someone recently asked about clumping particles online, and I recalled that I had this scene on hand. So here it is, as built by yours truly while never intending it to be anything other than personal experimentation… with some comments put in after the fact.
The file (softimage2013 ~8mb): example_createParticleClusters
During the making of the film “Barnyard,” which happened to be around the time ICE was being first conceptualized and built, a number of effects were identified which were a challenge at the time. Some of those effects became some of the first demonstration compounds later, presumably Helge and others still had those challenges in mind… making footprints in mud, falling leaves, rain/snow interacting on characters etc.
One effect involved a bunch of hay getting dumped on a character. At the time Hans Payer completed the effect via some nice scripting and syflex tricks. Now in ICE it is pretty easy, so when a thread about a similar effect was mentioned on the softimage list, and so soon after I had done the post-sim tutorial, I gave it a quick go. They basically asked for a way to use strands with the “falling leaves” compound. Here’s the result… while the collisions are not accurate the way RBDs would be I hope it’s food for thought at least. :D
Caveat: like similar tricks using the post simulation tree, motion blur is a concern… this is the kind of “quickie” effect that can often get you by, but hero shots would take a lot more effort, for instance if you had to see clearly the fibers bend and react to collisions, collide with each other, accurate mb etc. That kind of difference in the details is why feature film effects can get so hairy – often you can’t get away with simple cheats like this one.
File: softimage 2013 .scn, 237 kb
So, we’ve made a strand circle which rings our original point positions from the simulation, now let’s make those circles align with the rotation of the simulated particle. In practice this is very, very simple. Just insert a “rotate vector” node after you calculate the coordinates on a circle for the strand points, and then use the particle orientation as the input rotation.
Ok, that was nice, but why did it work?
Point positions are vectors. Vectors are displacements:
This is one of the simple but critical concepts that is the real purpose for me writing this series of posts, because it’s a foundational way of thinking which lets you come up with solutions to problems every day.
What is a point? It’s a place, within a space. A particle can have all kinds of attributes, like color size and orientation. But a point is just a position, it only has a single value, a vector (x,y,z). In a manner of thinking, a point is a vector. The vector which describes a point is a direction and distance from the origin. It’s a displacement from that point of reference. When you talk about “global” and “local” space you are talking about different frames of reference, different points of origin from which to draw a vector describing points.
So, what we really did when we calculated an array of strand positions on a circle was make an array of vectors. Hence, rotating those vectors is really the same thing as rotating the strand point positions to match the orientation of our original particle. Points are vectors, they are offsets (or displacements) from an origin. And ICE is very, very good at doing stuff with
points vectors. You can call these manipulations vector math if you want, but that in itself doesn’t make it beyond your average artist, who like ICE are also very, very good at manipulating points. If you are an artist you already have an intuitive grasp of vectors! You just need to define some terms, so that saying stuff like “rotate a vector” translates to the visual adjustments you do in your head day in and day out.
Seeing stars… and why modulo is so handy:
Ok, cool. We have a bunch of strand rings centered and oriented where our simulated particles were. Let’s make the rings star shapes, as a way of talking about another useful technique in ICE (it’s useful all over in fact), making patterns via the modulo function.
Ok, a digression first – some housekeeping. By now you’ve realized this isn’t one of those step-by-step makes-a-scene tutorial, I’m discussing more and glossing over a lot of the details you may need to actually plug all this together. I really should have provided a sample scene earlier, I don’t want you focusing on plugging nodes together, the whole point of this is the underlying ideas. So here you go. A sample scene with nifty comments and stuff. If all you want is a scene that will make circles and stars, there you go. And it was made with an educational license, even. But if you want the ideas used so you can make all kinds of other stuff, well then dear reader, read on.
The modulo function is just an instruction to divide two numbers and pick out the decimal remainder of that division. If you feed a linear sequence of numbers (like the index of an array: 0,1,2,3… call any of these numbers “n”) into the modulo function, you get a value counting up between 0 and 1. You can use this to identify every “n’th” item in your list. In fact if you crack open ICE’s “every n’th particle compound etc you will basically see exactly this.) If you can do things every “n’th” time, you can make patterns. Think about it. Braiding hair, knitting, drawing a dotted line – making almost any pattern involves counting and every “n’th” count doing something differently. Modulo is how you do that kind of thing in ICE (and elsewhere. Hey, realflow has an ICE like system now. And it works in scripting too. This math stuff pops up everywhere. The big secret is this – it’s just a way of looking at things you probably already do really well.
I’m a visual thinker so when I was first learning about modulo I had to scribble on a napkin, with results something like this:
All a star shape is, is a pattern where we take every other point on our circle and change it’s radius. Now we know how to find every other point from our list (the array) of strand positions, so we just change the radius of the formula we used to make the circle for those points. And you get a star.
Ok, so just one last part to this tutorial, and a brief one – how to take the single circles we made and, using the earth-shaking power of ICE and the post-simulation region, turn that result into a lot of circles: all different and making little atom things like we see in the example video. And in fact, the example scene here already shows you how, so we’re not even going to do much besides discuss it and crack bad jokes. Cheers. – AM
The file (softimage 2013 educational, 1.2 mb)
“What happens in the post simulation tree stays in the post simulation tree”
A quick review: ICE operators are evaluated differently depending on where they reside in the construction history (also known as the operator stack or modifier stack.) When an ICE tree is under the modeling region it is evaluated every frame unless a simulation region exists – if it does, it is evaluated once. An ice operator under simulation is evaluated every frame, and all data is updated every frame. In other words, changes persist and appear in the next frame – if you move a point, in the next frame that change is reflected. And when an ice operator is in a post-simulation region, it is evaluated every frame but changes are discarded. The “lower” regions evaluated first, then each region “above” it in the explorer, like so:
This is very, very useful. You can have an entire simulation going in the simulation region, and then do stuff to it prior to display. For instance, you could cull out all particles which aren’t visible to the camera to reduce cache size and speed evaluation. You can calculate per-particle lighting prior to rendering it, to control lighting entirely within ICE. Or, in the example below, you can move points around without altering the original simulation.
Example: Strand shapes
Here’s an interesting “look” done entirely with strands in ICE. A typical particle simulation has been used as input for an ICE operator in a post-simulation region, which uses the simulation as a basis to draw many circular strands.
First, I made a very basic particle simulation:
Then, in a post-simulation tree, I drew the strands.
… So you can see that for this effect the bulk of the work was done in the post-sim ICE tree. I use the point positions and orientation from the simulation as a center point around which I add new particles with strands. In my next post I’ll show exactly what I did, but the point I’m getting at here is that things don’t have to end with merely a simulation. You can get into some very cool stuff by considering each frame of a simulation (or a cached result) as a starting point. You can deform your entire simulation, rig it to a character, light it, or perform housekeeping tasks like camera frustrum culling. You can even treat the entire simulation as a single unit and scatter it – they sky’s the limit.
A quick note about motion blur:
When I wax rhapsodic about the post simulation tree the most frequent argument I run into is that moving particles around in a post-simulation operator invalidates motion blur calculations. This is true. Motion blur is based on the velocity of a particle, which can be considered a vector from the previous point position to the current. In the post simulation operators, the previous location is unavailable… it’s like a dog’s sense of time, only what exists “now” has any meaning. So, you have to do some extra work if you need motion blur. Basically, you store the previous point position into a user variable which can be read by your post simulation ICE tree and use that information to calculate not only how you wish to move a particle, but how you moved it in the prior frame as well. From this you can calculate a valid velocity to pass to the renderer for motion blurring. That sounds awful, but it’s not really that bad. (Still, it would be handy if the devs gave us an easier workflow than this, for instance could they store and give us access to post-sim point positions and velocity or something?)
We will look at creating the offset strand shapes – circles, stars etc. Stay tuned!
Pretty basic. Shows how you can use a user attribute to effectively create “states” of a simulation without relying on the state machine. Also contains a compound which is part of my regular toolkit, which forces particles and strands onto the closest surface. Like I said, basic stuff, but thats what these examples are… here it is in case anyone could use it for learning or whatever.
Scene (Softimage 2013, .zip) – example_RainOnBunny
The stanford bunny has a hard life.
This isn’t an earth-shattering ground-breaking post, just a simple example of a workaround which came up on the SItoA mailing list…
In Mental Ray rendering out a copy of a Softimage ICE particle’s shape per strand point is easy, just disable the “stranddeform” attribute (when using “generate strand trails” it’s the “loft shape along strand” checkbox.) Now instead of rendering a continuous, lofted result the strand is depicted as a series of particle shapes or instances. Easy enough, and is described as a basic workflow in the softimage documentation.
But when using Arnold as a renderer, particle shapes are lofted no matter what. So how do you get a result where shapes are repeated along a strand? This is the question which came up on the mailing list, and Stefano Jannuzzo and Mathieu Leclaire posted a simple and direct solution: clone (or add manually) a point for each strandPosition on a new cloud. When using add points instead of cloning, you also need to carry over relevant information such as orientation and velocity.
This is a pretty common kind of technique for this sort of thing and is worth putting on the record where people can search for it, so I’ve implemented their suggestion in a compound and example scene here. Enjoy.
Just loosening up… I had created a couple of forces in ICE so I rendered out a galaxy using emRPC. I had never had call to make any space environments as part of work, so I thought I’d spend 20 minutes and give it a go.
Ok, it’s not going to win awards. But it was fast and fun to make. :)
Softimage really needs more data visualization, but one of the great things about it is you can usually build the things you need yourself without too much trouble.
Here I’m visualizing a standard turbulence node. Fabricio has a similar approach, you can find his and my variants on the softimage mailing list or perhaps on the amazingly helpful rray.de Softimage resource site.