Point Attractor Tutorial PDF Print E-mail
Written by Sergey Shlyaev   
Wednesday, 08 February 2012 10:32

Point Attractor

Hello and welcome to my tutorial on attractors in Naiad.

In first part of this tutorial we will talk about how to gather liquid around some point.

In second part we will talk about how to shape water into some body.



First things first: what makes particles fly to some arbitrary point in space?

Usually it is some force that moves them.


Newton's laws of motion are three physical laws that form the basis for classical mechanics. They describe the relationship between the forces acting on a body and its motion due to those forces.

Newton's First Law deals with an object with no net force. Newton's Second Law talks about an object that has net force.

It states that: when the net force acting on an object is not zero, the object will accelerate at the direction of the exerted force. The acceleration is directly proportional to the net force and inversely proportional to the mass. It is expressed in formula:

F = ma


  • F is the net force in Newtons,
  • m is the mass of an object in kg and
  • a is its acceleration in m/s2.

From this formula, we can say that force is something that accelerates an object.

So, we need some acceleration directed to attraction point or points.

Let’s say we have a world coordinate system, a particle of water and an attraction point.

Have a look at the picture:

Direction vector might be calculated from position of liquid particle and position of attraction point.

By subtracting position of liquid particle from position of attraction point.

That’s all for the theory.

You may not bother with this laws and physics at all, just remember the red vector.


Download file: point_attractor_start.ni

Launch Naiad and open this file.

The file contains very basic setup: water emitter, dynamics op, filter and emp-terminal.

It has nothing special for attractors yet.

Liquid-Emit-Distance op is set up to emit liquid only on first frame and filter op is set up to keep only liquid body in emp file.

Body name in Particle-Liquid op is set to “water”.

Initial graph

Next we’ll add Particle-Nel-Channel op that will calculate desired acceleration vector for us.

Press ‘Tab’ and type “Particle-Nel-Channel” to place this op in graph. Connect it right after Liquid-Emit.

In op’s properties set channel name to custom_acceleration and channel type to vector.

We will move our liquid to point with coordinates (0,30,0) for example.

So, put in channel expression:

0-Particle.position[0] in first field,

30-Particle.position[1] in second field

0-Particle.position[2] in third field.

As you remember:

Acceleration vector = (Attraction point position) – (Liquid point position)

Thus we set all three components of our custom acceleration vector.

Custom acceleration added

Here we have custom acceleration vector defined for each particle of our sim.

Next we want use it as acceleration. There is an acceleration op in Naiad and we may connect external field to it, but cannot connect particle channel. So we need to convert our particle channel to field and plug it into acceleration.

To do this place Isolate op in graph and isolate your liquid body. Mine is named water.

Place Acceleration op in graph and connect 0 output of Isolate into it’s body input.

To convert particle channel to a field we will use Field-Particle-Splat op. Place it in the graph and connect 1 output of Isolate into it’s input.

Connect Field-Particle-Splat output to field input of Acceleration op.

Let’s set up Field-Particle-Splat:

Our channel is custom_acceleration.

Field type is sure vector, not float.

Set splatting type to ‘Accumulate’. We will discuss it further.

Splatting type.

Our particle channel is converted to field. And now graph looks like this:

Graph with splat.

Run the sim.

It does not look like particles are attracting somewhere.

Let’s add Drag op with drag value like <<2,2,2>> to keep particles together.

We will talk about other ways to keep particles together later here and in body attractor tutorial.

Add else one Acceleration op with default value of <<0,-9.8,0>> so we have gravity in our scene.

Run the sim.

Download Video: MP4, HTML5 Video Player by VideoJS

Now particles are grouping around attraction point.

That is the basics of how point attractor works.

Download scene file here: point_attractor_simple.ni

Let’s play around and change the attraction point to something more interesting.

Create Box-Mesh op, it will visualise attraction point for us. Name it box and set it’s scale to 2 for all axes.

Put the following expression into corresponding fields of “particle_nel_compute_point-p_value” op where we compute custom acceleration.




This reads:

Custom acceleration is equal to current position of the box minus current position of particle.

The same idea as earlier but now we may animate box and water will follow it.

Animating box is more convinient if you want to see your attraction point.

Let’s add some motion to box. Put the following expression into Translate attributes of box:

sin(time*2.5)*10 for X

time*10 for Y

cos(time*2.5)*10 for Z

This is just to animate box.

Run the sim.

Download Video: MP4, HTML5 Video Player by VideoJS

Here it goes.

Try to set splatting method to “Weighted Average”.

Splatting method sets how particle channel is converted into field. “Accumulate” gives more expressive results “Weighted Average” is more “calm” and easy to control.

Just find which works better in your case.


Download Video: MP4, HTML5 Video Player by VideoJS

We need to increase attraction value.

Add Field-Scale op after Field-Particle-Splat and set scaling to <<10,10,10>>

Run the sim.

You should get something like this:

Download Video: MP4, HTML5 Video Player by VideoJS

Notice the difference in particles behavior between “Weighted Average” and “Accumulate” splatting types.

That is all for point attractor.

Here is our graph:


Download the file here.

Playing with attraction strength and setting different point animations is a lot of fun.

Last Updated on Wednesday, 15 February 2012 15:03