edge
 
subscribe
Sign up now for the full 1 year Effects course for just US$49.00. The package includes access to all material on this site including:
  • Comprehensive FX tutorials
  • Production focus
  • Video tutorials
  • Support Forum
  • New tutorials added regularly
US$49.00

subscribe
latest news
TUTORIAL: Level - Mid: Happy Feet Snowflakes

Summary.
To make life alot easier for control and tweaking the effect later on, we add some attributes to the particle shape node that is accessible outside the expression. With these controls we can animate snow flakes, rain and hail at slow, fast or turbulent speeds.

Dislcaimer:
Even though the basic technique used is some what similar, this is not the exact way it was done on Happy Feet. Purely because I cant supply such information publicly. However, all the code and set up was re done from scratch at home and done a little bit more efficiently if I do say so myself :p. Also, at the end I will supply what I think is a more ‘director’ friendly method.

          

Create the Scene

  1. Create a plane (poly or nurbs, doesnt matter) and make it into a surface emitter.
  2. Particles->Emit from Object - option box. (surface emitter)
  3. Change the speed and or speed random to 0, and the emission rate to just 100 for now.
  4. Raise the plane up in Y and set up your camera underneath it as desired. For these tests i placed mine at 20 units in the Y and scaled the plane to 20 by 10 so that it sits across the screen above the camera, for now anyway(all units are default maya centimetres)
  5. Extend your scene frame range out to atleast 500. Maybe 1000 would be better so we can tweak the effect
    without rewinding.

Adding Attributes:

  1. We need to add some custom attributes to the particle shape node.

Manual Method:

  1. Press play and select the particles or go to the outliner and select the particles. The attributes need to be on the shape node not the transform node so make sure we have the shape node visible in the attribute editor.
  2. In the add dynamic attributes rollout select the general button and add these attributes.

-windDirection. Vector, scalar
-windSpeed, Float, scalar, default value 4
-phase, Vector, scalar
-twirlTurbulenceStrength, Float, scalar,
default value 10
-noiseTurbulenceStrength, Float, scalar,
default value 5
-turbulenceSize, Float, scalar, default value 2
-globalSize, Float, scalar, default value 0.1

-change the windDirection to 0,-1,1
(we can change/animate the phase later)
-go up to the top of the attributes and change the conserve to 0.97 so we can contain the effect a bit.

Lazy Method:
To do the same thing copy this script into your script editor select the particles (shape or transform doesnt matter) and run it (or source it)

http://www.modernmayhem.com/addAttrsForSnow.mel

Adding the particle expression
Manual Method:

  1. Go to the particle tab and create this runtime before dynamics expression:

float $windSpeedMag = windSpeed + windSpeed * cos(time * 0.1);
vector $windSpeed = << windDirectionX, windDirectionY, windDirectionZ>> * $windSpeedMag;
vector $vel = globalSize * rot( dnoise ( ( position/ turbulenceSize) + << phaseX, phaseY, phaseZ>>) , (<< windDirectionX, windDirectionY, windDirectionZ>>), time);
vector $vel2 = globalSize * dnoise( position/( turbulenceSize*2) + time * 0.5);
$vel = $vel * twirlTurbulenceStrength + $vel2 * noiseTurbulenceStrength + ($windSpeed* globalSize);
velocity += $vel;

or similarly run this script

http://www.modernmayhem.com/addExprForSnow.mel

This is what it looks like so far at an emission rate of 100. Rendered in mental ray to get (a slight) motion blur (0.2)

          

You can see the ‘rotational’ noise in this render but if we want to accentuate that I have another method which I will add later. But first on to rendering.

Rendering:

Ok first we need replace the particles with instances. We could use sprites but then we wouldn’t get the random rotations in 3 dimensions.

Shader and instance set up
create a poly plane and change the divisions to 1 and 1.

  1. duplicate it 2 more times. (we are being lazy for this tute and making only 3 variations but feel free to make as many different snowflakes as you like).
  2. select the three planes then the particles and go to particles -> instancer replacement
  3. We need to make 3 different shaders too. For this tute I just downloaded three different images off google and brought them into photoshop and created 3 square (about 200 by 200) tiffs on a transparent background. But then had to change to tga’s as my mental ray had a problem with tiffs.
  4. bring it into maya and connect the outColor to the shaders colour and outAlpha to the shaders transparency red green and blue.
  5. one last trick for the shader is to mask out the specular otherwise it will shine for the whole square not just the snowflake shape. So the quickest way around that is to remap the colour into black and white and pipe that into the specular colour. Use the ramp to crush up the dark values as much as possible so that your left with a white silhouette of the snowflake.
  6. to remap the colour simply go to effects in the file node/tab and select color remap. This will reconnect the output of the file to the colour of the shader and we dont want that so disconnect it and put the file straight back into the colour.
  7. then change the ramp to black and white (the snowflake should be white and the background black) and pipe that into the specular colour of the shader. and thats it!

heres what my shader looks like

shader

shader

  1. make 3 of these and assign one each to the planes that we made earlier.
  2. the last tweaks to the shader was increasing ambient colour to white and putting the specular eccentricity to something low like below 0.1 and turning up the specular roll off to 1. You can definitely make a better shader than this, this is just fast and efficient
  3. finally, in my scene, i scaled the 3 planes to about 0.4, 0.45 and 0.5 respectively

Particle set up for instances

  1. we need to add two more particle attributes. So go to the add dynamic attributes rollout for the particle again and hit the general button. Add these two attributes
  2. randomRotatePP, per particle, vector (dont need initial state)
    -indexPP, per particle, float
  3. in the creation expression add:

    randomRotatePP = sphrand(360);
    indexPP = floor(rand(3));


    This will give you a random rotation in 3 axes. ie sphrand. And will give you a random number integer 0 to 2.
    If we wanted to reproduce this random gen each time the exact same way we would need to add seed first before the other two lines

seed(id);

If you want to then change the random number generation just change that line to seed(id +50) or whatever you like.

In the runtime before dynamics expression rbd type something like:

randomRotatePP += 10*<<noise(time*2 + 100 + id), noise(time + 50.5 + id), noise(time+ 23.3+ id)>>;

My random number offsets are just numbers I plucked out at random to make each one different. The important offset is the ‘id’ offset, which will guarantee that each particle has a unique random number. The number 10 is the amplitude (remembering noise returns -1 to 1) . I’ll leave it up to you to make it into a variable which is what you should always do rather than hard code it in there.

-Finally in the particle attributes scroll up to see the instances rollout. Here is where all the variables live for the instance node. We need to make ObjectIndex equal to our new indexPP and rotation equal to our custom randomRotatePP attribute.

Hitting Render:
Now the moment we’ve been waiting for. For the render shown here i simply set up a directional light, pumped it up heaps and turned on mental Ray. The reason I wanted to use mental ray was because it does motion blur and is ready to go right out of the box in maya. Although I later turned it down 80 percent so to show the snowflakes more without the blur.
You could still use maya software or even 3delight. I will have a tute up here soon about 3delight and volumetrics so look out for that too. In the meantime check here very soon for my more advanced script to make the snowflakes ’spiral’ downward more evidently

 
links

 

copy right 2008