Genome
RSS< Twitter< etc

<< Back To Particle Data Sampling Modifiers

Select By Particle Velocity Sum

In the following example, we will use a PRT Loader reproducing a Particle Flow system containing 100 particles driven by a Vortex force to select vertices on a Plane primitive. We will then use the Selection data to displace and colorize the mesh.  

  • Create a plane primitive with size of 120.0x120 .0 units and 60x60 segments.
  • Create a PRT Loader and load a PRT sequence with particles circling due to a Vortex (your animation may vary). This tutorial will sample their Velocity, so the Velocity channel must be present. 

  • Add a Genome modifier to the Plane, set to "Vertices" iteration mode.
  • Press the "Open Magma Editor" button.
  • Press Ctrl+[O] to create a new Output node, set it to Selection channel.
  • Press Ctrl+[D] to deselect all.
  • Press [O] and then [S] to create a ParticleSumRadius operator.
  • Drag a wire from the Particles socket to create an InputParticles node.
  • Pick the PRT Loader as the Particles object in the InputParticles node.
  • Drag a wire from the Lookup Point (WS) socket to create a Position InputChannel with ToWorld conversion.
  • In the ParticleSumRadius operator, set the Radius to 20.0
  • In the ParticleSumRadius operator, check the ">Available Channels Only" option, select the Velocity channel from the list and press the "Add..." button to expose the channel as output socket.
  • Drag a wire from the new Velocity output socket and select Arithmetic > Divide to create a Divide operator. (Alternatively, press [Ins] key untol the Velocity output socket is highlighted, then press [/] on the Numeric Keypad to create a Delete operator.)
  • Press Ctrl+[1] to create a Float InputValue with a value of 1.0. Enter 500.0 in it.
  • Connect the Divide operator's output to the Output node.
  • Select the Divide operator and press [V] and then [M] to insert a Vector > Magnitude operator.

RESULT: The vertices of the plane should not display a soft-selection based on the accumulated velocity of the particles flying over them (left image).

Adding a 3ds Max Push modifier with Amount of 10.0 to the stack will displace the mesh according to the particle influence (right imahe):

 

Converting The Selection To Color

In the previous step, we could have used the value to directly displace the mesh without using a Push modifier. But setting the Selection channel (which is a Floating point per-vertex channel and is NOT limited to 0.0-1.0 range is a great way to pass data up the stack for other Genome modifiers to use. For example, we can use the Selection to produce a Color gradient: 

  • Add a new Genome modifier to the stack and switch it to "CUSTOM FACE VERTEX" iteration mode.
  • Open the editor and press Ctrl+[O] for a new Output, set it to Color channel.
  • Press SHIFT+[S] for a Selection InputChannel node.
  • Press [/] on the Numeric Keypad to insert a Divide operator, enter 3.0 in the Default value for the second input.
  • Select the Divide node and press [F] and [C] to insert a Clamp operator.
  • Press [C] and then [V] to insert a Convert > ToVector operator.
  • Hold Ctrl and add the Clamp node to the selection, then press [SPACEBAR] two times to connect the Y and Z inputs to the Clamped output.

RESULT: The mesh is now colored in a grayscale gradient according to the selection channel. You can tweak the Divide operator's second input value to control the gradient falloff, since the sum of particle velocities might result in quite large values.

Related Video: