# Curve Particle Generator

The Curve Particle Generator tool is a point source that places particles along the length of a curve.

Courtesy William Vaughan

The Curve Particle Generator has an input for a source curve to describe the path of the particles. You can draw a curve in a mesh and assign the mesh to the Source Curve property. If you have multiple curves in the source mesh, you can select one using Curve Index.

This tool itself does not display the points it creates, to see the results you must use Replicators or Volumes. To use a Replicator, assign the Curve Particle Generator to the Point Source setting. For Volumes, use the Particle Source setting.

# Orienting the Particles

When orienting particles along the curve, the Up Vector setting, used in combination with the Forward Axis, offers a flexible method of setting the required position. Let's use a simple mesh to show how these settings work:

The mesh has colored parts to show its relationship to the world space. The red part points down the positive X-axis, green up the positive Y-axis, and blue down the positive Z-axis. This is our source mesh (prototype) for the replicator.

### Using Forward Axis Controls

The Forward Axis determines the direction that the particles face along the curve. In the first image below , the Forward Axis is set to Z. Observe how the blue part points forward along the curve. This is because the blue part points down the Z-axis in the prototype mesh. The image on the right shows the Forward Axis set to Y. This time the green part leads the way as it is the green section that is pointing up the Y-axis in the source mesh.

 Forward Axis is Z. Forward Axis is Y.

### Using Up Vector Controls

The Up Vector controls the secondary rotation of the particle. It describes the direction that the top of the particles point, when placed along the curve. For example, if the Up Vector is pointing up the Y-axis, the top of each particle attempts to point upwards as can be seen below. The Up Vector is indicated by the blue line, extending from the prototype. In all cases Forward Axis is set to Z.

 The Up Vector is pointing up, in the same direction as the green top. The particles also point upwards. The Up Vector is pointing along the positive Z-axis. The top of the particles now point the same way. The Up vector is pointing along the positive X-axis.

Establishing the correct orientation depends on several variables, but in most cases it is a good idea to adjust the Up Vector to point through the plane of the curve. You can then rotate the prototype and change the Forward Axis to find the particle position that you want.

Note:  The final position is subject to additional rotations by the Forward Axis, Particle Rotation, and Rotation Shift.

In the image below, the prototype is inactive and can be seen wireframed towards the center of the image. The Up Vector is (0, 1, 0) , which points perpendicularly through the ground plane, and the Forward Axis is set to Z. Also, Align to Curve is off to keep the particles at the orientation of the prototype. Alternatively, you could adjust the orientation by rotating the prototype in polygon, edge, or vertex mode.

Warning:  When rotating the source mesh you must be in polygon, edge, or vertex mode for the rotation to carry through to the particles. This because replicators ignore the item level rotation, position, and scale values from their prototypes.

### Using Particle Scale and Particle Rotation

The Curve Particle Generator uses a Gradient Editor to determine variations in particle scale and rotation along the curve. The gradient can be displayed as a gray-scale color bar (where white represents the maximum value) or as a curve.

The image below shows an example for the Particle Rotation. The sawtooth pattern of the line indicates that successive particles are increasingly rotated until the maximum value (360o) is reached, the rotation then resets to 0o. This would appear as a smooth gradual increase in rotation along the curve, as a rotation of 360o is equivalent to a rotation of 0o.

Note:  The Particle Rotation setting is used to achieve the rotation in the chain, pictured at the top of this topic.

The image below shows variation in rotation and scale as depicted in a full-blown Gradient Editor. Each curve is labeled with the name of the property. The result is shown at the top of the image.

The properties are assigned to gradient channels. Gradients cannot be animated, which is why there is no channel animation button next to the property. However, there are Scale Shift and Rotation Shift settings, which offsets the gradient and can be animated.

# Using the Curve Particle Generator

The following steps show you how to use the Curve Particle Generator to create the wooden chain image shown above.

Note:  If you already have a source mesh to replicate, and a curve in a separate mesh layer, skip to step 4.

 1 First lets draw the source mesh, in this case let's use the Torus primitive to create the ring that is used as the link in the chain. On the left panel, on the Basic tab, click Torus and size it to look similar to the one below. The position of the ring won't affect the result.

 2 On the right panel, open the Items tab, click Add Item.
 3 In the Procedural Preset Browser, expand Items on the left column, and double-click Mesh.

A new mesh layer is added to the Items list, which will be used to hold the curve.

 4 On the left panel, open the Curve tab, click Adding Curves, and enable the Closed property.

Tip:  You can also close the curve by right-clicking on the first control point of the curve.

 5 Click several times in the 3D viewport to draw a curve path. Press the Spacebar to drop the tool.

The image below shows the curve used for the wooden chain (the inactive mesh for the ring can be seen in the background).

 6 Add a Curve Particle Generator to the Item List: Click Add Item and select Particles > Point Clouds. Double-click Curve Particle Generator.

 7 To assign the source mesh (the ring) to the generator, On the right panel, ensure the Curve Particle Generator property Source Curve is set to the mesh containing the curve.

 8 To see the particles add a Replicator: Click Add Item and select Items > Particles. Double-click Replicator.
 9 In the Replicator tab in the Properties tab, set Prototype to the mesh containing the ring. Set Point Source to Curve Particle Generator.

The images below show the 3D viewport and the rendered output (the source ring layer is hidden).

Tip:  To preview the particles without rendering, set Ray GL to Full or Fast in the 3D viewport. To hide the original Toroid item, click the eye icon in the Items list.

 10 To make the chain look like the one at the top of this topic, make some adjustments to the settings of the Curve Particle Generator as follows:

In the CPG Distribute tab, increase the Point Count to 32.

In the CPG Control tab, set the Forward Axis to X.

To make the links appear interlinked, adjust the Particle Rotation: Open the CPG Control tab, click the gear icon at the right of the Particle Rotation bar and select Medium Height View. This makes it easier to edit the rotation gradient.

Right-click the key (small square) in the bottom right corner and enter the 500 in the Value field to create a linear increase. Add additional keys on the curve by middle-clicking on the curve and then reposition the keys to create a sawtooth type pattern similar to the one below. Right-click on the top keys to set the Value to 500 to see the results in the Preview Viewport. This should provide enough increase in rotation along the path to make the links appear interlinked.

 11 Finally, add the wood texture: Click the Shading tab to open the Shader Tree. Click Add Layer and select Textures > Wood. Ensure the Wood layer is above the Base Material.
 12 Press F8 to open the Render Preview.

# Curve Particle Generator Properties

Edit the following properties to customize the behavior of the Curve Particle Generator.

## CPG Distribute Tab

Curve

Source Curve

Sets the curve to use as the path for the particles.

Curve Index

Selects the index of the curve to use from the source mesh. The index counts up from 0.

Use All Curves

When enabled, uses all curves from the source mesh. This overrides Curve Index.

Point Mode

Allows you to choose the particle distribution mode:

Point Count - Sets the number of particles to place along the curve. This is the default setting. When enabled, set the Point Count value.

Spacing Distance - Sets the distance between particles. The number of particles is then decided according to this distance. The beginning and ending points are maintained. Once enabled, set the Point Spacing value.

Exact Distance - Sets the exact distance between particles. Once enabled, set the Point Spacing value. The last point disappears when it pushes off the edge of the curve.

Point Count

Specifies the number of particles to place along each curve. This is enabled when Mode is set to Point Count.

Point Spacing

Specifies the distance between each particle. This is enabled when Mode is set to Spacing Distance and Exact Distance.

End Behavior

Sets how particles at the end of the curve behave. The following options are available:

Cluster- Particles stop at the end of the curve.

Wrap - Wraps particles from the end of the curve to the start.

Project - Particles exceeding the end of the curve are placed on a straight line past the end.

Remove - Particles exceeding the end of the curve are removed.

Offset Percentage

Sets the amount by which the particles are pushed up along the curve. At 0 %, the particles are unmoved. At 100 % the particles are pushed along by the full distance of the curve.

If Wrap is unchecked, the particles will bunch up at the end of the curve. If it is checked, the particles will wrap back around and no bunching will occur.

Start Percentage

Sets the amount along the curve length at which to place the first particle.

End Percentage

Sets the amount along the curve length at which to place the last particle.

Particles IDs

Particles ID Mode

Choose a particle ID mode:

Span Each Curve - Particle IDs range from 0-1 for each curve.

Span All Curves - Particle IDs range from 0-1 along all curves, , assigning each curve a chunk of the 0-1 range.

Random - Particle IDs are randomly assigned.

## CPG Control Tab

 Name Specifies the name of your curve particle generator. Alignment Alignment Mode Specifies the type of alignment mode to use: • Automatic - Particle automatically aligns to the curve, using the up vector of the particles. • Curve Direction - Particles align to a specified curve in the scene. Defines that curve in the Alignment Mode option. The particles point towards the chosen curve. Moves that curve and the particles follow. • Mesh Normal - Particles align to a selected object in your scene. Defines the object in the Alignment Mode option. The up vector of particles align to the surface normals of that object. • Mesh Direction - Particles align to a specified mesh in the scene. Defines the mesh item in the Alignment Mode option. The particles point towards the chosen mesh. Moves that mesh item and the particles follow. • None - Uses the forward axis to determine the particle's orientation. Alignment Mesh Selects the item used for up vector alignment. Align Index Specifies the index value. Enabled when Curve Direction Alignment Mode is enabled. Forward Axis Selects the source mesh axis that is to face forwards along the direction of the curve. Reverse Axis Reverses the direction of the particles based on the Forward Axis specified. Up Vector X, Y, Z Defines the outward facing direction of the curve vector used to determine the particle rotations. Usually, this should be the vector crossing through the plane of your curve.