Creating Branching Paths
 
 
 

Create branching paths:

One of Particle Flow's unique capabilities is that it lets you create branching events that are controlled by conditions. You do this with a type of action called a test, which defines a true or false condition against which the software continually checks each particle. When a test returns False, the particle stays in the current event, but if the result is True the particle can move to another event that specifies different behavior.

In this procedure you’ll use Find Target tests to cause some particles to change course and flow along different paths.

  1. Continue from the previous lesson or load the file VizGasFlow_create_branching.max from the \tutorials\mech_design folder. Open Particle View if necessary.
  2. Right-click the Emit Particles event and choose Append > Test > Find Target from the menu.

    The Find Target test is used primarily to set a goal for particles. Its options include moving particles to the goal based on speed or time. In addition, you can use it as a simple proximity test, without affecting particle motion at all, as you'll do next.

  3. Click the Find Target operator and, from the drop-down list at the top of the parameters rollout, choose No Control.

    This disables most of the test's parameters.

    When you created the Find Target test, it added a helper object to your scene called Find Target 01. This is now the target for the particles within this event; the software will test each particle based on its distance from the helper object.

  4. In the Find Target test parameters, set the Test True If Distance To option to Target Pivot, and set the Is Less Than value to 5.0.

    One visible difference between tests and operators is that tests have a little “nub” that sticks out to the side. You use this to wire the output of the test to the input of another event. The result is that particles that test True will go to the next event.

  5. Right-click to the right side of the Emit Particles event in the blank space of Particle View and choose New > Operator Event > Speed By Icon from the menu.

    You’ve created a new event containing a single operator. This is what you will connect the output of the Find Target test to. But first you'll take some simple but important organizational steps.

  6. Rename the new event Flow North.

  7. Move the mouse cursor to the left edge of the Find Target test, where the nub is. When the cursor changes to horizontal black arrows, click and drag the cursor to the right side of the Find Target test and release the button.

    You’ve given the new event a more descriptive name, and you’ve also moved the output connector on the Find Target test operator to the opposite side so that the wire can travel in a more direct path.

  8. Click and drag from the small blue dot on the end of the test connector to the input connector of the Flow North event. The result is a blue wire connecting the Find Target test to the Flow North event.

Set up the Flow North event:

The output of the Find Target test is set up correctly, but the Flow North event isn’t. The only operator within the event is a Speed By Icon operator that isn’t animated. You’ll animate its icon along a new path so that particles that enter this event move to that path.

  1. In the parameters of the Speed By Icon operator in the Flow North event, make sure Icon Animation > Sync By is set to Event Duration.
  2. Rename the operator Icon North.
  3. Press H and choose the Icon North helper object.

    Select the Icon North helper object.

  4. From the Animation menu, choose Constraints > Path Constraint and complete the action by choosing the Path North spline as the path.
  5. On the Motion Panel > Path Parameters rollout, turn on Path Options > Follow and set Axis to Z.

    When you use a Path constraint, the software sets default keys at the first and last frames of the animation. For this animation, you’ll need to adjust the keys for both the Icon Main and the Icon North helper objects.

  6. In the track bar, move the rightmost key to frame 100.

  7. Select the Icon Main helper object and slide its rightmost key to 150.

    This effectively increases the speed of each icon along its path.

  8. In the Icon North operator parameters, turn on Use Icon Orientation.
  9. Turn on the Steer Towards Trajectory check box and set the Distance value to 5.0.

    TipIn addition to using Particle View, you can use the Modify panel to set parameters for a Speed By Icon operator or a Find Target test if you select its icon.

    Because of the way the scene was originally set up, the Find Target icon is created close to the correct position to determine whether particles should switch to the upper tube. In the next step you'll move it upward slightly, but in many cases you'll need to reposition the target by a greater amount.

  10. Select the Find Target 01 helper object and move it 7 units upward, along the Z axis, so that it’s slightly above the center line of the main path.

    Some of the arrows now move upwards.

    If you play the animation now, you see some of the arrows change direction and move upwards along the second path. All of the particles continue to point in the same direction because the Flow North event doesn’t have a Rotation operator to define their orientation. To resolve this, you could add another Rotation operator using identical parameters, or you could instance the first one. Even better: All particles in this system should point in the direction they’re traveling, so you can just move the Rotation operator from the Emit Particles event to the global event.

  11. Drag the Rotation operator from the Emit Particles event into the PF Source 01 event. Be sure to drop it when you see a blue line, not a red one.

    The upward-moving arrows now point in their direction of motion.

    This resolves the orientation issue. We still need to address some other areas, but first you'll add one more path.

Add a third path:

Most of the following steps will probably be familiar to you.

  1. Append a Find Target test to the Emit Particles event.

    In order for the particles to move correctly on the third path, the Find Target icon's pivot should coincide with the path's starting point.

  2. Select the Find Target 02 icon and then press ALT+A to access the Align tool.
  3. Select the PathSouth spline to open the Align Selection dialog.
  4. On the Align Selection dialog, turn on X Position (make sure Y and Z are disabled) and set Target Object to Minimum. For Current Object, choose Center. Click OK to close the dialog.

  5. Create a new event that contains a single Speed By Icon operator. Rename the event Flow South and the operator Icon South.
  6. Connect the output of the second Find Target test to the Flow South event.

  7. In Particle View click the second Find Target test, set its mode to No Control and set To Test True If Distance To: > Target Pivot to Is Less Than 5.0.
  8. In the Flow South event, set the Icon South operator to Use Icon Orientation and Steer Towards Trajectory with a Distance of 10.0.
  9. Select the Icon South helper object and use a Path constraint to attach it to the Path South spline.
  10. On the Motion Panel, turn on Path Options > Follow and set Axis to Z. Also turn on Allow Upside Down.

    This latter step helps to smooth out the motion when the particles are moving directly downward.

  11. In the track bar, slide the right-hand Position key to frame 100.

    You now have icons moving down all three splines and particles following them. You might want to adjust the locations of the Find Target icons slightly so the particles branch properly.

Change colors:

What if you want to change the color of the arrows based on which path they are moving along? This is a common need in AEC visualization when showing how fluids move through pipes, with the colors differentiating the types of fluid. Because you have a different event defining each path, it’s easy to assign different materials to particles within each event. You'll use three materials that have already been prepared for you.

  1. From the depot, drag a Material Static operator into the Emit Particles event. Place it above the tests.

  2. Click the operator to open its parameters.
  3. Open the Material Editor and drag the Red material onto the button (“None”) on the parameters panel. Click OK to accept the Instance method.

    If you play or advance the animation in a shaded viewport, you can see that all of the main particles are now red. The color of the particles in the other events is determined by the Display operator in the global event.

  4. Add a Material Static operator to each of the two Flow events, and apply the Blue material to one and Green material to the other.

    Now all three colors appear in the viewports.

Next

Applying Final Touches