Tutorial - Pflow for water condensation on surfaces

Mar 01, 2013 10:00

The goal was to create a dynamic system, where water droplets would appear on any surface, get larger over time, then roll down the surface collecting other droplets on the way. once they reach the bottom of the object they would get detached, fall on the floor and form puddles, just like in an example below:

image Click to view



For this tutorial I created a teapot with 2 deflectors - one to detect when the droplets rolling down are near the bottom of the teapot so that they can be detached from its surface, and another deflector to catch the falling drops and allow them to form puddles.  Additionally, Wind and Gravity were added to give the droplet trajectories a bit of variation.

The objects are arranged in this manner:



Some important things to keep in mind when you follow this tutorial:  Units are set to generic.  The teapot radius is 185p units

Here is the screenshot of the PFlow chart, with important areas numbered and explained below:



1. This operator simply detects the age of a particle and when the test checks out as true, the particle is being sent to the next event where they begin to roll down.  The age test here is set to 130 frames with a very large variation in order to minimize the predictability of drops rolling down.  Note that the scale operator above the age test is animated - that allows particles to start out very small, then grow larger over time.  (It works great for condensation, but if you're working on a rain system, you may be better off without the scale operator altogether - so that the droplets spawn with their 100% size from the start.)

2. Because the surface of the teapot is curved I had to use the Lock/Bond operator with "lock to surface" option selected to make sure the particles dont leave the surface of the object until it's time for them to do so.  Make sure the Position Lock/Bond Force% is set to 0, otherwise the particles will not move.  To the right of the diagram you can see all of the settings for this particular operator.  The zig-zaggy movement of the droplets is achieved though the use of Wind.  The force of wind is set to 0, but the Turbulence is raised to 6.0 and Frequency is set to 0.03 with Scale being 1.

3. When the rolling droplets reach the first deflector, they are instantly sent to the next event, where they will be detached from the teapot surface and will be free to fall from it.  During this process the original particle is deleted (check the delete parent option), and the speed is set to 0.  That way the drops will fall only thanks to gravity in the next event.

4. However, while these droplets are still rolling on the surface, we need to add a trailing effect to them.  For that, a Spawn operator is used, with "spawn by travel distance" option selected - see the complete settings on the right.  The speed was decreased to 0.  The event called "Trailing Droplets" also has an animated scale operator that decreases the size of each individual trailing particle from original size down to 0 over the duration of 40 frames.  Once a particle is 40 frames old, it is deleted.

5. Back to detached particles now - As a particle falls, it will eventually reach the second deflector (the floor).  Once there the Collision Spawn operator is enabled, and the droplet spawns a bunch of smaller particles while a parent is deleted.  Set the speed options to - Parent: Bounce, Offspring: Continue, Speed is inherited at 25 and divergence is 180.

6.  After the scattered droplets bounce and hit the deflector again, they are set to bounce 8 more times and stop after that.  As a result we get a fairly random splotch every time.  We can now turn that splotch of particles into a unified mesh using a BlobMesh object (found in Create-Compound Objects).  The settings for that thing are - size: 2.0, tension: 1.0, evaluation coarsness - render: 2, viewport 2.

7.  Also note that as a droplet falls towards the floor it can sometimes pass through the deflector.  In order to keep the performance up, it's a good idea to delete any stray particles - in this case the ones that do pass through the deflector are tested by age and deleted.

8.  This event is responsible for spawning smaller little droplets that never do roll down and only serve us to create a multitude of droplets on the surface.  They need to be removed once a rolling droplet comes near them (think of droplets merging together on their way down) and to achieve that I used a Keep Apart operator.  The events used in that operator are: "LARGE drops spawn" and "Large drops roll down", with the force set to -20.  The range of detection is set to "relative to particle size with both core and falloff set to 75%.  Because these particles are stationary, it's very easy to use a Speed Test operator to detect when they become affected by the Keep Apart operator, and as soon as that happens they are simply deleted.  That creates that nice clear path in the wake of a rolling droplet.

Hope that helps!  If you have any questions, feel free to contact me!
Previous post
Up