I posted recently about simulating the Belousov-Zhabotinsky reaction in Houdini. Although it worked, it wasn't particularly aesthetically pleasing, so here's a hopefully prettier version using a slightly different approach. In a nutshell, I scatter metaballs over the surface of a sphere and update the color and scale of each metaball based on the solver from the earlier post. The guts of the project lives in a single geometry node and looks like:
Let's step through each node to see how the effect is achieved.
The metaball node creates a single metaball.
The sphere node is the main "scaffold" over which the metaballs will be distributed.
The scatter node distributes points across the main sphere.
The copy_metaballs_to_sphere node creates multiple copies of the metaball at each of the points created by the scatter node.
By default, the copied metaballs don't have a color attribute, the create_color node creates that attribute.
The initial_random_colors node assigns a random color to each point generated by the scatter node.
The copy_color_attribute node copies the random point colors to each metaball.
Finally, the set_scale_from_color simply sets the x, y and z scales based on the color using the expression: (@Cd.r + @Cd.g)
Easy!
Attributes are a core concept in Houdini, I'd thoroughly recommend watching Houdini Concepts Part 1 to learn more about them and the magical Attribute Copy node.
It's been a fairly busy few months at my "proper" job, so my recreational Houdini tinkering has taken a bit of a back seat. However, when I saw my Swarm Chemistry hero, Hiroki Sayama tweeting a link to How a life-like system emerges from a simple particle motion law, I thought I'd dust off Houdini to see if I could implement this model in VEX. The paper discusses a simple particle system, named Primordial Particle Systems (PPS), that leads to life-like structures through morphogenesis. Each particle in the system is defined by its position and heading and, with each step in the simulation, alters its heading based on the PPS rule and moves forward at a defined speed. The heading is updated based on the number of neighbors to the particle's left and right. The project set up is super simple:
Inside a geometry node, I create a grid, and randomly scatter 19,000 points across it. An attribute wrangle node assigns a random value to @angle:
@angle = $PI * 2 * rand(@ptnum);
The real magic happens inside another attribute wrangle inside the solver. In a nutshell, my VEX code iterates over each point's neighbors and sums the neighbor count to its left and right. To figure out the chirality, I use some simple trigonometry to rotate the vector defined by the current particle and the neighbor by the current particle's angle, then calculate the angle of the rotated vector.
Not quite finally, because to make things pretty, I update the color using the number of neighbors to control hue:
@Cd = hsvtorgb(N / maxParticles, 1.0, 1.0);
Easy! Solitons Emerging from Tweaked Model
I couldn't help tinkering with the published PPS math by making the speed a function of the number of local neighbors:
@speed = 1.5 * (N / maxParticles);
In the video above, alpha is 182° and beta is -13°. References Schmickl, T. et al. How a life-like system emerges from a simple particle motion law. Sci. Rep.6, 37969; doi: 10.1038/srep37969 (2016).
Add a comment