One of the cool new features of Houdini 13 is having particles in the dynamics context. Of course, Houdini has various nodes to handle particles. But how does it all work? In this post, I’ll explore how to create a very simple particle system in DOP from scratch.
Source Geometry
First of all, we’ll create an object to generate particles from. Let’s create a sphere, scatter points on the sphere, and add velocity attribute that points away from the center of the sphere. The SOP chain will look something like:
To make the particles a little more interesting, we’ll set Random Seed to $T. And just so we can see the individual points in the viewport more clearly, we’ll just reduce Number Of Points to 10.
The Velocity attribute is set with the position of the sphere. This will give us velocities that initially point away from the center of the sphere.
Now, we should see some points being scattered around.
Create the DOP Network
Next, we’ll obviously need a DOP network. The most basic elements of a DOP simulation are objects and solvers. This is not specific to particles, and applies to any DOP simulation (RBD, fluid, FEM, etc.). So, let’s create a DOP Network. And inside it, we’ll create an Empty Object, and a Multiple Solver.
The Empty Object will create a bare simulation object (DOP Object) that will be used to simulate our particles inside this simulation. As we’ll soon see, in order to simulate our particles, we’ll need to make use of a few simple solvers. That’s why we need to attach our DOP Object to the Multiple Solver. The Multiple Solver allows us to combine a series of solvers together, and each solver will be processed one after the other.
Generate particles
At each timestep, we want to use the source object to add new particles to the DOP object. This can be done easily by a SOP solver. A SOP Solver contains a SOP network that will receive the DOP object’s geometry as input, and uses SOPs to generate the output geometry. The output geometry then becomes the new geometry of the DOP object. In our case, the input DOP geometry contains the existing points, and we want to add new points to it using the source geometry. This is very simple to do with SOPs. All we need to do is use Object Merge to bring the source geometry into the SOP network. Then, use a Merge to combine the source geometry points and the input DOP geometry.
First create a SOP Solver, and connect it to the Multiple Solver node.
Then, inside the SOP Solver, create a Object Merge.
And pick the source object.
Then, create a Merge node, and connect the DOP geometry and the Object Merge together.
And we’re done! If we play the simulation now, we’ll see particles being generated, but they’re not moving at all!
That’s because we don’t have a solver that moves the particles!
Moving the particles
The points do have velocity attribute, but we don’t yet have a solver that uses the velocity to move the points! This can be done with the Gas Integrator solver. The task is simple. Create the solver, and connect it into the Multiple Solver node.
Then, we need to set the Geometry parameter to “Geometry”, so that the solver will update the points from our geometry.
And now, if we play the simulation, we’ll see particles moving away from the center, according to the velocity!
Gravity
Next, let’s add a simple gravity force. We clearly need to use a Gravity Force node here, so let’s attach one to the DOP object.
If we play the simulation, we’ll notice that nothing has changed. This is because we don’t have a solver that takes forces into account and modifies the velocity. That’s exactly what the Gas External Forces solver will do. This solver will update the velocity of each point according to all the forces that are attached to the DOP object. So let’s create a Gas External Forces node, and connect it to our Multiple Solver node.
Then, we need to set the Geometry parameter to “Geometry”, so that the solver will update the points from our geometry.
If we play the simulation now, we’ll see that the particles are affected by gravity!
That’s it!
This is a simple DOP exercise to demonstrate how particles can are created in DOP. Normally, it’d make much more sense to use the packaged POP nodes that come with Houdini. The packaged particle nodes have much more functionality that are not covered in this post. Nonetheless, it’s very interesting to know what’s involved in creating particles from scratch in DOP.
Thanks a lot for sharing your knowledge. I like to know how it works under the hood. I would like to know more about micro solver. It could be nice to see more tutorial like this.
Doum