I dabble a lot in Houdini. Its fun.
Latest task required me to create a lightning bolt effect falling from high up onto the ground. I decided an easy approach would be to create a line, and displace it randomly. Sounds pretty simple. Should give us a "jagged" line running from sky to the ground.
However, it turns out that lightning has a lot more complexity to it than what one would initially assume.
To start off, here is a line, with about a thousand points along it.
A line, ready to be displaced. Polyframe node provides us with the needed bitangent vectors which we shall be randomizing to displace the line around it's axis. |
Bitangent vectors on the line which need to be rotated. |
After rotating each vector randomly along the line's axis. This screenshot uses the basic random function of houdini. |
After displacing the given points using a noise function, this is what we end up with. |
So i shifted to a more uniform random number generation, sobol in this case. The result is still very very noisy. |
This made me realize that random number per point was not the right way to go about it. There had to be an order to it. A random direction for every point didn't make sense. Hence i decided to shift to turbulent noise for the random vectors.
Turbulent noise isn't all that turbulent afterall..! |
Variation here is much much smoother, resulting in an almost spiral shape. |
The same turbulent noise visualized on a grid. |
Lightning is not a glow along a pre-existing path. Its iterative in nature. Its a transport of force that takes place. electrons flow in the shortest distance possible to transfer energy. Iterative nature perhaps comes from the fact that which direction to take next somehow depends on the incoming electron. This is much like how water flows along streams, or even across the floor, following the path of least resistance.
One thing that helps us with this is l-systems. They are by default iterative in nature, and houdini even bundles a lightning preset to achieve the same. We will explore that in the next blog post. And perhaps other iterative approaches to modeling lightning.