Week 4/5 – Dynamics using goals

DynamicWaterfall

We have been looking at the various uses for the ‘goal’ attributes in particle dynamics. The first in class example was to goal a particle to a sphere and using goal weights of less than 1 to create an ‘insect swarm’ like behavior-
swarm
We then experimented by using expressions to quickly and efficiently animate the sphere using mathematical algorhythms such as “pSphere1.translateX = sin (time)*5;”

The second example was to get a bunch of particle intanced cars to animate along a deformed ground plane
cars
The cars were goaled to the ground plane and we used various expressions to control their behavior, eventually sending them off the edge into the abyss.
This gave me some clues when it came to the homework brief – to create a particle waterfall. After much experimenting, these are the steps I used to produce the end result –

make the waterSurface geo a surface emitter (it has already been animated using a wave deformer)

goal the resulting ‘waterParticle’ to the geometry with a value of 1 to make the particles stick. They now bob up and down with the deformed surface.

– the next step was to make the particles move forward in the U direction. I added the dynamic attributes for Goal U, Goal V, Parent U and Parent V,  then wrote the following creation expressions on the particle –

waterParticleShape.goalU = waterParticleShape.parentU;

waterParticleShape.goalV = waterParticleShape.parentV;

It was important at this stage to check the ‘need Parent UV’ tab on the emitter.

–  so the particles are now flowing forward and collecting at the end of the geo.
I wrote the following runtime before dynamics expression to ‘un-goal’ the particles as they approached the end of the geo, allowing them to be ‘released’ over the edge –

if (waterParticleShape.goalU > 0.99)

 {

waterParticleShape.goalPP =0;

}

– at this point I added a gravity field to the particles that would carry them down in the Y direction.

This almost completed the simulation, I noticed that the water was falling in ‘strips’ because of the assignment to the UVs – I wanted to tweak the randomness of the U direction so
– I created a new custom attribute called randSpeed and assigned it some rand values –
waterParticle.randSpeed = rand (0.008,.015);
– then added this random value to the U goal using the expression –
waterParticleShape.goalU = waterParticleShape.goalU + waterParticle.randSpeed;

Now when the water falls, the height is more broken and natural.

– I used a similar method to create some slight ‘zigzag’ across the surface in the V direction using this –
waterParticleShape.goalV = waterParticleShape.goalV + rand (-.2,.2)*.003;
The output value for this needed to be very low – hence the *.003 at the end.

– Lastly, regarding the flow, I only wanted the water particles to be generated in the first half of the geo surface. Another simple creation expression accomplished this-

if (waterParticleShape.goalU > 0.5)

{

waterParticleShape.lifespanPP = 0;

}

else

{

waterParticleShape.lifespanPP =4;

}

Now the water is only being generated in the first half of the U grid. It also served the second purpose of giving the particles a lifespan of 4 seconds which was about the right amount of time to die level with the end of the ‘rock wall’. (Remember to set the lifespan mode to ‘lifespanPP only.)

With the movement of the water now just right, the final step was to assign the ‘look’ of the water.

– I set the render attributes to ‘streak’ and adjusted the tail size and fade.
– I assigned a black and white ramp to the per particle opacity to kill them a bit more gradually.
– I assigned an RGB ramp to the colour per particle to begin their life as a rich blue and finish with a lighter blue to mimic the look of whiter, more transparent colour as it is falling.
Here is a playblast of the final –
https://vimeo.com/73544121

Advertisements

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s