Exploring Houdini for Simulating the Geometry of Time-worn Habitats

A project log for Havens

Hiding life in surprising places.

owen-truebloodOwen Trueblood 12/02/2020 at 00:120 Comments

Weird life and weird habitats should go together. To get the appropriate dose of alien inspiration I want to avoid designing the geometry of these artifacts directly with my human hands and mind. Instead they are going to be plucked like fruits from a garden of complex computer simulations inspired by research into plausible constraints for the life-bearing environments that I have in mind.

Picking the right tools for building my garden of simulations is critical for getting the result that I want. Ideally they allow me to both design and run highly complex simulations in a practical way. There are a huge number of tools that are appropriate for this kind of work but they all make different trade-offs between the kinds of systems they are able to express, their scale, and the ease with which the systems can be described.

Game engines like Unity and Unreal are great for dynamic real-time systems with complex rules and a lot of human-authored content. But they aren't the best for generating arbitrary geometry. They trade off being able to run very complex simulations in order to meet their real-time constraints.

CAD software like Rhino is great for designing static geometry precisely and can handle very large scale designs. In combination with parametric design tools like Grasshopper it's also possible to generate those designs through simulation. But it can be hard to mix in dynamic content or plug in other systems or data to drive the simulations. Often many trade-offs are made to optimize these tools for their most common applications, for example in architecture or product design.

I've used the tools mentioned above as well as others like Blender, Processing, and openFrameworks. Recently I have been playing around with a new one and am very excited to explore it's application to the kind of simulation-driven geometry that I need for this project. The tool is Houdini, which is a tool that's usually used for visual effects in commercials, movies, and etc. It used to be out of reach due to it's price tag but sometime since I first looked at it a free "apprentice" version was added as well as a relatively affordable "indie" license. Houdini is special because it is enormously flexible, expressive, and powerful (i.e. able to run very complex systems). It benefits from the might of the modern visual effects industry which is able and wants to throw huge resources at making tools like Houdini as good as possible. It lets systems be expressed visually in the form of flow graphs, which is very quick for prototyping, but code can be freely mixed in when something needs to be done off the beaten path. It runs well on a laptop but it can also orchestrate simulations and rendering across massive clusters.

In short, Houdini is a great tool for designing weird life for weird habitats. But it definitely has a steep learning curve. So I'm starting out small with simple experiments as well as replicating work shared by others.

Wormy Substrate

The first thing I wanted to try was generating some geometry and then 3D printing it. So I made a chunk, applied some noise, broke it into pieces, extruded tubes along the seams, and then cut random spheres out of it to get this weird piece of cheese:

Here are the tubes that I extruded along the broken pieces of the starting block:

Here's what it looks like 3D printed:

It was encouraging to see how easy it was to manipulate volumes with boolean operations to generate geometry that would print. But I was pretty bad at optimizing the operations so it took a good 45 minutes to chug through converting the volume to a polygon on my laptop. I later revisited this idea after learning some more about how volumes work in Houdini and ended up with this result that generated in a couple of seconds:

Simulating Microfluidics

A significant portion of the complexity of the support systems for the synthetic life in future spacecraft will likely have to do with manipulating fluids. Biology is wet and exploits the properties of water everywhere, from delivering nutrients to facilitating motility. In biology there are many examples of complex structures "designed" to exploit or manipulate fluid mechanics. I expect that over time our artificial systems that need to do the same work will converge on the designs found in nature but be constructed of a wide variety of engineered materials.

To take the first steps down the road towards realizing some complex speculative fluidics systems (and just to practice the basics of Houdini) I tried simulating some basic microfluidic chips:

For the first experiment I connected two spiral curves and extruded a circle along the path. Then I animated a second extrusion so that it filled up the same path over time. Rendered with the Renderman renderer from Pixar to get an approximation of glass.

The next thing I wanted to try was a dynamic simulation. I had been looking at a lot of videos of scientific experiments and commercial products using microfluidics and a commonality in those visuals was the peculiar perspective you get when looking through a microscope with lighting from underneath what you are looking at. I thought it would be fun to try to get an approximation of what it looks like for a bubble to flow through a microfluidic system as seen through a microscope. I ended up with this:

It's a Vellum simulation of a balloon with pressure constraints and a sideways forcefield rendered with an area light facing the camera underneath the geometry and a couple of surface shaders set up with partial transparency. Playing with the index of refraction and the roughness of the surfaces involved got me closer to the intended effect but it's still far from the quality I want to reach.

Growing Networks

Looking at the boring precision of the spirals in my first attempt at simulating a microfluidic chip got me wanting to play with generating channels in the freeform ways that life does. Then I came across a tweet by Junichiro Horikowa linking a tutorial he made showing his implementation of a simple slime mold simulation in Houdini based on a blog post by Sage Jenson. It was exactly the kind of thing I was looking to try. First I implemented my own simulation based on the Sage Jenson's blog post in Processing:

Then I followed along with Junichiro in Houdini and ended up with:

It's a really great effect for a simulation with such simple rules. And now that I have it running for myself in Houdini it's a perfect jumping off point for future agent-based simulations. I was really impressed that a simulation with 500k particles ran almost real-time on my laptop, compared to just a few hundred particles in my Processing sketch.

The next thing I want to do with this is use the network that forms to cut channels in a block of material and then simulate particles flowing in that as if it were a microfluidic system.