|Page (1) of 1 - 11/09/01||email article||print page|
Breath Vapor Simulation in MayaAn intermediate level Maya tutorial involving particles and dynamics
One major nuance to contend with in such a shoot is the visibility of breath vapor when an actor or animal exhales in the cold climate. To that end, it has become the job of the soda caffeine-addled animator to add digitally created breath vapor to these actors or animals to further the illusion need for the scene.
This tutorial will take you through a setup and animation to simulate breath vapor in a cold climate. Using a downloaded preview clip from Eyewire.com, I have a scene with two women walking as they talk to each other, down a city street during a cold day. My task is to add breath vapor to each of them through the 90 frame shot. I will assume for this tutorial that you already know how to get around Maya, so Ill cut to the chase.
Once I have the images loaded into my image plane as an animated sequence, I have to track the camera to the background. Its an annoying task, but most definitely necessary to get a good shot going. Figure 1.
Once I have a quick shot of whiskey with a tequila chaser, Im ready to begin. I start first by creating a directional particle emitter. I use a directional so I can funnel the particles in any particular direction. Omni emitters dont work so well here.
Judging from the way the women are facing, I set up my emitters direction axis to spew particles away from their faces. In this case it would be primarily in the positive Z with a little negative X to boot: Direction X = 0.3; Direction Y = 0; Direction Z = 1.
I turn the rate of the emitter to 0, for now, so I can track the emitter to the womans mouth without having particles everywhere. And, to make life easier, I create a locator, which I scale up to make it big and noticeable on my screen, color it red, and center it directly on the emitter.
But I digress.
Ok, once the breath_pack has been tracked, I am ready to animate the rate of the particle emitter to correspond to her exhales. What I will be looking for here is not just when she exhales, but also how. Is she talking? Is she letting out a big sigh? Has she suddenly been hit by a shopping cart? This will dictate how much breath is being exhaled, which will directly correspond to how high the rate needs to be turned up.
I typically will lead her exhale by a few frames to give the rate of particle emission a chance to ramp up. For example, she is slightly exhaling between frames 6 and 17. I will set a keyframe of 0 on the rate of the emitter at frame 3 and a key of 100 at frame 10 and again a key of 0 at frame 15. This, along with my particle render type and lifetime (which I will get to briefly), will work nicely to give a small exhale look.
Another quick slug of whiskey, and I will continue this process; to spot when she is breathing out or speaking and keyframe my emitters rate accordingly, leading by a few frames and ending a few frames early. The bigger the exhale, the larger I set my rate.
Now, at this point, put your feet up and relax a moment. Rest your eyes, play some Tetris, get a new bottle of whiskey, whatever. This is a critical part of the Maya animation process, especially if youre being paid hourly.
To get the directional emitter to emit to properly look like an exhale, I need to set a number of its attributes, before I go on to the look of the particles. I already have its directions set, and an animated rate that corresponds to the subjects exhales.
I shall proceed by setting a spread of 0.45. This will give me a nice 45-degree cone of emission for the particles. Not too thin, like a jet steam, not too wide like an explosion.
Break for whiskey? Sure, and while youre at it, look up ?latex on Ebay. Hello!
Now its time to deal with the look of the particles. This will depend on a number of factors, and youll probably end up going back and forth between the attributes on the emitter and the attributes on the particle to fine-tune the shot.
The particle render type I prefer to use here is the Cloud (s/w). I like it for a few reasons. Namely, however, it is a software render particle type, and I prefer those to the hardware types overall. The other type of particle mostly used for this type of simulation is the sprite. While I widely use sprites in a number of particle applications, I prefer the cloud render type for this particular purpose. I think they look better easier and faster than sprites. Also, they have a good way of blending together via their threshold attribute and generally give a finer render than sprites.
First up, lifespan. This dictates how long the particle will ?live in the scene. Now with colder climates, you will see a more pronounced breath, but it will be short lived. In more moderate cold climates, youll see the breath for longer, but not as distinct. (In warm climates you wont see it at all, silly.)
For the lifespan mode I have set it to lifespanPP only, to give me the ability to control the lifespan on a per particle level. Under the lifespanPP attribute, I set a creation expression to control how long the particles live.
As a recap, a creation expression is a short bit of code that will affect a particle as soon as it is born and a runtime expression, other type of particle expressions, will affect the particle on every frame of the animation. Since I do not want the lifespanPP to change over time, a creation expression here is called for. I will right click on the lifespanPP attribute and select Creation Expression.
This will pop up the Expression editor.
In the text entry window, I will enter my expression and then hit the Create (or Edit if an expression already exists on this object) button to create it. This expression will not control the lifespan of each particle in this particle object.
My expression reads:
This expression will set the lifespan of each particle born to a random number between 0.9 and 1.6. By setting a randomness to the lifespan of each particle, we make the whole effect behave much more naturally.
Next up is the particles size, or radius. Again I prefer to have a per particle control over each particles size, so I have add a radiusPP attribute. I click on the General box under the Add Dynamic Attributes heading in the Attribute Editor with the particle object selected, click on the Particle tab, and select radiusPP.
This will create an attribute for this particle object that will control the radius for each particle. On this attribute I will create both a creation and runtime expression.
The creation expression will give a random radius within a range to each particle as it is born.The runtime expression will allow each particle to grow in size the older it gets. This will help the breath dissipate into the cold air.
Once again, I will right click on the radiusPP attribute and select Creation Expression to open up the Expression Editor. In the editor I will type in an expression to create a random radius for each particle within the range of .05 and .2. The creation expression reads:
Once I hit the Edit button, I can click on the Runtime radio button in the middle of the expression editor window (see figure 5) to switch to the runtime expressions so that I can make the particles grow as time passes.
For this, I will create an expression that reads the current radius of the particle, and will, as each frame goes by, increase itself by 0.01.
The runtime expression reads:
The reason I have a semicolon at the end of all my expressions, other than being just plain cool, is a matter of MEL syntax. MEL, as you may know, is Maya Embedded Language, the programming code, so to speak, on which Maya is built. All expressions in Maya use MEL commands and syntax. So, for each MEL command to be distinguished from the next, a semicolon is placed after the command. Even if you dont have a second expression in the Expression Editor, its still a good idea to end your expression with a semicolon. And the really hot chicks (or guys) dig it.
Onto the next attribute for the particles, and that is the Opacity. I want these particles to fade in and fade out, so I must attach a ramp to the OpacityPP attribute that is a gradient from black to gray and back to black again.
I click the Opacity button under the Add Dynamic Attributes section and choose Add Per Particle. OpacityPP now shows up in my Attribute Editor. I right click on it and choose Create Ramp.
I create my ramp as in Figure 7 below. This will make the particles invisible at birth, make them fade in, and then fade out before their death (which I hear is quite nasty and painful).
Now since these are software rendered particles, this OpacityPP ramp will not affect the final render. This is a quick thing I do so I can see the particles fade in and out in the preview playblasts and in the perspective windows when I scrub the animation as I work. It is for animation feedback, not for the final render. It is a short step I find works well for me, and makes me feel pretty. The actual fading in and out will occure through the shader assigned to these particles.
Ok, now that we have half a bottle of whiskey in us, were almost done with the animation. All we need to do now, before we render the first pass, is to assign a cloud shader to these particles and actually give it the opacity talked about above.
In the Multilister (I prefer it over the Hypershade for these general things), I choose Edit>Create and pick Particle Cloud. I adjust the newly created Particle Cloud to give it a gray color, a density of 0.744, and a slight incandescence.
The fade in and out of the breath I need to control through this shaders Transparency attribute. To that end I attach a ramp to it by clicking the Map button to the right of the attribute in the editor and choose a ramp texture. I have adjusted my ramp as in Figure 9 to get the best fade in and out and general opacity settings for this simulation. Keep in mind, a colder climate will allow you to see more of the breath than a less cold one, so you can make that adjustment here in the shaders Transparency along with the emitters Rate.
I will then run a few test renders and tweak all the shader settings and ramps to get the breath to look right. Once I do that, Ill render it out without the background and take it into a composite program like After Effects and mix it into the back plates, fine tuning the transparencies and color. And that should do it. A bottle of whiskey and about an hour later, youve got cold breath. Well, she does anyway.
Dariush Derakhshani is an animator at Sight Effects, a commercial and feature film visual effects firm in Venice, CA. He can be reached at email@example.com.
Source:Digital Media Online. All Rights Reserved