Science of fluid sims: Part 2 – RealFlow

Last September we published a piece on fluid sims. The aim was to examine the topic via one primary approach. Here is a second companion piece to that original story that examines the topic via the work of Fusion CI Studios.

Mark Stasiuk and Lauren Millar are co-founders of Fusion CI Studios, a dynamic effects specialist facility that uses RealFlow extensively. Millar is a filmmaker of 20 years’ experience, having produced or directed more than 75 TV shows, and Stasiuk holds a PhD in geophysical fluid mechanics. They met at a volcanic eruption in Monterrat in the late 90s. Today, she is the executive producer and he the VFX supervisor at Fusion CIS.

Stasiuk started using RealFlow and answering questions on the forums with such insight that RealFlow’s authors at Next Limit began noticing. In fact, it got to a point that they emailed him and said, ‘Sorry but who are you, and how do you know so much about RealFlow…and, oh, would you like to beta test the next version?’

– Above: watch Fusion CI’s demo reel.

Stasiuk has a doctorate from Bristol University in fluid dynamics of volcanic eruptions. He came to RealFlow as a tool to help with his field work and academic research. “I eventually found myself getting more involved with the disaster side of volcanoes,” he says. “When you study volcanic eruptions you inevitably get sucked into working on not only active volcanoes but working at observatories and eventually making decisions on whether you should evacuate villages or islands, and that led me to being at Monterrat.”

“We called him Dr. Disaster,” jokes Millar.

“Anyway,” continues Stasiuk, “I was fooling around hobby-wise and teaching myself CG stuff even at that time to use software like RealFlow as a research tool, and as a visualization tool, to try and communicate what a volcanic eruption could do to your village. [I thought] maybe if I could create an animation it would really show people in these villages what it would look like if these eruptions hit them and maybe they would be easier to evacuate instead of people saying well it has never happened before!”

In the end, Stasiuk decided that RealFlow was more interesting than the managerial role he had found himself promoted into with volcanic observatories and government work. “I was doing a lot less flying around in helicopters and much more sitting at a desk, and so getting involved in doing cool shots on films like Poseidon was a lot more attractive than sitting around in meeting after meetings in government offices,” he recalls.

Because of Stasiuk’s international reputation as a RealFlow expert and artist, Fusion CI Studios has an accomplished record in creating a wide range of outstanding fluid and particle FX, from large-scale, multi-million particle ocean surfaces with cresting waves, foam and spray for feature films to dancing and swirling fluids in television commercials. Stasiuk has a great perspective on RealFlow but of course does not speak for the company nor did he write any of the core code.

However, Fusion CI Studios now works closely with the engineers at Next Limit to improve the software and resolve production issues. His python scripting was instrumental in moving RealFlow from version 3 to 4, and he wrote the scripting guide in the RF4 user guide. He’s currently advising Next Limit as they develop the new versions of RealFlow. Stasiuk has given workshops across the US to studios such as Walt Disney Animation and Blue Sky Studios on RealFlow use.

“We have quite a unique business model that focuses exclusively on a very niche area of visual effects dynamics,” says Millar. “So CG fluids, fire, smoke, explosions, clouds, sand and all kinds of particle work. We’re filling that niche for a lot of VFX studios and acting as their instant ‘plug ‘n play’ effects team. Studios like Method, Zoic, Psyop, Imaginary Forces, Blur, Digital Domain are just a few who’ve found our working model really helpful and even ILM has us on their vendor list. Studios who want to expand their effects capacity when awarded a large number of shots hire us to help with the work, whether they need one extra artist for something small or half a dozen artists for something bigger.”

Other clients of Fusion CIS have only a few shots, but very complex effects work that demands a level of expertise beyond their capacity currently. “They focus on their area of expertise, character animation for example, and we supply the dynamic effects,” notes Millar.


One of the aspects of fluid simulations in the past that was not widely modeled was variable-viscosity flow. Yet variable-viscosity flows are incredibly relevant to lava flow. “One of the first things I did with RealFlow,” says Stasiuk, “was this significant research project where I was looking at the direct comparison of the meaning of viscosity in RealFlow and how close it came to reproducing real viscosity in lava flows. Without knowing the code, I had no way of knowing how accurate it was, so I had to treat it like a lab experiment. And that is when I started emailing Next Limit directly asking them about their code and giving them small dissertations about their software because I wanted to use it in my research, for lava flows, molten rock, magma under the earth, flowing up through cracks in the earth.”

– Above: watch a RealFlow demo reel.

Which begs the question – how accurate are fluid sims on modeling viscous flows, given they are designed for films not geophysical fluid mechanics?

“Most of the solvers take one of two approaches,” explains Stasiuk. “They either take am incompressible path like RealFlow does with the SPH path (see below) and what they do is over-dampen momentum. What you get is a viscous flow, but what you don’t get is true turbulence, and it is the same in pretty much all the solvers, be them grid solvers or a SPH particle solver. In general to simplify the equations and make things more stable in the simulations there is a tendency to dampen the momentum and reduce the effects of turbulence or leave them out entirely.”

Which is why one of the tools artist’s need is the ability to manually influence and add turbulence. “On one project,” adds Stasiuk, “I was working with Asylum on a raging river with rapids for a shot in National Treasure. You simply do not get true turbulence out of any of these models. It does not matter what you do to it, does not matter how fast you make the fluid flow, true turbulence as in vortex style turbulence just doesn’t happen. It is just one of the things left out of the solver. And so if you need it in there, which you do for some of these flows, you have to reintroduce it.” Fusion CIS have therefore developed tools and specific technology to mount swarms of vorticies on particles downstream, to inject turbulence into the flow.

This highlights the very nature of fluid sims. At their core all fluid simulations are trying to solve the Navier Stokes equations, and balance realism, artistic control and simulation speed in a production environment.

How you approach solving these equations of the motion of fluid define the application and the result you can achieve. The equations are not new, in fact they have been around for a long time, but they have complex terms such as compressibility and momentum that make it very complex to solve. “They take the equations from being simple to very complex,” says Stasiuk. “If you take everything they make it a highly non-linear set of equations that are comparatively tough to solve. You have to do really serious computation to solve them in a stable way. Your life is made more difficult by little terms in the equation like momentum, compressibility and variable viscosity.”

To deal with this, most fluid solvers assume fluids are incompressible and have steady or at least spatially-invariant viscosity, and often inertial terms in the force balance are ignored if you assume you have flow dominated by viscosity. “What terms do I not need?,” asks Stasiuk. “In my own work, I would leave them out of the equation since they would not contribute to the force balance, it simplifies all your equations and boom – you get your solution much more quickly. You can get a solution without a supercomputer. That is why they make these assumptions.”

The SPH method (smoothed particle hydrodynamics)

Fluid dynamics is built around creating a vector field or flow field, a field of forces that define the liquids flow.

RealFlow uses a SPH solver which is a particle based solution and also an implicit solver / grid solver. (A grid solver is the same approach that R&H and ILM have been using for years and works extremely well on large volumes). RealFlow is in effect a hybrid software solution – it has two approaches within it. At its base level it is very similar to Houdini’s solver, although quite different in its implementation. The SPH model works well for mass conservation but alone does not scale well for large volumes of liquid, which is why the earliest demos of RealFlow were pouring shots.

However, Stasiuk says SPH does “small scale simulations with great detail, and it also allows you to not be bounded by a grid. It allows the simulation to go anywhere and it is not bounded, which is a very handy thing in visual effects. The downside is that the SPH model does not scale well to very large particle counts (large-scale scenes), because the computation is not as efficient as for grid-based solvers.”

A grid-based solver offers advantages like a more efficient solver algorithm, allowing you to go to much higher grid cell count than you could do particles with SPH. In addition, a grid-based approach is easier to parallelize on a network or render farm. This is exactly why, on Poseidon, “ILM loved it,” says Stasiuk, who worked on the film. “They can use a giant network of machines and they can scale their simulations to be massive, which is the only way you can render waves to turn over ocean liners!”

At its core level the second solver is a grid solver which is different from the primary SPH solver, but SPH is where RealFlow made its mark. The SPH method was first invented for handling astrophysics gas simulations and this work was pioneered by Lucy and Monaghan back in the 70s. Next Limit’s team turned an academic algorithm into something that could be used in the film industry. “The brilliance of the Next Limit guys was that they realized this model could be adapted essentially by adjusting the force potential around every particle mass in the simulation to make it more incompressible, and thus make it not a gas in space but a viscous fluid – they were the first,” says Stasiuk admiringly.

SPH was first used for fluids simulation for the VFX industry by Next Limit Technologies back in 1998, introducing this technology in RealFlow. Not long after the team deservedly won an Academy Technical Award for being the first widely available fluid software in the VFX industry.

One person who does understand the inner core code of RealFlow and in particular how the SPH method is Ángel Tena from RealFlow who is the technical director for the product. Tena is generally seen as being one of the most informed and respected fluids experts in our industry worldwide. For full disclosure, Tena did not agree with our previous article’s description of SPH. While saying other sections, like history of fluid dynamics, and the FLIP explanation “were great”, he pointed out our section on the SPH was “far the less accurate in the whole article.” Here then is Tena’s explanation of the SPH method, written especially for fxguide:

“In order to be able to simulate fluids in a computer, the governing equations of fluids, the well-known Navier-Stokes equations must be discretized. One way to discretize the equations is by using a regular grid, fluid properties like velocity and pressure are computed at the cells of that grid. The other way to discretize the equations is by using particles, every particle represents a small chunk of fluid and fluid properties are carried with those particles. This later way of discretization is called Lagrangian, and this discretization is the base and core of the SPH numerical method.”

The main advantages of an SPH solver are its particle-based representation of the fluid, and its natural ability to handle free surfaces in a mass conserving way. A drawback of SPH for detailed fluids is the increased computational requirement for large particle numbers.


Once you have a set of correct particles that have forces acting on them to achieve realistic motion, you need to mesh them to a 3D object that can be rendered. Polygonization is just the process of generating a polygonal surface around the particles from a particle fluid simulation. Frost is an example of one such approach. Done badly, you turn water into blobby metaballs – an early failing of many water sims approach. The problem is complex, the software has basically a density cloud that it needs to ‘coat’ in some sensible way but the surface does not behave itself very well or make life easy since it animates. One needs to create polygons across the surface that not only cover the density cloud but also move consistently and do not flicker, crack or produce unwanted hole artifacts (see below).

Meshing is its own major area of research and, according to Stasiuk, “there are a lot of new meshers that are published at Siggraph each year, and people end up writing their own. When I was on Poseidon, CIS Hollywood wrote their own, as they did not think RealFlow’s [mesher] was good enough. But these days RealFlow is much better and greatly improved. There are actually three meshers inside RealFlow. They have their ‘Standard’ (improved) mesher, the ‘RealFlow Render Kit’ mesher (which uses a different algorithm) and their ‘Grid Solver’ mesher, and they are adding to them all the time. Each one of them has got a different character to it, handles some things better than others. For example, the RealFlow Render Kit mesher handles and does a really great job on chaotic splashes but it is not so good for flat surfaces like lake surfaces.”

Some people develop post processes to address problems with meshing. Some of the artifacts that make sims not look real such as a web like set of holes that develop in meshing of thin sheets of fluid, for example. Fusion CIS has tried addressing these as a post process, and they looked at the meshing, but in the end they developed tools to go right to the source and extend the simulation.


Mesh test with smorgnics plugin

What makes Fusion CIS different from just hiring experienced freelancers are the tools that the studio has developed in-house that extend RealFlow to perform even better. “Our CG fluids in particular look and behave like real liquid with few of the typical problems that make CG fluids look CG,” says Millar, adds that an example of this is their smorganic tool. “This was a tool Mark created to make smooth, thin, organic looking CG splashes that have none of the typical webbing or swiss-cheese holes so commonly seen in CG fluids.”

Smorganic is not a post process, it is not a new mesher, it affects and is part of the simulation before meshing.

“In RealFlow’s solver and almost every solver I know of,” says Stasiuk, “the surface tension effects are highly approximated. So if you are dealing with things like thin sheets of fluid that are flying through the air – like thin sheets of paint, throws of paint, things like that – then surface tension becomes very important. It rips fluid apart, makes little tendrils, it makes little droplets. It defines motion because the radius of the curvature of the fluids gets to be really high at the edges and that means the surface forces go to very high values as your radius goes down. They then become very important and yet those forces are usually left out of the solver entirely so you don’t get any real strong surface tensions. In RealFlow there are surface tension forces but they are very simplified and approximated, so they don’t really represent what actually happens in nature. As a result one does not get those effects in your simulation and like the turbulence (above) you need to reintroduce them again into your simulation.”

A good example of this is a recent Coca Cola spot completed by Fin Design in Sydney. The spot called for thin sheets of Coke to be in the air, in macro slow motion. A normal solver alone would not produce pleasing nor accurate results. The very thin liquid would form clumps and not thin into sheets correctly. “We do a lot of those sorts of shots,” says Stasiuk, “and that was one of the prettiest ones we have worked on. The fluid elements relied on a variety of things and we used Smorganic to achieve the macro-style look.” Fusion CIS worked for Fin on the spot and used the plugin they wrote for RealFlow.

A normal SPH breakup ‘cheese hole effect’.
A Fusion CI RealFlow smorganic render of ‘honey’.

CG fluids, especially SPH fluids, suffer from inaccurate physics at the microscopic level, at the scale of individual particles making up the fluid. Even when simulating with very large particle numbers, this becomes a major problem wherever the fluid forms thin sheets and strings, or rather, it should form thin sheets and strings. Hi-speed macro photography of fluid splashes show how delicate, thin and continuous sheets of fluid fly though the air and stay coherent for prolonged periods. These produce tiny droplets and hair-like strings of fluid from their margins but otherwise hold together for a long time, before they eventually and suddenly burst apart. CG fluids on the other hand always break apart immediately, forming very unattractive and distinctly unreal cheese-like holes and webbing, never holding together in thin sheets. This has generally been the limit of CG fluid applications, since CG fluids simply haven’t been able to reproduce the very particular small-scale features of real fluids .

“When we apply our new dynamic hole-filling technology,” notes Millar, “the fluid stays as a fully coherent sheet for as long as we want. No holes! The method hunts for holes as they start to form, and fills in the gaps with new fluid. The key to this working is that the fluid insertion is done very precisely, so the simulation stays extremely stable. These splashes are very delicately structured, down to the smallest level of detail available to the simulation. The streamers and the sheet of fluid are all just one layer of particles thick. Since we can simply set the size of particles. This means we can make the fluid sheets as thin as we want. There’s no jerky motions due to the ‘polly filla’ process, it’s as smooth as silk.”

Python scripting and now C++ are embedded right in the software, allowing plugins to be written – it is one of the biggest selling points to Fusion CIS for using RealFlow – being able to write plugins and extend the simulation in specialist areas such as paper thin fluid sheets with the smorganic plugin.

CASE STUDY: Fin Design + Effects, Sydney, Australia, was tasked to create this kind of effect for an end tag for the Coca Cola ‘Share a Coke’ campaign. Fin is a highly respected company with an excellent and very experienced award-winning in-house 3D team, that is at the very core of Fin’s success, but the company on this spot employed Fusion CIS to help with the very exact requirements of the spot. Fusion CIS was asked to create two kinds of mid-air CG fluid splashes for Fin Design: a splash bursting from the Coke bottle (which had to be sculptural and beautiful while also feeling explosive, pushing toward a chaotic feel), plus a variety of curving splashes that Fin’s team could compose in 3D space in the comp to create a dynamic ‘Coca Cola space’. So it was up to Fusion to experiment with digital ‘throws’ of fluid and work up a palette of shapes from which Fin’s creative director could give further direction, and then select elements to build the 3D composition.

– Above: watch the final spot.

Fusion CIS provided mesh sequences to Fin Design. Fin set the coke bottle animation, and Fusion acted as a remote, plugin effects group that handed back the fluid sims as either cached geometry, mesh sequences or sim data. Fin provided not only the design camera and shot design but it lit and rendered all the final images. The role of Fusion CIS was to be a part of Fin’s pipeline, not to do the whole job for them, it is not outsourcing as it is specialist fluid pipeline work. Stasiuk explains: “They basically say to us – we want a flow that does something like this – it needs to arc over and do some particular motion, and we start doing some little experimental virtual fluid throws but with RealFlow, just to get some idea of the motion. We hand them back, they don’t over specify, since they want to leave it open to organic happy accidents.”

Creating the circular sweep sim for the ‘Share a Coke’ spot.

Commenting on how Fusion CIS likes to help VFX studios, Millar adds, “That’s what works best.” Fusion CIS hands back a variety of simulations. Fin used Maya to then compose the experiments into a designed shot and one that worked for the client. They are free to pick the coolest elements and of course scale is not an issue. Fin found little details and aspects that appealed and they could zoom in within Maya without any issues since the Fusion CI work is just a simulation. Fin layered up the various shots. “It was a really creative process,” says Stasiuk.

CASE STUDY: Smorganic is not limited to thin sheets of fluid. Fusion CIS also worked on the opening titles of The Girl With The Dragon Tattoo. In this sequence there are splashes but also very thick oozing viscous fluids. “We actually now use smorganic on almost everything we do,” says Stasiuk. For example, there is a shot in the title sequences where the male head is split open. “We used smorganic to enhance the structure of the splash, because in a really violent simulation with a SPH fluid if you take it and really smash it around it will very rapidly break apart into thousands of little droplets. We can turn it on to a lesser or greater extent, if we turn it on a lot you don’t get any break up at all, and that is how we get a cool look like that, with the gooey, drippy bits we can turn it on very strongly and get molten wax which is the effect we were going for in that shot.” This work was done with Blur Studio, which Millar speaks very highly of, and is another example of a good partnership for Fusion CI. “Some studios prefer to keep Fusion’s contribution to their project ‘behind closed doors’, so to speak,” says Millar. “But Blur was very generous in acknowledging Fusion’s involvement and they were an organized, highly-skilled, exceptional group to work with – we formed a seamless production pipeline.”

Watch Blur’s making of video for the ‘Dragon Tattoo’ titles.

CASE STUDY: For The Three Musketeers the company also worked in partnership with a VFX studio – Mr. X FX – on the break in water eruption at the beginning of the film. The shot is different from others discussed above as the water is on a much bigger scale and, as such, incorporates foam. Foam is the aeration of water. Most people think of water as being clear but the aeration of water makes it opaque and white. “You introduce even 5% of bubbles of air and it becomes white and opaque as it is such a scattering medium,” says Stasiuk. “We see this all the time with waves or any kind of violent water. People in effects think of water and think of refraction and translucency and really it is much more about sub-surface scattering.”

– Above: watch the sequence from The Three Musketeers.

The team tried to take a strong art direction approach (while one could take the approach of trying to simulate foam in these giant simulations, that would be extremely expensive). Fusion CIS addressed it as a post process. For the big flooding vault sequence, they used the grid solver for the core simulation, which became the big dark shadowy central interior of the water rushing forward. Then on top of that they emitted foam and splashes and spray. First, the core water sim emits a series of splashes, and where those splashes impact the main simulation they turn into foam and then off splashes they generated spray. “We use a sim to be an exotic emitter for the next part of the sim which gives it a very organic and dynamic result,” adds Stasiuk.

Fusion CIS had to provide very scripted water for Three Musketeers. “They gave us an animated guy running away from where the water would be,” says Stasiuk, “but the camera angle the director wanted for the scene was low looking back down the corridor, and clearly needed to remain above water level. You couldn’t just release a bunch of fluid into this room. There was a very careful piece of art direction required.” The actor had already been shot so the team had a set of constraints that they had to work with, while making the water flood look completely photoreal. “It is incredibly difficult to put constraints on a water simulation to get it to do exactly what someone wants,” points out Millar.

Watch a side view of the Three Musketeers sim.

To solve the shot, the water was emitted from below the line of the floor. It hits the natural constraints of the room, but also there is a false back of the room that is unseen by the audience that animates and slams into the water from behind, once the water first splashes up to the ceiling. “One of the key principles of production work is figuring out ways to not sim things, to not have the computer working on things you don’t need,” explains Stasiuk. “You apply as cleverly as you can blocking, geometry, and holes in your simulation that don’t require water, but are largely hidden from view. In this shot we were lucky that the giant flood of water comes up out of the floor, shoots upwards and becomes a fountain and that fountain covers up what is happening behind the fountain. The geometry comes up and reduces the amount of water we needed to simulate, and at some point we needed to surge that whole quantity of water forward. We used the volume back there, both to stop too much water from accumulating at the back of the room but also to act as a dam or reservoir. At some point then we could time it to use it as a pusher. We could control when the water moved forward by how fast we moved that bulldozer forward and pushed the water from the back towards the actors.” The shot required other tricks, turbulence and gravity controls to make sure the flow was not too deep and submerge the camera.

Use of water sims for smoke and fire

One of the only areas Fusion CIS does not use RealFlow for is gas, fire and smoke simulation work (although Stasiuk did create an underwater explosion using RealFlow in The Curious Case of Benjamin Button). RealFlow does not do gas simulations. Incompressiblity is a key assumption of most fluid sims – while the liquids have varying pressure, they are assumed to be incompressible. One may think of gases having pressure being related to compressing and expanding gases. As with water, gases – especially those away from thermal flows – can have pressure gradients and vector flows without needing to mathematically have compressibility. While some gas flows can still be incompressible, thermal flows are by their nature compressible. They rely on the expansion due to heat. The team uses Fume FX and Maya for smoke and fire. In these cases there are density differences between the cold and hot air, which then places pressure on the gas which is completely the same way buoyancy works. A bubble of air in water has exactly the same reason to rise up, it has a great pressure differential under the bubble than on top that pushes up the air bubble.


Normally boundary conditions are a key aspect of fluid sims. They are what trigger, maintain and cause turbulence. The friction at the boundary condition of fluid going down a river bed or pipe is exactly what causes the fluid’s turbulence. Interestingly, the boundary between a match flame rising and the cooler air around the flame cause the turbulence in almost exactly the same way as a pipe on water. The sheer pressure of the hot gas and the cold gas is the primary force in creating a characteristic flame and smoke flicker rise and curling.


In conclusion

Fusion CIS and their dedicated RealFlow tools, plugins and pipeline seems to be working. They contract and consult around the world producing stunningly realistic and powerfully entertaining work. Some smaller facilities would do shots like these once or twice a year, and this means for each new job there is a significant R&D roll-up time. But as Fusion CIS do these shots constantly, a smaller company only normally needs one or two days of R&D to work out how to solve a shot, versus sometimes weeks for people less experienced, even if they are very skilled general 3D artists. This experience and the generally very short productions schedules these days means Fusion CIS’s library of effects and tools is invaluable. In addition, Fusion CIS has a farm of about 20 machines with 20-60 gigs of RAM each to turn around R&D sims very quickly for their clients, and they find RealFlow (Next Limit) to be an excellent partner from a support point of view. “Right now on the farm we have a 40 million particle simulation, and it is being rendered with full global illumination,” quips Stasiuk. (Note: unsurprisingly, Fusion CIS uses Maxwell for a lot of its own rendering projects. Maxwell is also made by Next Limit).

“It seems to be a great working model, especially in these tough economic times,” says Millar. “One of our clients has called us ‘addictive – like crack!’ Our clients see the value in using an expertise that’s well-proven rather than trying to find their own artists when they’re gearing up for a project, and taking the risk they won’t achieve the caliber of effects they’re hoping to within their budget and timeframe.”

1 thought on “Science of fluid sims: Part 2 – RealFlow”

  1. Pingback: The Science of Fluid Sims | CGNCollect

Comments are closed.