Amount Change Suboperator

The Amount Change suboperator lets you modify particle count by spawning new particles or deleting existing ones. When spawning, you can record spawning properties and details into custom channels created with the Output New suboperator. Also when spawning, the value of the Integer input determines the number of new particles.

Procedure

Amount Change is one of the most complex suboperators in the Advanced Data Manipulation toolkit. To help you understand how it works, we offer the following example: Simple Spawn.

Use of the Amount Change suboperator requires knowledge of the other suboperators. The purpose of this example is just to illustrate the simplest way of using the Amount Change suboperator.

Note: In this scene, the original (parent) particles move along the PF Source icon arrow, as defined by the standard Speed operator, while spawned particles move in various directions.

To follow along, open the included file SimpleSpawn.max.

Example: To use the Amount Change suboperator:

  1. Add an Amount Change suboperator. Leave it set to Type: Spawn and choose Integer As Additive. Next, wire its input to a Scalar suboperator set to Output Type: Integer.

    The integer value of the Scalar suboperator controls the intensity of the spawning process.

  2. Create a custom channel by adding an Output New suboperator with Data Type: Boolean to record the spawning.
  3. Set the Output New Execution Order to 1. This automatically sets the Amount Change Execution Order to 2, so the custom channel is created before Amount Change is executed.
  4. In the Amount Change suboperator Record Spawning To Data group, turn on Is Current Spawn. Click the None button and choose the Output New suboperator.

    This records the spawned data to the custom channel.

  5. To see the spawned process, change the speed of the spawned particles (speed vector= [25, 0,0], Divergence=180) and turn on Use As Speed.

    The Vector suboperator used here with Divergence separates individual spawn particles from each other and the parent.

  6. (necessary for Data Test) To filter spawned particles from the original ones, add an Output Test suboperator. The Output Test should request the data from the custom channel; that is why a new Input Custom suboperator is created.

In its current form this example is just a subset of the regular Spawn test, from which you can build a custom spawn process. For example, instead of using the Scalar suboperator to define the additive amount for spawning, you could create your own schematics that calculate the spawning number based on the position of the parent. Another avenue for experimentation is making changes to the Vector suboperator (defining the speed of spawned particles).

This example shows the minimum requirements for a spawning process. The Amount Change suboperator alone is not enough for that. So, the purpose here is to give some basis and background to work with. Once you've laid the groundwork and seen that it's working (the spawning is visible), it is easier to modify or build on.

Interface

Type
The type determines whether Amount Change creates (spawns) particles or deletes them. When Type is set to Delete, the only controls available are False To Delete/True To Delete and Execution Order. Default=Spawn.
Integer As Amount/Additive
The Amount Change suboperator's Integer data input defines the number of particles spawned. Use this option to determine whether the incoming data is regarded as:
  • Amount The input Integer value defines how many particles will replace the parent. That is, it defines the total number of particles, including the parent and its spawned offspring. An input value of 0 means that a parent particle is deleted; 1 means that the particle doesn't spawn, and so on.
  • Additive The input Integer value defines the number of spawned particles An input value of 0 means that the particle doesn't spawn, a value of 1 means that 1 child is created per parent particle, and so on.
False/True To Delete
Available only when Type=Delete. This is the sole function of the Delete option, which sets the suboperator input type to Boolean: When incoming data is of the same value as the chosen option (False=0; True=1), particles in the event are deleted.
Reset Particle Age
When on, particles in the event have their age reset to 0.
Spawns As New In Event
All particles have a standard "New In Event" data channel that indicates particles that have just entered the event, either by birth or by transferring from a different event. The "New In Event" data is used by many operators to initialize some property data for particles. This option lets you choose whether to tag newly spawned particles with this data channel. When on, a spawned particle is considered new, thus triggering some data initialization by other operators. When off, a spawned particle is not considered as new, leaving these data to be inherited from the parent particles.

Priority And Execution Order group

See Priority And Execution Order.

Record Spawning To Data group

These controls let you record spawning properties and details into custom channels. The custom channels have to be created in advance with the Output New suboperator. The data in the custom channels are updated during the Amount Change execution. Therefore, in order to obtain these data, you have to request the data from the custom channels (usually with the Input Custom suboperator) in the data stream with Execution Order value set higher than the Execution Order value of the Amount Change suboperator.

To use any of these controls, turn it on, click the associated button, and then use the Select Data Channel dialog to specify the channel.

Is Current Parent
Boolean data to indicate if a particle spawned any particles.
Is Current Spawn
Boolean data to indicate if a particle is a recent spawn.
Parent ID
Integer data with the birth ID of the parent of a particle. The ID information can be used in the Input Custom suboperator that can accept an integer channel for retrieving data from other particles (option Use I2 As Particle IDs). The datum reads -1 if a particle is not a result of spawning by the Amount Change suboperator. Incidentally, you can use the same data channels in between several Amount Change suboperators.
Last Spawn ID
Integer data with the birth ID of the last spawn particle. The data are valid only for particles that were parents at least once, and not necessarily in the current integration step but rather globally in time.
First Spawn ID
Integer data with the birth ID of the first spawn particle in the global sense. This particle is the oldest one among the spawns of the parent particle. Again, the data are valid only for particles that were parents at least once. The data channel is available only if the Total Spawn Count channel (see below) is defined.
Current First Spawn ID
Integer data with the born ID of the first spawn particle in the current integration step.
Older/Previous Sibling ID
Integer data with the birth ID of the previous spawn/sibling particle. These data can be used to establish chains of sibling spawns. The data channel is available only if the Total Spawn Count and Last Spawn ID channels are defined. The data are continuous through integration steps; therefore, if a particle has spawns during several integration steps, you can still establish the full chain of sibling spawns for the parent particle.
Current Spawn Count
Integer data that indicates how many particles were spawned per parent particle during the current integration step.
Total Spawn Count
Integer data that indicates the total amount of particle spawns for a parent particle.
Current Spawn Order
Integer data that indicates the order of spawns in the current integration steps, from 0 to N-1, where N is number of spawns for a parent particles in the current integration step. The data can be used to adjust particle location in space, for example to spread particles from the location of the last spawn particle in the previous integration step to the current location of the parent, thus creating placement similar to the standard Spawn operator.