# proceduralism

## Creating Bezier Curve Nodes in PopcornFX

While making a demo scene for PopcornFX I found a need to make individual particles move on arcs where I could choose a start and end position, height of the arc, and overall placement in 3d space. Depending on how you approach the problem you can easily find yourself slogging through some pretty involved math, at least for the level I’m at. An “arc” can be a parabola, or a section of a circle or so on. A few directions can take you into the woods pretty quickly. I wanted simple.

The simplest approach I’m aware of is to construct a quadratic bezier curve, since it is defined by a start, end and midpoint and can easily be plotted out using a few LERP functions. If you define a start point, end point and midpoint a quadratic bezier curve describes a very intuitive arc, and if you restrict the control point to be perpendicular to the midpoint of the line between your start and end points you get a beautiful parabolic curve in a very intuitive fashion.

Once I had decided on a quadratic bezier, creating a template in PopcornFX was quick, and it wasn’t long before I had a very useful new node in my toolbox. To extend the idea a little further I decided to take a little extra time and make another node for a cubic bezier curve, which is a logical extension of the same approach.

A cubic bezier curve is defined by a start point and end point like before, only this time those two points each have a separate control point to describe a 3d curve. The resulting path can now diverge from a single plane but is still simple enough for the results to be intuitive. In cases where a quick spline is needed in PKFX, this template should allow the artist to describe a simple motion without having to import in a curve or animation. It’s made up of a series of LERP functions and while the idea can be extended further to create fourth or fifth order curves actually wiring up so many LERP’s gets crazy. We’ll stop with our two handy new nodes, the quadratic and cubic beziers.

Here’s what the two look like in PopcornFX. The more complex cubic bezier is the top curve, and the bottom is the quadratic curve, with the midpoint restriction mentioned above:

So from there I had a nice tool to create motion paths of as many separate particles as I needed. To celebrate, I made the following simulation. Yes, we are playing a game of thermonuclear war:

There are a myriad of ways in which the above animation could be approached, but by abstracting out the “arc” motions into templates I am able to finish the project in a way that leaves me with tools for further work in the future. And of course these nodes can not only be re-used, they can be shared out with other artists.

A final benefit is a much more simple graph overall, and best of all we’ve avoided relying on simulation. Sure you could fire each particle like a little mortar and let a physics node calculate the motion up to the point where the particle collides back to earth. But that’s computationally wasteful and worse it cedes control of the results to the parameters you give the simulation.

By abstracting out the arcs the way I did, I am able to easily able to set conditions so that every arc starts from a populated region and ends in a populated region. If you watch the animation you will note no arcs start or end in the ocean. (I admit however that I didn’t go so far as to prevent Canada from nuking the USA and vice versa…)

Similarly I have control over the heights of the arcs, their angle respective to the surface of the world, and the range or distance any point is allowed to travel. Simple procedural approaches can yield visual complexity while retaining control and easing the difficulty of projects!

By the way this image is entirely particles.

The “land” and “city” areas are the result of taking some texture maps of the earth from NASA into Houdini and using them to create PKFX-friendly emitter geometry as .FBX polygonal meshes. This lets me quickly spawn particles exactly where I wanted them as well as define start and end positions for arcs in areas already predefined as valid. No dart-throwing approaches where particles are spawned and then accepted or rejected based on texture maps or the like.

You can’t always predefine information this way but in this case having re-usable meshes defining the landmasses and cities of Earth was another useful set of tools for future projects. Perhaps the next one won’t be quite so apocalyptic…

## Popcorn FX fractalFlame

Popcorn FX is capable of some pretty sophisticated particle effects. With a little effort one can get past the “usual” turbularized effects and push the limits a bit. Here’s a “fractal flame” look made by spawning, coloring and moving particles with layered noise fields. Given the number of particles used to give the soft look it’s not really something you could include in a game or application but was a fun way to explore some techniques which could be used for more efficient effects. You can get a similar look with much better performance using a vertex shader to distort a mesh and a fragment shader with an additive fresnel transparency, but again the point of the exercise was more an exploration of PopcornFX. That said, this does run in realtime with about 24 fps in the editor, pretty nice.

## Hello, Houdini.

Ok, so Houdini. Like most people I found the initial experience daunting. Cinema 4d is like a warm blanket, Houdini is completely the opposite having a lot of cryptic nodes to learn, many of which have evolved far beyond what they were first intended to do. Being a proceduralist that part of Houdini was amazing to first explore, but there’s a lot of ground to cover and caveats everywhere that can only be worked through by getting hands-on with every inch of this software.

Wheee! This is both fun and completely daunting.

But ok, I’m getting comfortable. VOPs was a no brainer for an ICE guy so I started there and that quickly turned me on to VEX and lovely attribute wrangles. First up, let’s make some lines, and then make some spirals. W00T.

Yep, phyllotaxis and phi resurface. Same concepts, new toolset. For a while I’ll be covering similar ground to prior posts as I rebuild much of my ICE production toolset as Houdini Assets. Now I have a set of .hip assets to create different kinds of spirals, connect lines to points and the like. Stuff in everyone’s toolbox I would think… should I share simple stuff like that here? I’ll probably make a wrangle cheatsheet for little stuff like this and share that.

## Example: LK Fabric early test scene

Since LK Fabric is out I dug up one of the early test scenes we used on Nike “Evolution” at Royale in which we developed some of the techniques we used to get various looks. This setup is very basic but covers some of the key tricks for getting a natural result and was used as a starting point for a number of shots.

I have replaced the original many-versions-old compounds with ones from Leonard’s public release, and have also left in a few “helper” compounds I built which weren’t part of his official release. I then removed everything superfulous to the basic effect and commented the resulting ICE tree throughout. Any typos or misspellings are entirely my fault. :D

The actual setup is very simple.

This scene demonstrates:

• A basic setup of a single evolving swatch of fabric, with the most basic pattern and the modifiers we used most often.
• Using the “slide profile over U/V” compound and other techniques to shape the leading edge of fabric growth.
• Using the “offset” core parameter to make the leading strands animate and form a shape for the thread tips.
• Using a second ICE “post” effect to add per-strand variance and “frizz” effects.

The early tests like this were pretty chaotic, we knew the system did a good job of creating a “perfect” weave so we were pushing in the other direction and adding ways to create chaos and randomness.

Ironically despite the first briefs being focused on “organic” and “evolving” concepts the client spent much of the latter half of the job dialing in a more out-of-box mechanical look… that’s the way it goes sometimes. But this means there is a lot of capability which hasn’t been seen yet. I’d love to see some people use some of the per-strand and per-thread modifiers, and the capability to create patterns beyond the basic “canvas,” to create a more organic, aggressive look.

Here’s the file (Softimage 2013 scene file, ~0.6mb): LKFabric_AMexample1

## Example: A Reticulate Noise Function

Here’s a scene file and a couple of compounds which compute a simple noise function and then create a reticulated “push” from it. It’s meant to demonstrate how a simple spatial noise can be layered on itself to create a fractal, visually pleasing result, as well as give a little insight into how functions like perlin, worley, turbulence etc can be similarly layered to create a huge variety of natural looking patterns.

Scene file and compounds (softimage 2013): exampleICEreticulation

## LK Fabric released

LK Fabric has been released!

Congrats to Leonard Kotch who put his heart and soul into this and who put up with my endless demands for the system during the production.

Pretty much everything you see in the Nike commercials below was built with this system, with Leonard doing daily updates as we worked. We barely touched some of the possibilities of this system, I hope people will try it out because it is cable of some truly spectacular effects. Kudos to Royale for being so cool and sharing it out like this!

## CG Supervisor for 3 Nike Spots

Two of 3 spots. “Evolution” was a small team, 3 weeks, lighting and effects with Softimage and Arnold.

I love small but intense projects like this.

“Run” was primarily Maya/Vray with a touch of ICE. The studio (Royale) is only 6 years old but advancing fast, and it’s been a real pleasure working with them. For their first exploration of ICE, Royale invited in some familiar SI friends – Ciaran Moloney, Steven Caron, Leonard Kotch, Billy Morrison and yours truly doing a first gig start to finish as a CG sup (which with guys like this mostly involved saying “go for it.”)

Like the Psyop “Telstra” spot, this commercial essentially required us to create a system for knitting cloth from massive numbers of strands. Leonard Kotch wrote a system which performs many of the same tasks as the Psyop “Entwiner” tool, but he took a slightly different direction, it was fascinating to compare how the two diverged. The progressive animation required for these two shots resulted in a pretty flexible and broad system, which we are currently using for the last of the three spots, which will wrap in production soon.

Royale has been an enthusiastic and fun group to work with and it’s been great getting to show a studio as strong as they are in design some of the possibilities ICE can bring to jobs like this. Expect to see some version of Leonard’s “LKFabric” system gifted to the community before long – very cool Royale, thanks! (They also throw good parties, their 6’th birthday celebration was impressive and… unusual.)

## Strands are our friends

And so is Psyop!

This little commercial project from a while back was a LOT of fun. A very small team of us (5 or 6 total, I think) made this (plus a few shots more) in just a few short weeks (two or three I forget) at the LA studio, using a hybrid Maya/Softimage approach which Psyop does really well. All models and animation in maya are brought to Softimage for lighting with Arnold and additional ICE effects – in this case, the characters, and stuffing are entirely strands. No geometry aside from the little plastic eyes and their teeth.

Psyop’s lighting supervisor Jonah Friedman wowed me with the system for knitting via strands he built, and how fast he built it. He also quickly made it on my “favorite people” list in general, it was a blast working with him and the others there. The system, which we called “entwiner” builds layers upon layers of strands… these knit characters are built down to every individual fiber. And Arnold powered right through these millions of strands without a blip. Pretty cool. It was so efficient at it in fact, that it made sense to make the “stuffing” out of tiny fibers too, which gave it a nice volumetric kind of feel when lit.

The liquid is a simple lagoa setup, with wet maps generated in ICE. While the commercial was so simple I was really pleased with how the studio took pains to take their clients ideas and give it the very best. A couple of knit characters could have been faked with geometry and textures, but going that extra mile even when time was so short is what really impressed me, and the combination of maya/softimage, ICE and Arnold is a powerful one, as Psyop shows even on small jobs like this. My kind of studio. Thanks for having me you guys.

## Update: Whirlpool and Ridged Turbulence Deformers, Revisited.

A user on si-community asked how to “move” the deformation in the earlier whirlpool example. Doing so involves a couple of matrix transformations – you basically force the points of the geometry to the global origin where you perform your deformation and them move them back to the local space they were in.

It’s a simple operation that I haven’t really figured out how to illustrate in a simple and intuitive manner yet… about the best I could do was to revise the scene so people can compare a “before” and “after”. The first scene is a working scene, it’s where I was assembling the basic deformation, it’s all relative to the global origin. This new scene then goes through the steps of making the deformation “production ready.” I clean things up, make the deformation operate in the object’s space, and package it all up as compounds.

Here are the compounds and the revised scene (2013): example_whirlpoolDeformer2

## Fibonacci, Phi, and Nature

There are a billion discussions of the Fibonacci sequence, phi, the golden section etc. So I’m going to let you browse the wonderful web and largely find out about it for yourself (try here), with only this brief summary…

The Fibonacci sequence is a series of numbers such that the last two numbers of the sequence added together result in the next: 0,1,1,2,3,5,8,13… ie: Fn = Fn-1 + Fn-2.

If you take the ratio between any two consecutive numbers in the fibonacci sequence, they increasingly converge towards a single value, 1.61538 (memorize it!) which is called the “Golden Number” or Phi: Φ

This ratio is found throughout nature, as well as classical art, mathematics etc. It crops up in an amazing number of places. A logarithmic spiral in which points of the spiral are Φ units apart after a quarter turn is called a “golden spiral”, for instance, and can be found in seashells, seed pods, flowers, pinecones and as I said before, lots and lots of websites. If you’ve had a certain amount of coffee, this video might be illuminating:

Other artists using ICE have put out tutorials and compounds relating to these spirals, browse around  (hint I’m one of them.)

Recently as I fiddled around I came across an interesting point about these kinds of distributions that caught my attention: they are a very efficient way to pack particles evenly on a surface. This is an important point to an effects artist, because not only is a large part of this job mimicking nature, but distributing points efficiently on surfaces lets us maximize the number of non-overlapping particles we emit.

So, I built some compounds, first to calculate phi (or simply return it as a stored constant, depending on the accuracy needed.) Another to convert phi into angles in degrees and radians (the “golden angle”), and finally I took these and made an emitter. Hooray, it indeed did allow me to emit a sphere of particles packed efficiently, and even better since I didn’t have to use a “generate sample set” it allows millions of particles to be emitted much faster than simply emitting particles from spherical geometry, and without any resolution-dependance on the LOD of a polygonal sphere. And this “phi” distribution has a nice, natural look.

Here are the compounds, enjoy: ICE_phiDistribution