Recursive Particle Split  
HDK Custom Particle System / April, 2012

I’ve been studying HDK(Houdini Development Toolkit) in last a couple of months. I have written very simple deformers, Renderman point cloud reader and custom particle system. It’s been pretty fun. There are quite enough example codes in the toolkit, so it wasn’t too hard as I thought. Especially “hcustom” command makes everything so simple. The most difficult part for me when I started to learn C++ was probably making a program run for the first time. hcustom not only compiles and links but also installs the binary.

This particle system is purely practice purpose. I tried to make something that cannot be done without HDK, which is actually pretty hard because Houdini already has vex and python, and they are pretty fast, so I’m not sure if I’m going to use HDK a lot as an artist.

Anyway, the Split pop in Houdini has limitation that we can split particle only once. Child particle doesn’t split again unless we use another split pop. I wanted to make a recursive split.

First, I tried to implemente my own particle system using GEO_PointList from HDK. GEO_PointList seemed to have pretty much all I need. I can append and iterate though all elements and do whatever I want with GEO_Point which also has pretty much all I want such as adding custom attributes and so on. But, later I found it is not easy to remove elements from GEO_PointList. I’m not exactly sure why, but my guess is GEO_Point in Sop node is a kind of a base element of other types of elements like vertex or primitive. It is actually easy to delete GEO_Primitive but not GEO_Point.

So, I ended up implementing my own particle vertex class and particle list and redrawing all points in gdb (GU_Detail in Sop) in every frame, which is not as slow as I thought. I implemented simple collision methode using reflection vector fomular and Newton force using distance between particle position and the center of force.

When a particle collide, it can emit new particles and push those new particles into the back of the original particle list, so they are treated as one system, so when the new particles collide, they also can emit new particles and do the same things. The reflection vector can be rotated along collision normal, so the new particles can bounce in different direction.

I used color base on particle’s generation and age. Particles have usual attributes like id, lifespan and state as well as special attributes like the number of collision and generation for this practice.

More test

Powered by Wordpress, Theme by Hosuk