anton980 (anton980) wrote,
Hello everyone!  As promised, here's one of my old PFlow tutorials translated into English.  This is a case study, not a final product, so it's not particularly pretty, but hopefully you'll learn a trick or two from it and be able to use it in your own projects.

Before we begin, here's the end result of this tutorial:





To begin with, I hacked together an animation (3 bip files were used - walk, bee swatting and a death sequence - these ship with 3D Studio).  Once that was done, I created an SDeflector and linked it to "Bip001 Footsteps" (you will need to unfreeze it before you can link anything to it).  The result was this: note the spherical deflector near the character's legs - it moves with the character wherever he goes and will play an important role later.


You could make the deflector smaller than this later on.  It may also be worth trying to use a UDeflector so that the whole character body acts as a deflector.  It will, in theory, produce a much more accurate simulation with particles, but will most definitely be costlier to run.

Now onto Pflow.  Here is a complete schematic.  Below are the bullet points based on the red letters next to specific blocks




1.  The particles appear on the emitter, which is hidden in a hole in the ground (see video up top).  From there they move along the surface of the ground thanks to the Speed By Surface operator (make sure you select the "Control Speed Continuously" option).  Orientation is controlled by choosing "Parallel to Surface".  All that enables PFlow to continuously monitor the position of particles relative to the surface of the ground and wont let said particles fly off.

Also note that since this is just a case study I used simple cubes to represent insects.  If you use a Shape Instance operator, you can substitute cubes with an animated mesh of actual bugs or whatever else.  The orientation of particles can be controlled using the Rotation operator with "Speed Space Follow" selected.

2.  Next, we must add an object of desire for the parasites to run to.  To do so I added an operator Find Target, and selected ICON instead of MESH OBJECTS in the options.  Once that object is chosen, an icon appears in the viewport - link that icon to Bip001 Footsteps object.  This same operator is also used to control the speed at which the parasites run towards their target as well as the distance to which they can approach.

3.  Once the insects approach the target, they touch the SDeflector that we've created originally (remember - it travels with our character because it's linked to Bip001 Footsteps).  As soon as a particle touches that deflector, Collision 001 operator sends it out into the next event.

4.  In this event the original particle is deleted and a new particle is spawned.  They look exactly alike, so you cant really tell a difference between them.  The new particle is then sent out to the next event

5.  In order to make the cockroaches crawl on the character itself I used an operator called Lock/Bond.  In the "Lock on Objects" options I chose the mesh that makes up the body of our poor character and checked the option to "Lock to Surface" as well as "Animated Surface".  I also made sure that "Restrict To Surface" is checked.  The Speed operator (with "Random 3D" selected) forces the particles to move on the body of the character chaotically, creating a nice visual.

6.  Because our character is in a lot of pain from being bitten by rodents, he flails his arms a lot.  Logically, that should send some of the attached parasites flying.  In order to create that effect I originally thought of using a Speed Test operator, but that didnt work out at all.  The reason for that is - the deflector that sends the parasites from the ground onto the character is too large, so the particles sort of "teleport" from one spot to another, which breaks the Speed Test operator and all the particles instantly become airborne, before they even had a chance to attach themselves to the body or a victim.  This could have been fixed using a more robust deflector, but screw it - for the sake of speed I simply duplicated the whole previous event (namely speed, rotation, lock/bond and display) modifiers and sent all the particles that are older than 5 frames there (5 frames here was an arbitrary number - I chose it because I thought that 1 frame may not be enough and 10 - too many).  So in effects this trick allows us to use said "Speed Test" operator without worrying about that speed-breaking teleport effect.

7.  So, here we can safely add that Speed Test, and add a speed limit that is higher than the speed at which the bugs are crawling.  Once the arm or leg is flung fast enough, this operator will detect it and send the particles off to the next event.  Fairly clever!

8.  At this point the bugs have broken that speed limit and were sent to this event.  I've added a couple of forces here - Gravity and Drag.  Drag slows the bugs down a little bit after they become airborne and in my opinion it makes the animation a little bit more realistic.  The Speed operator makes sure that the speed is inherited from previous event - that way the transition between the two events is not noticed.

9.  Once the airborne bugs have hit the ground, they are sent off to the original event, where they start looking for a victim again.  The cycle is complete, the victim is utterly doomed.  There is no escape.

I hope this was informative and not very confusing.  If you have questions, ask away!
  • Post a new comment

    Error

    default userpic

    Your IP address will be recorded 

  • 1 comment