Particle Skinner - Spaghetti

by John Rand from a scene file by Jeff Lim

Scene File: Max9_ParticleSkinner_Spaghetti_Finished.max

We will use a Script, Box#2, and Box#3 to simulate spaghetti falling onto the collision object.

This scene contains a shell lofted Circle that is attached to a path. This is the proxy particle system that we will use to make strands of spaghetti and generate the control particles. This scene also contains a low-poly shell lofted plane for use as a collision object and a duplicate higher poly plane for the render.


Part 1 - Preparing the Spaghetti, first add noodles to boiling water, boil 10 min...


Open the file Max9_ParticleSkinner_Spaghetti_Start.max

Select a Top viewport and play the animation.

The first step is to setup the proxy system. This uses standard Particle Flow operators with the exception of one Box#3 Data Operator.

Open Particle View (Keyboard Shortcut 6) to create a new particle flow system.

  • Create a new Empty Flow
    • Click the Global Container
    • Quantity Multiplier
      • Viewport - 100% -- It is important that we see all of the particles
      • Render- 100% -- default
    • Integration Step
      • Viewport - Half Frame
      • Render - Half Frame -- default
  • Set the Render operator to Phantom
  • Add a Display operator - set to Dots
  • Add a new Birth Event with a standard Birth operator
    • Emit Start - 0
    • Emit Stop - 0
    • Amount - 30
    • Wire the new Birth Event to the Global PF Source 01 Container
  • Add a Position Object operator
    • Lock On Emitter - Enabled
    • Emitter Object - Circle01
    • Location - Volume
    • Enable Separation - Distance 10.0
  • Add a Spawn operator
    • Spawn By Travel Distance
    • Step Size - 5.0
    • Speed - Inherited% - 0.01 --This value will work with the rotation operator to help set the particles rotation
    • Divergence - 0.0
  • Add a new Operator Event - Rotation operator
    • Orientation Matrix - Speed Space --Rotates the particles to the direction of travel
    • X - 0.0
    • Y - 0.0
    • Z - 0.0
    • Wire the Spawn Test to the new Rotation Operator Event
  • Finish with a Send Out test - All Particles

Your flow should now look like this:

Brief description of operator settings:

PF Source 01:

  1. The Global Container - Settings here are Global attributes to the current system, such as the amount of particles you will see in the viewport. Right-clicking this node will also give you the Global Properties Dialog that you see with other scene objects. Here, for instance, you can turn on Object Motion Blur for all event nodes wired to the Global Container.
  2. Render- Set to "Phantom", Pflow behaves as normal, although it will not render geometry. "None" on the other stops evaluation as well as not rendering geometry.
  3. Display - Enables you to see what your doing in the viewports.

Event 01:

  1. Birth - Create particles
  2. Position Object - This sets our Circle_emitter as the point of particle birth.
  3. Spawn - The base particles are locked to the emitter, so in order to achieve the desired result of creating strands, we add more particles with no inherited speed, so they stay put.

Event 02:

  1. Rotation - Set to Speed Space particles rotation will be set to the direction of travel. This is why the above spawn operators inherited speed is set to 0.01, to give the Rotation op a definite direction.
  2. Send Out - Simply sends all or no particles to the next event.

Next is the Data Operator. This operator will create a filter so that only the particles in the event that the data operator resides in are the only particles used by the next system.

  • Add a new Data Operator event
  • Wire the Send Out Test to the new Data Operator Event
  • Edit the Data Operator
    • Add a Input Standard sub-operator -- This will tell the sub-operator it is wired to to only run if a particle is new to the current event
      • Choose New In Event
    • Add a Scalar -- This sub-op asks the question True or False if the particle is new to the event. If True send it to the output of the sub-operator
      • Choose Boolean
    • Wire the Input Standard to the boolean input of the Scalar sub-operator
    • Add an Output New -- This will "collect" all of the particles that tested true and store them in the Spaghetti Output channel
      • Data Access Scope - Global -- Global scope is necessary here, this way ANY Particle Source can access this channel
      • Rename the Output to "Spaghetti"
    • Wire the Scalar output to the Spaghetti input

Part 2 - Setting up the Box#2 Dynamics


First prepare the collision object to add to the new flow.

Select the scene object "Plane_CollisionSub", add a Pflow Collision Shape modifier and activate


Build up the PhysX Flow:

  • Create a new PhysX Flow
  • Set the Render operator to Phantom
  • Remove the Spin operator
  • Replace the Birth Grid operator with a standard Birth operator
    • Start Time - 30
    • End Time - 30
    • Amount - 1
  • Set the Shape operator to Cube - Size - 3.8
  • Add a PhysX Drag operator
    • Enable Linear - set to 1.5
    • Enable Angular - set to 1.5
  • Set Display to None
  • Click the PhysX World operator
    • Press the "=>" -Access Driver Parameters- button
    • In the modify panel notice the PhysX World Driver is now selected, scroll down to advanced parameters, open the rollout
    • Set the Subframe Factor to 8 - to increase system accuracy


Add the following operator and tests to the system

  • Add a new Data Operator - we will edit this later
  • Add a PhysX Glue test
    • Type: Simplified
    • Bind Distance - 10.0
    • Enable Bind Center Aligned Only
      • Align Margin - 1.0
  • Add a PhysX Collision test
    • Add the scene object "Plane_CollisionSub"

Your new PhysX flow should now look like this:

Brief description of the new operator/test settings:

Data Operator (we will build this in the next step):

  1. It will check to see if a particle is new to this event. There is only 1 particle in the Birth operator in order to satisfy this query.
  2. Next, the operator will gather the particle information from the proxy system we built earlier.
  3. After the total particle count is determined it will spawn 1 to 1 for every particle in the proxy system, creating a particle for particle copy.
  4. The second portion of the operator will align particle positions 1 to 1 for every new particle with every existing particle in the proxy system.

PhysX Glue:

  1. Type Simplified - is similar to Rigid, this solver offers faster simulations at the cost of accuracy in relative positioning. Some flexing may occur, which can be seen as a bonus feature.
  2. Bind Distance - This value needs to be able to span the distance between two particles. If the distance is to short, binds will not reach the adjacent particle. If the distance is to long you can overshoot your adjacent particle. This can leave you with undesirable results.
  3. Bind Center Aligned Only - This feature refers to axial alignment of adjacent particles, if within the set value, particles are considered aligned, if not they will not bind.

PhysX Collision:

  1. Simply put to register the particle collisions.
  2. This is a lower poly collision object, there is another duplicate with a higher poly count (currently hidden) that will be rendered in place of the low poly object.

Continue on to build the second Data Operator

  • Select the new Data Operator in the Particle View
  • Open the Data View by clicking the Edit Data Flow button
  • In the Data View add the following sub-operators:
    • Input Standard
      • Enable New In Event
    • Select Object
      • Wire the Input Standard output to the Select Object Boolean input
      • Select Type: PFlow Systems
      • Click the None button and add PF Source 01 --add the proxy system
    • Add a Particles sub-operator
      • Aggregated Property - Number of Particles --we need the total number of particles in the proxy system
      • Enable Use O1 As Proxy Particles --species that we are going to get the data from our proxy system and gives us a new input
      • Enable Use Filter For proxies
        • Click the Filter Data Channel button
        • Select the Spaghetti data channel --this filters and uses the spawned particles in the proxy and not the seed particles
      • Wire the Select Object PF Source output to the new object input
    • Add an Amount Change
      • Wire the Particles output to the to the new Integer input
    • Add a Input Proxy
      • Roll down and select TM - Matrix --Gather the Transform Matrix data from the proxy system
      • Wire the Select Object PF Source output to the object input
    • Add a Output Standard sub-operator
      • Roll down and select TM - Matrix -- This will set the particle positions and rotation axis from the proxy system
      • Wire the Input Proxy output to the Output Standard input
    • Compact the sub-operators

This completes the Particle Flow side of the lesson


Part 3 - Making the Spaghetti


We will need to use a script to generate renderable splines for use with Particle Skinner. Thanks go to Charley Carlat for writing the original script, James Haywood for the animation function, and Jeff Lim for all of the great updates and additional features!

Download, unzip to a local folder, and run the PFspliner v3.4 script (you can drag-and-drop the script on a viewport or go to the Maxscript Menu -> Run Script)

The correct PF Source should already be chosen when you run the script. If not, select it now.

Time - Set the End Time to frame 30 as this is the length of the Circle animation on the path.

Increments - Set to 1 - this is by frame so a set of 5 would jump 5 frames add the spline segment, jump again 5 frames, ect. We want our splines to match our particles as close as possible, hence a frame increment of 1.

Attach Splines - Enabled - this will turn the 30 splines created by the script into one manageable editable spline.

Select the newly created spline group and go to the Modify panel

  • Change the object color to more resemble noodles if you like
    • In the Rendering Rollout and tick "Enable In Renderer" and if you like "Enable In Viewport"
    • Set the Radial Thickness - 3.5
  • Add a Particle Skinner modifier
    • Time On - 30
    • Add PF Source 02 to the Particle Flow Systems list
    • Distance Influence - 4.0
    • Controllers Limit - 2


Play the Animation


This is a good scene to test different Glue Bind types and their parameters. For a faster performing scene just decrease the amount of seed particles in PF Source 01 Birth Event to five or ten and create a new set of splines using the PFspliner script.