Suicide Squad, vortical flows and fractal machines

Enchantress is a sorceress and presented initially as perhaps the most powerful member of the Suicide Squad in the film. However, She quickly becomes part of the problem and not part of the solution.

enchant3

To provide the manifestation of her anger, in the form of a new deadly machine, Sony Pictures Imageworks (SPI) went beyond simulation to higher level fractals and vortical flows in some of the most complex work in the film. The Enchantress machine is remarkable in complexity and the extent of the ‘procedural solution’ SPI developed. While not based in reality such as Double Negative’s black hole work for Interstellar, it is another example of the outstanding VFX use of real mathematical complexity visualised for cinematic art.

June Moone was a scientist who became the Enchantress after stumbling across a secret chamber in a remote castle. June can transform into her magical alter ego merely by speaking the phrase “The Enchantress.”

enchant1

MPC provided all of early Enchantress and her army which attacks in the second act (amongst other sequences). Bob Winter was MPC’s visual effects supervisor who oversaw the 700 shots MPC delivered.

Above is a clip from the film, showing the transformation inside the White House situation-room. The film’s effects were primarily handled by SPI and MPC. MPC dealing with the earlier sections of the film and SPI produced the final battle.

Enchantress’s demonstration of retrieving the plans from the weapons vault in Tehran was produced by MPC in Montreal.  Winter pointed out that the brief was to make the sequence more of a physical “hostile take over” rather than just a magical morph. The flipping of the hand was all CG for both characters, and the tilt up on Enchantress was a split between the actress and her CG digital version. The shot was particularly tricky as it is slow, deliberate and without fast editing to hide the transformation. “That was very tricky,” explained Winter, “as it was close to camera, under scrutiny, with highly detail costume, so we did do a pretty significant CG build on her for that scene, to sell that transformation.”
enchant_CUP

Enchantress’s Army (MPC)

The first contact attack featured a street level attack by the army of creatures which have eyeballs all over their skin. The problem was complex as the characters have to move like soft body creatures but they ‘explode’ or smash much more like a black obsidian shattering rigid body. “That was the creative direction from Jerome Chen,” said Winter.  “He discussed with us just what are these creatures, what are they made of.. the demons are soulless creatures so they did not want fleshy interiors.”

The direction the team received was to create them so they calcified when they are hit and shatter in a dynamic simulation as a rigid body simulation. The transition point between the two states was isolated by Winter and the team. While it is normally always possible to do a hand off between two model systems, there was just so much to be done in this sequence that a more complex or unified generic solution was going to be needed.

The team would also have sequential sequences where parts of a demon would be blown away in successive hits. To solve this the team used a mixture of MPC’s in-house Kali software and Houdini. As Kali is a finite element analysis tetrahedral mesh solution, the team needed to tweak the parameters. After all, Kali excels in having objects bend and deform before shattering, something MPC did not really need in this case. But the solution used the standard Kali FEA implementation, which is similar to Pixelux’s base  Digital Molecular Matter (DMM) system. The team produced a generalised solution that allowed them to handle the volume of ‘death’ blows inflicted by our (anti)-heroes. One problem for both Houdini and Kali was repackaging the geometry post-destruction as a renderable asset with its correct textures and look development intact.

On the day of the shoot, there were suited costume stunt people on wire rigs to allow them to move threateningly, and it was this look to which MPC matched. If you look carefully, MPC fully modelled the eye to get the correct reflections off the cornea and more. While there was some eye movement, the movement was subtle in a scene that was more about gross motion than long lingering shots that would fully show the blinking or eye focusing on something.

One interesting aspect was that the production decided to add cicada-like sound for the dark army as they attack, which lead Winter and the MPC team to introduce a high speed vibration to the head vibration of the demon soldiers. This gave the demon army their three distinctive aspects: eye blinks, various head bulges and high frequency vibration.

Making the black bug eyed evil army read in the dark lane way was a challenge, aa the team found they needed to really carefully use highlights to make sure the character read on screen. As the attack starts the firing starts and there are rounds of tracer fire. Each shot was only onscreen for one frame but these also helped introduce flashes and highlights.

A key point was that Will Smith’s Deadshot always hit his target, so the team had to make sure his shots fired in principle photography connected in post. On-set, the team did shoot blanks for some key sequences, so this meant Smith had actual muzzle flashes and contact lighting. In other scenes this had to be added.
To work this out the team drew every tracer and every bullet hit on a QuickTime movie of the plate photography.

They gave this to Jerome Chen who discussed it with the director, who asked for 2/3 of them to be removed. So within a week, the blocking, pacing, and outline were determined just by drawing on a QuickTime. “Once we had done that we populated the scene with tracers and actual final bullet hits,” explained Winter. “We got to a good comfortable place very quickly”.

In addition to these effects, MPC also did a number of other scenes such as Batman capturing Harlequin, the tower attack and flame thrower sequence escape, and more.

MPC did 700 shots in total
MPC did 700 shots in total

Enchantress fight (SPI)

The powerful Enchantress raises her brother, Incubus, and together they decide to teach humanity a lesson for not respecting them as gods and worshiping machines instead. Enchantress decides to do this by building the most complex and destructive machine ever.

In the narrative of the film, neither Enchantress nor her brother are gods. They are simply so advanced in their technology and different in form that they were once regarded as Gods. Thus, the machine she made needed to actually be a technology-based solution, not a magical one, even if to quote one of Arthur C Clark’s laws, “Any sufficiently advanced technology is indistinguishable from magic.” This is what drove SPI VFX supervisor Mark Breakspear and his team to come up with a global threatening machine based on high level maths and not just vapours and lighting bolts.

SPI_VFX_02B

 

SPI_VFX_02A

Director David Ayer

Enchantress and June Moone were played by Cara Delevingne. For her Enchantress sequences, SPI had to do full body motion tracking and detailed body work. SPI designed her dress and costume so that her outfit would be ‘more magical’ and thus it was a fully 3D costume.

For these sequences, Delevingne wore “very little clothes” (see above) and SPI added costume back on top. This “is a really unique thing to do,” said Breakspear. “You normally shoot your actors with cloths on, and add something around it. But we went to a ‘bear minimum’ of what you could do. It was very important for the director it was Cara. We could have scanned her, or motion captured her…it was important she was there acting.”

As part of her Enchantress treatment, SPI replaced all of her body apart from her mouth nose and eyes during the final battle shots. “Yes, we could have done fully CG and we did on some shots,” said Breakspear, “but it on those facial features, the director had gotten such specific performances he wanted to see.”

tattoosPart of the reason for the CG body was that Director David Ayer wanted to see inside Enchantress’ chest so the audience could see her heart, as this was a key plot point.

On the surface of Enchantress skin was a set of complex tattoos which were the source for various auras and magical emissions.  The flowing vapor from her body was complex as “most smoke comes off something and dissipates out,” explained Breakspear.  “But what David wanted was the smoke to build as it came off her, go behind her and control the dancers behind her.” While the production had actual background actors on set, these were replaced with fully CG doubles as ultimately they had to have the smoke interact with them and connect to them.  “Charles-Felix Chabert. our effects lead, did an amazing job of working this out – this really is an effects driven movie and it was very very difficult,” said Breakspear.

Initially, the ribbons of gas that came off her back were reading as solid, so the team introduced flashes in the volume, much like the way lighting can illuminates inside clouds, and Breakspear said that “right away it took it from being a clump of something and into something ethereal.” Houdini was the basis for the fx sequences, lit via Katana with a Maya and Nuke standard pipeline.

SPI_VFX_01A
Enchantress’s machine

The machine that Enchantress builds is based on fractal Mandelbulbs.

Scroll down to read our Quick Guide to Fractals and the see the early SPI tests.

“These things are completely crazy, they are more mathematical surfaces than real surfaces and so when you try and create a model that is based off one you get this approximation that never looks real,” explained Breakspear. “So for a lot of surfaces that had to be ‘fractalised’ we had to work out how to do that and Houdini was a huge part of that.”

Rather than just make something that looked like a fractal, SPI fully embraced the maths of fractals. The problem with doing that is that they are driven purely by the maths. “If you have a fractal and you say – oh can I have that a bit bigger, you cant scale it in X, Y or Z you have to go in and adjust the power,” Breakspear explained. “It is a whole different universe that just doesn’t have any bearing in our world – it is not of this world. It was fascinating and terrifying both at the same time. The director would say ‘I really like that but can you increase the ‘fractalness’ of something?’  And you’d say ‘I can… but it will change the whole geometry of the entire thing’ you can’t just make that more, because that is not how fractals exist.”

Of course, the ‘not of this world’ is exactly what the director wanted.  According to Breakspear, Ayer wanted “her magic to feel like if we went ahead 10,000 years, you’d just say ‘oh well that is just a bit of software – the fractal software program’ it would be everyday. He wanted a kernel of technological truth. It is not Harry Potter magic. He wanted that beyond all possibility.”

In a very real sense, SPI honored the backstory of Suicide Squad as they made ‘fractal magic’: where real world advanced mathematics informs visual story points of advanced technology. That being said, the SPI team had to face directorial requests such as “this 3D object, can you put a fractal texture on that?” This is something easily requested, yet incredibly complex to do. A simple texture mapping no longer worked as the surface looked soft or stuck on.

To create more complexity in the process, Houdini allows fractal objects which one can render but not save out.  “You can’t FBX a fractal…you just can’t do that..the universe would implode if you tried to do that,” said Breakspear. So they considered doing a displacement map against another object, but the team discovered the imagery would soften or look fake. So in the end, they decided there was no way around the problem but to attack the solution head-on mathematically.

If all of this was not complex enough, Breakspear explained that “just when we started feeling good about the shapes of the Mandelbulbs, David said you got to add vortical flows coming off this thing!” Vortical flows are the sort of complex fluid dynamic air flows simulated for the tips of jet fighters. In continuum mechanics, the vorticity is a pseudovector field that describes the local spinning motion of a medium near some point. In other words, more super complex maths and particle simulations. “Vortical flows are the shock waves that come off high pressure, or incredibly fast objects.. incredibly complex and he wanted them every time we fired one of these fractal weapons.”

But not just vortical flows and not as a fluids. “No, he wants it as millions of these tiny Mandelbulbs,” Breakspear recalls laughingly. “We had only just worked out how to consume all the renderfarm energy in the world rendering one shot with these bloody fractal weapons and then he wants us to add 20 billion more pieces coming off it as it fired!”

This was solved with textures for the smaller piece and only the larger parts which came to camera were still full 3D fractals. “It was a z-depth type solution, so if it is close to camera it gets the full fractal deal and if it is back in shot it is solved with a texture,” Breakspear explains. With either approach the movement of the vortical flow was correctly simulated.

 

Our fxguide Quick Guide to Fractals

(including early SPI fractal video tests)

 

tumblr
Fractals in nature.

rivertree01


The fractal geometry of nature

The idea of a fractal is that there is a mathematical equation that resolves and can be visualised at different scales, but like octaves of music, each scale resembles the same starting point. The most famous of these is a Mandelbrot set.

mandelbrot_set

 

Above is perhaps the most famous fractal: as you zoom in on any circular part of the image it repeats visually. It is called a Mandelbrot set. This famous fractal was actually named after Benoit Mandelbrot, by Adrien Douady. The French mathematician Douady and his former student John H. Hubbard (now Cornell University) launched a new subject in maths studying properties of iterated quadratic complex mappings. They made important mathematical contributions in this field of complex dynamics, including a visualisation of the Mandelbrot set.

Benoit Mandelbrot himself turned the maths world on his head by finding order in roughness, maths in chaos, realism in simple equations.  His work has been featured in VFX films since 1982 when computer graphics took the enormous leap in realism with the – “Genesis effect” sequence for Star Trek II – The Wrath of Khan.

Actually while ILM technically delivered the Genesis sequence, it was from the newly-formed Lucasfilm Computer Graphics Division. This team would also develop texture mapping, motion blur, digital matte painting and compositing programs for motion pictures. The Genesis effect in Star Trek II: The Wrath of Khan incorporated the first visual effects shot made in the computer for a motion picture. The Computer Graphics Division would go on to become PIXAR.

 

What made the ‘growing of mountains’ so incredible is that it looked like nature, not shiny balls which had been the modus operandi of CGI.

Mandelbrot discusses his research in his 2010 Ted talk, below. In that talk he explains how we stumbled on roughness as the key to natural forms in nature, and the seeming recursive nature of natural forms from cauliflowers to the coastline of Britain.

 

While Mandelbrot set is 2D, fractals can extend into three dimensions in nature. After all fractal volumetric real clouds are clearly three dimensional but not spheres, mountains are not cones, and lightning does not travel in a 2D straight line. The complexity of nature’s shapes differ in kind, not merely degree, from that of the shapes of ordinary geometry, the geometry of fractal shapes in three dimensions.

In Mandelbrot’s landmark book The Fractal Geometry of Nature, he featured three dimensional slices of four dimensional fractals. These are called Quaternions (or fractal ‘whipped cream swirls’). Quaternions find uses in both theoretical and applied mathematics, in particular for calculations involving three-dimensional rotations such as in 3D computer graphics and computer vision.

quant

These forms are based on Julia sets.

In the context of complex mathematics, the Julia set (and the related Fatou set ) are defined from a function. Informally, the Fatou set of the function consists of values with the property that all nearby values behave similarly under repeated iteration of the function The Julia set consists of values such that an arbitrarily small change or perturbation can cause drastic changes. Thus, the behavior of the function on the Fatou set is ‘regular’, while on the Julia set its behavior is ‘chaotic’.

Julia_set_(ice)
A classic Julia set image
julia2
The Julia set ‘filled in”

Now see what happens if we cut through a Quaternion. The revealed Julia set is called a Douady Rabbit (returning the naming favour to the French mathematician Adrien Douady).

Quaternion_Julia_Douady_rabbit
The Julia set revealed is called a Douady Rabbit!

There is much more to fractals but the actual maths Mark Breakspear and the team at SPI wanted to use really surfaced only in about 2009, based on a short story that first surfaced in the 80s.

A writer named Rudy Rucker fully conceptualised the idea only a few years ago. According to Daniel White, Rucker is “an American mathematician, computer scientist and science fiction author (and in fact one of the founders of the cyberpunk science-fiction movement).”  In 1987, Rucker wrote a short story about the 3D Mandelbrot entitled “As Above, So Below”.  White writes on his web site:

“So the idea slumbered for 20 years until around 2007. I then independently pictured the same concept and published the formula for the first time in November 2007 at the fractalforums.com web site. The basic idea is that instead of rotating around a circle (complex multiplication), as in the normal 2D Mandelbrot, we rotated around phi and theta in 3 dimensional spherical coordinates. In theory, this could theoretically produce our amazing 3D Mandelbrot.”

In reality he got his “somewhat disappointing result of the formula.”

mandrt2b

 

White continued trying to find a fully 3D fractal, something he called a Mandelbulb, that was more than a Quaternion. He felt a Quaternion looked like a sweep of a 2D fractal, he sort a new 3D form. Such a 3D Mandelbulb would need to exhibit the property of self similarity at vastly different scales, and be natural in form.

As it happened, mathematician Paul Nylander had an idea to “adjust the squaring part of the formula to a higher power, as is sometimes done with the 2D Mandelbrot to produce snowflake type results”.
this produced the first break through image:

Mandelbulb8-large

Paul Nylander explains on his web site:

Here is my first rendering of an 8th order Mandelbulb set, based on the following generalized variation of Daniel White’s original squaring formula:
{x,y,z}n = rn{cos(θ)cos(φ),sin(θ)cos(φ),-sin(φ)}
r=sqrt(x2+y2+z2), θ=n atan2(y,x), φ=n sin-1(z/r)

I originally posted this image on 8/30/09. Daniel White was very excited when he first saw this rendering because it has significantly finer 3D details than the quadratic version. He wrote a beautiful article about it, calling it the “Mandelbulb” (I believe it was Rudy Rucker who coined the name). 

The Mandelbulb rapidly grew in popularity, and it was presented in many popular articles. The problem for White was that without proper shading the images were not organic enough. White explains on his website:

I set about trying to find software to render it, preferably with full shadowing and even global illumination, and at least something that was fairly nippy. “But it turns out that there are probably no 3D programs out there on the market that can render arbitrary functions, at least not with while loops and local variables (a prerequisite for anything Mandelbrot-esque!). So I set out to create my own specialized voxel-ish raytracer. Results could be slow (perhaps a week for 4000×4000 pixel renders!).

With his own ray tracer, White produced a host of magnificent organic images starting in around 2009.

renders

 

The Mandelbulb is the basis of the Machine that Enchantress builds. It is both based in maths, seemingly organic and yet appears so advanced that to the Suicide Squad it is magical (The Squad perhaps not themselves not versed in higher order fractals)!

Below is an exclusive look at the early tests Breakspear produced to show production VFX supervisor Jerome Chen.

devtech4
Still test

These three clips below are tests done by SPI and rendered in SPI’s version of Arnold. “It was a challenge,” explained Breakspea. “What was a real challenge was us understanding the maths, but once we’d done that,  getting it to render was not actually that much of a challenge.”

Below is the test of the ‘fractal churros’ that Incubus fires out of his hands when attacking.

The test below is the block like Mandelbulb used in the machine. “We thought how hard can it be to make blocks, I mean we have sphere shapes,… how hard can a cube be? Oh my ..getting corners on the Mandelbulb was one of the hardest thing – back breaking work that only nerds would appreciate!” he joking remarks.

Making “it look more organic” is an overused expression in visual effects but one that had actual relevancy for this this work.

Mark Breakspear admits considering how the team could use fractals even more centrally in their pipeline, especially in rendering. He has been considering how generalisable the technology is “when you understand what is going on here and then you start looking at a range of problems in that way. For example,next time we are doing fire, could we run vortical flows on the edge of flames? And so as a way of approaching the things our industry faces daily, I think there could be a lot to be learned.”

Breakspear finishes by saying: “For all the science that we go into…you can’t help but think that so much of mankind’s future will come from a better understanding of what fractals mean.”