Simon Verstraete shared a beginner-friendly tutorial on how to generate procedural crystals in Houdini covering the base shape, different kinds of noises, the mountain node, and masks.
Hi, my name is Simon and I’m a tech artist with a focus on making procedural content in Houdini.
Recently, I finished my procedural Crystal generator with Houdini and Unreal Engine 4. The inspiration for this project was from Kurt Kupser, he created a tutorial for shaders in UE4 on Artstation Learning. In the tutorial, he shows how to set up a shader for crystals. The tutorial starts with preparing everything, this includes a crystal model. The normal approach to making a crystal would be to sculpt or model it by hand. I felt that you could get this crystal in a more procedural way, so that was the start of this project.
The breakdown is beginner-friendly!
Let’s first talk about the Houdini setup and how to create crystal-like shapes. By default, Houdini offers some nice nodes and tools to do this.
The first step is creating the base shape, I also wanted to match the shapes and form a bit to what Kurt had in his tutorial. Beginning with a base sphere and increasing the number of polygons on it gives a good start. You can see an example in the picture below.
Further, I want to change the shape and stretch it out in the height or y-axis (up axis in Houdini).
To do that, let’s use a soft transform. Select a few points at the bottom of the sphere and drag them down. A great slider to play around with is the Soft radius, it controls the influence of your changes around the selected points. The image below shows how the soft transform works.
Next up is using a voxel (or vdb) on the model. The main reason for that is to increase the poly count and use that later to displace the model. I like to use the Labs Voxel node for that. SideFX Labs is a collection of over 100 nodes that are free with any version of Houdini.
Adding the Labs voxel will give you the option to set a resolution for the voxel size. Often, I go with the custom value and try out values. For this model, around 120K polygons is enough.
Noises and the mountain node
With this base shape, we are ready to add some displacement on the model. The mountain node will be used to move the points of the model based on noises.
The mountain node is very interesting to create noises. The first thing to learn here is to know what the noise is in the mountain nodes. In the image below, you can see a collection I made of all the basic nodes.
Take your time to look at these noises and play around with different settings and types of noises. You can also stack multiple mountain nodes on top of each other.
Notice that in the mountain here the Roughness value is set 0 to get a clean output of the noise. Adding that Roughness will add small details and distortions.
The noise that will be used to make the crystals is the Worley F1. Worley, Manhattan, and Chebyshev are the noises that are often used.
In the image below you can see the settings of the mountain.
Look also at the scale value, you can see that I increase the Y value of that. This will stretch out the Worley and create a better crystal feel. Try out different values and other parameters to get more variation and better results.
A downside of using the mountain on geometry is that the geometry is limited and can give strange results on complex shapes, here it is safe to use with the simple crystal. Another way is to use VDB and add noises to a VDB. This can give better results in complex situations or strong noises and displacements because there is no geometry limitation.
To finish the model part, I added some subtle edge wear and damage. A few weeks ago, I found a new way of making edge wear with a couple of nodes.
Here is an image of the edge damage setup.
What you can see here is that the measure node selects the area where the damage will be (curvature). This information of the measure node is then saved in the colors. Add noise on the shape by using a mountain and this will break up the edge colors of the measure node. Further use the attribute transfer node and this will transfer the color from the deformed shape to the normal shape.
You can find more details on my blog if you want more info about this edge wear/damage.
In the image below you can see the final result. The edge wear and damage are subtle but help to make the shape a bit more interesting.
Another big part of the project is creating masks that will be used in an Unreal material. There will be 3 masks generated: Ambient Occlusion, Thickness, and Curvature.
The first mask is Ambient Occlusion.
To create this mask, there is a Labs node for this, which is called occlusion. Also with Houdini 18.5, there is a new node that will do the same, this node is called mask by feature. In there is an occlusion mode as well.
The result of the occlusion is by default barely noticeable and I boosted that a bit in the settings.
The second mask is Thickness.
To calculate this, there is a small setup to do. I try to keep it as simple as possible and there is no need for VEX. A small downside – it might not be fully accurate but can be art directed on where this effect is.
The node that will do most of the work is the distance from geometry. This node will calculate how far the points are from the second input of the node. The second input is the middle point of the crystal, here I packed the geo which will return to the middle point.
After that, use a remap to tweak the values and make them better.
Lastly, I want to mention that there are definitely better ways of doing this. This is a simplified version that gives a decent result.
The last mask is Curvature.
This mask can be made with the measure node. If you made the edge wear tool then you already know how to use it.
In the measure node, there is a mode to measure Curvature. Here, I also used the principal type. Other settings to tweak are changing the ramp to go from black to white and output the result in the color attribute (Cd).
In Unreal Engine
With the Houdini Engine, it is possible to open Houdini tools (HDA) inside game engines like Unreal Engine. This is a plugin that you will need to install, it comes with Houdini Indie and higher.
Here is a quick demo of the crystal in action inside of Unreal Engine:
Since the masks are stored in the color (Cd), they will appear in the vertex color in Unreal Engine. A downside of it is that at the moment a high polycount is needed to get good-looking masks since they are all stored in vertex colors. You can always bake the colors in a texture, the Labs maps baker allows you to bake inside game engines.
A big part of the project that will make the crystal look stunning is the shader. As mentioned in the beginning, this was based on a tutorial from Kurt Kupser on Artstation Learning.
For a further breakdown, I can only recommend checking out the tutorial. In summary, what will be shown is how to use these masks further to create refraction and depth in the crystal.
Overall, this was a nice, quick, and fun project. Approaching projects more procedurally opens new ways of working. In this case, I can generate hundreds of crystals and each of them will have a nice mask to work with a shader. You can go further and use PDG or an auto export, so with one click you can instantly have hundreds of crystals exported to fbx.
I hope this breakdown was helpful and you learned a few things here and there. It can be a great start for newer users of Houdini to try and recreate this crystal. With a handful of nodes, you can already get a good result and there is no need to code or do complex setups. Try keeping it simple with the base nodes Houdini offers.
Simon Verstraete, Technical/Houdini Artist
You may find these articles interesting