### The Implementation of Mathematical Concepts in Houdini

Intro

So I have been meaning to cover this topic for awhile. Houdini's core (no pun intended) is centered around the idea that every creation will be created from the basis of a mathematical formula. No matter how different the attributes or values are in the formula, it will be Houdini's job to collect and calculate the information. Houdini primarily uses a language called VEX to read inputted values and dependencies with functions you chose. These functions can also sometimes be scripted by you in wrangles. Now keeping this in mind, this article will be covering mathematical creations with Houdini, and the history behind them. I won't be diving into VEX functions or scripting, but I will be covering the visualization of mathematics in the software. So let's begin.

Sin, Cos , and Tan Functions

These are called Trigonometric functions. As the name suggests, these formulas are based of the angles of triangles. Especially right triangles. But I'll talk more about that below. Triangles have three sides. Which are called the opposite, hypotenuse, and adjacent. For example, to calculate the angle called Sin, you'll need to find the length of the opposite side of the triangle, and the length of the hypotenuse and then divide them. Here is an easy way of remembering the formulas:

Sin = Opposite Side / Hypotenuse

Cos = Adjacent Side / Hypotenuse

Tan = Opposite Side / Adjacent Side

These functions also produces wave like lines when you place them on a graph. These waves are incredibly useful in 3D space.

Trigonometry has also been used since 2000 BC. It's probably one of the oldest mathematical formulas out there, and has been used by the ancient Egyptians and Babylonians. However, the name name for trigonometry wouldn't come until the 4th century BC when it was named after the Greek work for measure: trigōnon.

You might notice that most of the tools in Houdini that are centered around these functions can be used in VOPs, CHOPs, or wrangles. In VOPs you can use the Sin, Cos, Tan, or Oscillator nodes to build waves to feed into your attributes. Vops also contain there own trigonometric functions for calculating a curve. For example, acos would compute the arc of the cosine value, atan the arc of tan, and asin the arc of the sin value. There are more functions, but these are just the basics.

You can also input these functions into parameters on your objects to control how their movement slows, smooths, or changes over time based on your chosen wave.

CHOPs rely heavily on wave functions to operate. Because they operate with audio channels, they also operate with the wave frequency of the audio. Therefore, they also contain channel VOPs, and other nodes to edit the audio. The Function Channel node is one of these. It operates on the chosen inputted audio and allows you to chose which math function to apply to the channels. You can pair audio channels using functions, blend them , or measure the angles of the audio waves in radians, degrees, or cycles.

Why Use Right Triangles?

As I came out with the first draft of this article, two people pointed out that I should probably mention right triangles.

Vector displacement and rotation rely heavily on shape and attributes of right angles. Or the Pythagorean theorem. If you look at a graph you have the three dimensions X, Y, and Z in their proper planes. Which at the center (0,0,0), forms a perfect right angle. Using this as the starting position for anything, you can suddenly figure out where everything aligns in 3D space using that as a starting angle.

Vector displacement describes the shortest length of distance of a vector from it's starting position. The starting point being 0,0,0 in 3D space, and the end point being anywhere else. Using the Mountain SOP in Houdini would be a great way to visualize the displacement you are adding to points in your scene. If you move your geometry anywhere else in the scene besides the origin, you'll notice that the displacement will change. This is because the displacement of the Mountain SOP is based around the origin.

Rotation also relies heavily on right triangles. You'll notice every-time you use a Transform SOP, that it is also based around the origin in the scene. Rotation involves angles and degrees in it's calculation. So nothing can be transformed or rotated without knowing the starting angle of it's position.

Formulas and Visualization

Now for the fun bit. Let's talk about some more complex formulas, and the visualization practices that come with them.

Strange Attractors

A Strange attractor is a mathematical field for dynamic systems. Basically, this formula will form an expanding and evolving system based on how the values in the formula change. An Attractor can be based on a set of points, or curves. But what makes Strange attractors special is that they are a sub-class based on fractals.

The first person to introduce the idea of an attractor was John Milnor. John is an American Mathematician and professor. He excels in developing equations for dynamic systems and K-Theory. Currently he teaches at the University of Stony Brook.

Strange attractors some very beautiful abstract spirals once modeled. In Houdini, the basic approach for creating strange attractors is by creating a set of points and as the points duplicate, set the previous point as none active. Then apply one of the variations of the attractor's functions, and voila! There are two tutorials out there that you can use to create this field. One by Junichiro Horikawa HERE, and one by Entagma HERE. These tutorials break down the math better than I do, and they also go more into depth about the setup process.

The Super Formula

This formula designed to encompass all of the complex shapes found in nature. By choosing different values for the parameters in the equation, different shapes are generated. For example, you can quickly generate leaves, shells, and stars with this formula.

This formula was based off the equation of creating a super-ellipse. A Super-ellipse is considered a super shape. What a super shape is made out of is a combination of two equations for two different shapes. A super-ellipse is a combination of the equations for a sphere and an ellipse. The result will be a shape that sits somewhere in the middle between these two forms.

In Houdini you can create super-formulas through VEX. You'd start by creating points, then use polar co-ordinates, and the finally create steps for the equation to take so it completes one full rotation of the shape.

You can find a great walk through of a Houdini tool of it HERE. Thank you David Kahl.

Fractals

These are easily one of the most interesting effects used in the visual effects world. A fractals is a never ending pattern. It calculates the same equation over and over to create the same visual over different iterations. This is called expanding symmetry. Fractals are naturally found in nature and you can see them in leaves, trees, shells and clouds.

Fractals contain an indefinite fractal curve. Which means the patterns it creates can resemble a surface.

Then we have our Mandelbrot and Mandelbulbs. These are classified as abstract fractals. They are mainly created by a computer calculating the same equation over and over again. Once animated, they create these amazing 3D moving shapes that look like an alien world. They were first created by Daniel White and Paul Nylander in 2009. Their equation can also be based off of different formulas. Such as the Quadratic, Cubic, and Quintic formulas. Mandelbrots are named after American mathematician Benoit Mandelbrot. He was the first person in the world to come up with word fractal.

There are many more different sets of fractals I haven't covered here, but these are just some basic ones.

Fractals aren't used in the film or television industry too often. Simply because they are hard to create and modify easily. But they were highly used in Guardians of the Galaxy Volume 2 to create the extraterrestrial world of ego the living planet.

Here are three tutorials on fractals that I highly recommend watching:

VFX Hive's A Journey through patterns and forms by Harkonnen: HERE.

Entagma's Mandelbrot and Mandelbulb: HERE.

Junichiro Horikawa's IFS Fractals Tutorial: HERE.

Gray Scott Patterns

This is something also known as a reaction-diffusion system. When you think of diffusion pattern, you might think of a dissipating liquid in chemistry class. You would not be wrong. However, these systems can also be applied to things outside of chemistry. Gray Scot Patterns are also responsible for creating the spots on giraffes and leopards, patterns in butterfly wings, and symmetry of the eye.

The equation that a Gray Scott pattern runs off of is a bit simple. It relies on two variables U and V to interact with each other. Then the equation calculates what levels of concentrations these variables have, how they will react with each other, and then how they will diffuse. Out of this equation bubble-like waves can be visualized across a surface.

These patterns have been visualized by computers since 1994 when Roy Williams, a computer scientist, first used them in a presentation for the California Institute of Technology.

You can find two great tutorials for how create this effect by Junichiro Horikawa: HERE and HERE.

This is also a great website for understanding Gray Scott Patterns: HERE.

Hyperbolic Tiling

This subject relies and operates on the idea of every singe vertex in polygon

formed geometry has symmetry. As well as all polygons on the surface of

an object will form a pattern. You can manipulate this pattern to animate

the number of vertexes, and then move polygons across the surface of your

object.

Hyperbolic describes any geometry/polygons on a spherical surface or curve.

Therefore, by creating hyperbolic tiles, you are creating polygon tiles across

or inside a spherical surface.

You can find a great walk through for how create this effect by Junichiro Horikawa: HERE.

Wave interference

This subject covers the question:"If two waves were traveling, and

collided into each other through the same substance, what would

happen?" The answer being that these two waves would produce a

shape based on the net effect the waves had on the substance they were

in. Think of two tidal waves colliding. When they would collide, they

would push all the water around their movement and collision up and

out. That would become the outputted shape of the interference.

You can model these outputted shapes from wave interference in Houdini.

Mainly by creating a starting geometry, and then animating ripples across

it to see what happens.

You can find a great walk through for how to make one HERE, by Entagma.

Recamán’s Sequence

This sequence is based on recursive patterns such as fractals.

When visualized it forms these overlapping circles that grow outward in a

line, and vary in size. These circles are formed from a sequence of integers

that look like this:

0, 1, 3, 6, 2, 7, 13, 20, 12, 21, 11, 22, 10, 23, 9, 24, 8, 25, 43, 62, 42, 63, 41....

As you can see they go forward, and then go backwards in value. This

creates the recursive nature of the pattern as it will also grow outwards and

overlap back over itself. This sequence can also be represented in sound as

musical notes going up and down in a scale.

Recamán’s Sequence was named after it's inventor Bernardo Recamán Santos who was a Colombian Mathematician.

You can find a great walk through for how to make one HERE, by Entagma.

Artists that use Mathematics to Their Advantage

During the time researching this article, I thought it might be a great idea to give credit to the amazing artists who have spent most of their careers visualizing math and abstract functions in the software. So here are some really cool people who made this writing possible. There are many more, but these were are some of the recurring cast that show up whenever I chose to write about something.

Junichiro Horikawa

This man is a Houdini wizard. He is an artist based out of Japan that focuses his work around architecture and IT systems. He also explores the program Grasshopper 3D. Currently on his YouTube channel you can learn how to create Strange Attractors, Grey Scott Patterns, Fractals, Mandelbubs, and much more. He's dedicated a lot of his career to finding the middle ground between art, architecture, visualization and design. If you're wondering what he's currently building I recommend checking out his sites.

Professor Deborah Fowler

One of my favorite professors who never taught me. (Sorry for the sass. :)) Deborah Fowler is a visual effects professor at SCAD. She has been working in the visual effects industry since 1995, with her first production being on Toy Story. She's worked with NASA to help build student run projects, and helped produce two SIGGRAPH papers. These papers also appeared in two books entitled: The Algorithmic Beauty of Plants and The Algorithmic Beauty of Sea Shells. Currently, on her YouTube channel she is showing how you can implement orientations to curves, Python, and Turtle. Currently, she is working on a Rehabilitation VR project with Emory University. I would highly recommend checking out the math page on her site HERE, as it is amazing.

David Kahl

He is a software developer and artist based out of Germany. He dedicates a fair amount of his time to teaching others about the world of VEX, and complex algorithms of Houdini. He also posts a lot on Sidefx. You can also find most of his tutorials on there. One of my favorites of his is how he creates a super formula inside of the software. He's really given a lot back to visual effects world, and it clearly shows.

References

How to use mathematical formula?: https://www.sidefx.com/forum/topic/17105/?page=1#post-80451

Expression cookbook: sidefx.com/docs/houdini/ref/expression_cookbook.html

Houdini: http://page.math.tu-berlin.de/~chern/teaching/houdini/HoudiniIntro.pdf

Houdini Expressions & Functions: https://bubblepins.com/blog/houdini-functions-amp-houdini-expressions

Houdini, sin, cos, smooth functions: https://www.youtube.com/watch?v=aH0KGGOlDkc

The Superformula in Houdini | VEX Quickies: https://www.youtube.com/watch?v=TPJ0TnsQywY

WORKING WITH THE FOURIER SERIES IN HOUDINI: https://lesterbanks.com/2019/05/working-with-the-fourier-series-in-houdini/

Procedural modelling in Houdini based on Function Representation: http://www.aaweb.ch/2011/08/procedural-modelling-in-houdini-based-on-function-representation/

Basic Maths in Houdini X Rotation Matrix: https://www.youtube.com/watch?v=l8cC5bCd-8w

Algorithmic Design with Houdini | Junichiro Horikawa | SIGGRAPH Asia 2018 (Tokyo): https://www.youtube.com/watch?v=rj0dEEVU1Ek

Polar Coordinates in Houdini | VEX Quickies: https://www.youtube.com/watch?v=hgEcnfyBvf8

Junichiro Horikawa: https://jhorikawa.com/about-me/

Deborah R Fowler: https://www.youtube.com/channel/UCyIz4ls1ci8LbiGU6jcKQFA

Houdini 4D Shapes - Edutainment by Harkonnen: https://www.youtube.com/watch?v=utdXyG7Bmfk

David Kahl: https://davidkahl-vfx.com/

Maths Book for Houdini: https://forums.odforce.net/topic/29170-maths-book-for-houdini/

Autodesk University“ICE: Design Tools”: https://drive.google.com/file/d/0B7D36pm7TOBCUk9RaXpDZ3NMbUU/view

Trigonometric Functions SideFX: https://www.sidefx.com/docs/houdini/nodes/vop/trig.html

What Are Sine, Cosine, and Tangent?: https://www.quickanddirtytips.com/education/math/what-are-sine-cosine-and-tangent

History of trigonometry: https://en.wikipedia.org/wiki/History_of_trigonometry

Gray Scott Model of Reaction Diffusion: https://groups.csail.mit.edu/mac/projects/amorphous/GrayScott/

Theory behind patterns formed on Chladni plates?: https://physics.stackexchange.com/questions/90021/theory-behind-patterns-formed-on-chladni-plates

Uniform tilings in hyperbolic plane: https://en.wikipedia.org/wiki/Uniform_tilings_in_hyperbolic_plane

Wave interference: https://en.wikipedia.org/wiki/Wave_interference

Interference Patterns: https://entagma.com/interference-patterns/

Recamán's sequence: http://oeis.org/wiki/Recam%C3%A1n%27s_sequence

Recamán's sequence: https://en.wikipedia.org/wiki/Recam%C3%A1n%27s_sequence

Into the Transform Matrix: https://paulneale.com/transform-matrix/?fbclid=IwAR17w8Yq1IiMF637UtxYQS8K4SOsXSbzt-hiD7L4t_Dn32XOW-i4DQTE8zs