The Tech Behind the Tools of Avatar Part 2: Naiad

Avatar won Best single visual effect of the year at the VES for the Neytiri “leaf drinking shot” – central to that was the new Naiad fluid tool. Exotic Matter’s Naiad is an extremely powerful fluid tool that is about to go into Beta following extensive development from its use on Avatar.

Overview

Founded in 2008 by industry veterans Marcus Nordenstam and Dr. Robert Bridson, Exotic Matter is currently in the last stages of alpha-testing of its first product: a 3D fluid solver and dynamics framework called Naiad. This new fluid simulator was first profiled by fxguide.com at SIGGRAPH 2009 in New Orleans, which was the first ever public appearance of Exotic Matter as a company, showcasing Naiad for the first time. (Ep#062).

We recently caught up again with Marcus Nordenstam following the release of Avatar – the first major production to use Naiad. To its credit, Naiad was used on the VES award winning shot from Avatar: Neytiri “drinking shot”

10Mar/naiad/SIM Nordenstam had more than ten years of experience in graphics R&D and software development before he and Dr. Robert Bridson, an internationally-known researcher in CGI and simulation, formed Exotic Media. Nordenstam himself, co-invented curl-noise, pioneered the use of the FLIP (Fluid-Implicit-Particle) method for fire simulation, and co-authored the “Squirt” fluid simulator at Double Negative (DNeg) in London. Prior to that, Nordenstam held senior engineering positions at ILM (where he was one of the original Zeno programmers), SPI, Activision, and of course DNeg. His work has been used on films such as Star Wars Episode II, Spider-Man 2, Hellboy II, Inkheart, Harry Potter and the Half-Blood Prince, and now Avatar


Naiad provides a really high degree of creative control while preserving realistic fluid motion, this comes from the software which introduces both a new GUI design and a new fluid solver. The program is not a renderer but it produces extremely realistic water and fluid simulations with a nodal-based user interface. While the product can be driven via either an API or bypassing the GUI and using the command line solver, the new interface presents a whole new way of designing complex fluid simulations.

The Avatar Experience

10Mar/naiad/poster Weta got involved with Exotic Matter very early as key members of the Weta team knew the principal’s of Exotic Matter from their previous positions, published papers and Siggraph courses on Fluid Simulations.

“It was very early days when we got involved, we brought Marcus here (to New Zealand) and asked him to run some tests for us. We liked the results and the direction they were going in…and it was a chance to have a close relationship – we worked as partners, and I think it is fair to say we provided a fair amount of feedback,” recalled Sebastian Sylwan, Head of Research and Development at Weta.

The work of the Exotic Matter team was validated in New Zealand while working with Weta, Nordenstam summed the experience up most succinctly, “The cool thing about the Naiad software is that it turned out to be a success on Avatar!”

“What we learned (from Weta ) and have focused on since, which you will see in the Beta version:

– the importance of secondary “ballistic” particle sims driven by a “coarser” fluid sim:
we already knew this, but there was no time to properly add it to the Alpha – Weta threw together their own solution just for those shots. The Beta now has this and more built-in

– the importance of an efficient architecture:
exploiting modern hardware, such as the need to distribute simulations across multiple machines, using the GPU and adopting a parallel-friendly architecture all the way down to the lowest-level algorithms


Diego Trazzi, Technical Director of Weta, commented, “We simmed an impressive number of particles (up to 50 million at each sim) with Naiad and did a secondary simulation pass to uprez the resolution of the final sim. Naiad’s graph structure allowed us to do so. Given the unprecedented complexity of the sequence we also used some internally developed tools to merge and edit the simulation results, effectively multiplying the total number of particles.” Trazzi was the main Naiad artist on Avatar, and the primary artist on the VES Award winning shot – which was actually matched to a live action reference shot in the Jungle. “There are multiple simulations, the water coming out of the leaf eventually generates a secondary and third simulation based on the first one – which are the wet pass and the drips.”

Fluids are complex to simulate – a product of any one points’ velocity, but that point is connected to the points around it. You cannot model its simulation with just points, the liquid or gas has a density. It is also acted on by forces (pressure) that transfer, yet it cannot be adequately simulated as a flexible solid, since clearly it is not. There is conservation of mass and momentum but liquids break apart and reform with drops and drips, and of course mathematically this is not simple. In short, if all we wanted to do was calculate what happened in a body of water things would be easy but of course it is the ‘boundary condition’ i.e. the top of the ocean – the edge of the wave or the drops of water that make fluid simulations so mathematically interesting in such a nasty non-linear way – and equally make the simulations believable and useful on the big screen.

For the water in Avatar, the simulations were based on a mixed method of particles and fluid grids. “Once you have the simulation looking good, you make a mesh out of this information, and the mesh gets assigned shaders which are then eventually rendered and interact with the rest of the geometry of the shot. So the final result is a mesh but the simulation gets done on the fluid grid and the particles, which is the FLIP (Fluid-Implicit-Particle) method, which is what Naiad does really well,” explained Trazzi. The FLIP method was first published in a paper in 1986 (Brackbill and Ruppel, ’86), but Exotic Matter co-founder Robert Bridson expanded the FLIP method to be an incompressible flow solution (Zhu Bridson, ’05, Siggraph). Bridson showed how effectively modified FLIP can produce highly detailed motion from fairly course fluid grids when combined with particles. Basically while real fluids do exhibit compression – for example shock waves, if you assume simulated fluids can not be generally compressed – one can use a bunch of Rigid body maths to help solve them. Most real world fluid compression – such as sound waves traveling under water are irrelevant to pretty movie fluid simulations shots.

Naiad uses a modified version of FLIP. “The simulations are very realistic, we tried other approaches, but Naiad worked best for us”, explained Trazzi.

Interestingly as already noted in the introduction, Nordenstam himself pioneered the use of the FLIP method for fire simulation, most notably while at DNeg, which is an insight into why Naiad can do much more than just water simulations.

On Avatar Naiad held up well on small-scale highly detailed phenomena (such as Neytiri’s leaf drinking – VES winner). But it also scales well, even on a single machine. “The beach waves scene in Avatar, Naiad solved at 3cm resoluion over more than 1 square kilometer of water, while consuming less than 6 GB of memory.”

In the end Naiad was used on about a dozen shots in Avatar “It was definitely used on the shots that were more complicated – the ones where we we didn’t think anything else could do it,” explained Weta’s Sylwan. Weta now owns a site license to Naiad.

Beta

The company is ready to issue its first Beta release of Naiad. “Having gained a lot of insight from Avatar, we got good direction and gained a lot of ideas of things that neither Robert nor I had necessarily thought of, those things are now being incorporated into the first Beta, something Weta and others can use. It will be going to just a select few places, and by about Beta 10 we will open it up to a broader Beta audience,” explained Nordenstam.

At the time of publishing there are a few companies already testing it, as about 10 productions have done some basic testing.

One of the changes in the Beta version from the Alpha is that you can now run the solves in the Naiad Studio, you don’t need to leave it. In fact, Naiad works fully both ways now, via GUI or command line and so while the workhorse workflow of Naiad is centered around the command line solver – you make an Ni file and then you run Naiad on the Ni file, it solves and then you take the output back into any package you like – that primary workflow can also be replicated entirely in the GUI. “We have now extended it – so if you want to – you can do everything entirely inside Naiad studio”, (ed note: up to final render which was never done from within Naiad). “So you don’t ever have to go to the command line if you don’t want to”, explains Nordenstam, “there has been a big focus on the GUI and the front end”.

In addition, while Naiad is definitely a stand-alone application, as neither the command-line solver nor Naiad Studio are plug-ins, the beta does ship with a powerful suite of Maya, MentalRay and RenderMan plug-ins and tools to make it easy to exchange data amonst other apps. This suite is called “Naiad Buddy” and will also be open-source. Most of the Naiad Buddy software was written by the only non-Swedish programmer on Exotic’s team, Jimmi Gravesen (he’s Danish)! Gravesen previously worked at MPC in London and has a lot of experience in both writing production-quality dynamics codes as well as integrating them into 3rd party apps, “which is why he got the job doing Naiad Buddy,” jokes Nordenstam. “We have also developed some pretty radical GPU-based rendering of iso-surfaces and volumetrics, a technology which we are using in the Naiad Studio’s 3D visualization/preview window. This new preview renderer was developed by Tommy Hinks, who has a PhD in graphics (out of Dublin) and is half-Swedish.”

Price

The actual pricing is not released yet but as a rough guide, “a single-user on an annual usage basis will be in the thousands of Euros, not tens of thousands and also not in the hundreds,” explained Nordenstam. Exotic Matter is also exploring having a simple constant licensing model on an annual fee. Since the market for Naiad is much like the model of Renderman. It could be expanded and integrated with its API but it could also be used by a specialist, such as a more single-user TD.

The Naiad Software

Click here for a direct 27 million fluid-particle simulation animation from Naiad before shaders or rendering

Naiad is a dynamics solver and a simulation framework capable of producing animations of dynamic bodies including:
* liquids – large and small bodies of water
* breaking waves
* splashes and foam
* accurate viscous liquids featuring buckling, coiling and bending motion
* gases
* fire and smoke
* explosions

Particle effects which can be coupled with other dynamic bodies, including fluids rigid-bodies which can be coupled with other dynamic bodies, including fluids soft-bodies which can be coupled with other dynamic bodies, including fluids

10Mar/naiad/naiadscreen1
10Mar/naiad/naiadscreen2


The Naiad GUI

The flexibility the graph frameworks offers:

– arbitrary post-processing on 3D fields

– shifting fluid-distance fields after the simulation is done (good for changing the water level without having to re-sim)

– compositing-like operations on 3D fields: masking out forces or velocities, gaussian blurs on velocity fields, shape-driven force-fields, etc.

– the ability to feed the results of one simulation graph directly into another, forming a linked, “pass-like” workflow, similar to render passes.

10Mar/naiad/Naiad_graphNaiad is more than just a software package, it is:

Naiad is more than just a software package, it is:

– a description of a simulation expressed as a graph: the Naiad Graph – a very familiar “Shake-like tree”

– an interface specification used to construct a Naiad Graph: the Naiad Interface

– a plug-in API allowing users to write custom nodes in the Naiad Graph

– the EMP format which is the software which conforms to the Naiad Interface and runs the simulation described by a Naiad Graph, this is an open-source software package allowing an artist to interactively construct a Naiad Graph using a 3D GUI front-end a standard file-format for storing the results of a Naiad simulation.

The Naiad Graph has been so successful that other companies have approached Exotic Matter about licensing the GUI for completely different products and applications.

Lessons from Pixar

There is no doubt in talking to Exotic Matter that they respect and admire the work of Pixar with RenderMan. It is their defacto rule book on how to sell and support Naiad, even though neither Pixar, Disney nor Renderman are in anyway directly or indirectly involved with the company and its products.

Comparing Naiad to Renderman can be instructional, not that it is a renderer but as a business model – as an approach to the high-end software, it is clear Exotic Matter are thinking along the lines of the Pixar RenderMan model.

Marcus Nordenstam explains with the following detailed comparison:

The Naiad Interface (NI) has the following in common with the RenderMan Interface (RI):

* Both interfaces tell one WHAT, but not HOW to produce a scene.
– RI: WHAT we want to see (a renderable scene)
not HOW the fundamental rendering algorithms work
– NI: WHAT we want to simulate
not HOW the fundamental simulation algorithms work

* They both base their interfaces on “languages”
– RI: RIB and Shading Language
– NI: NI files and the (forthcoming) Naiad Operator Language

* They ARE extensible/customizable frameworks:
– RI: you are encouraged to implement your own shaders/procedurals
– NI: you are encouraged to implement your own signatures/operators

* However the frameworks do NOT specify hooks to implement your own “under the hood” algorithms used by the software driving the interface:
– RI: you do not implement your own bucket-based REYES renderer
– NI: you do not implement your own tile-based dynamics solver

* But you can of course choose to write your own compliant software that drives the interface instead of using the proprietary software:
– RI: Instead of using PhotoRealistic RenderMan, others have written BMRT, RenderDotC (RDC), Exluna(Nvidia)
– NI: None yet exist except Exotic Matter’s Naiad Software.

* The result can be dependent on information strictly outside the RIB/NI file:
– RI: User shaders/procedurals are not explicitly defined inside the RIB
– NI: User signatures/operators are not explicitly defined inside the NI file.

* They both have text-file bindings which exactly correspond to C/C bindings:
– RI: RIB
– NI: NI File (Naiad in the beta also has Python bindings)

DIFFERENCES between Renderman Files and Naiad files or RI vs NI

* RI is for rendering, NI is for dynamics!

* The OUTPUT is different:
– RI produces an image (or 2D bitmap)
– NI produces 3D animation data, usually in the form of 3D particles, 3D meshes, and/or implicit surfaces (signed distance fields).

* The OBJECTS are different:
– “objects” in RI, such as they exist, are explicitly defined geometries classified using a “primitive type” with accompanying 3D positional and topological data, and a shader
– “bodies” in NI, are defined in the abstract sense by specifying physical attributes in lists of “channels” and “properties” but no explicit geometric data is specified in the interface

* The PROCESS is different:
– The “actions” taken to produce an image depend on the transform hierarchy as well as the object attributes such as shader, motion-block, etc.
– The “actions” taken to produce a physics-based animation depend on the operators chosen and how they are wired together. NI has a set of well-defined “standard operators” which do certain things, such as adding a force

* The frameworks are EXPRESSED differently:
– RI expresses the per frame “rendering process” in terms of a transform hierarchy of renderable objects
– NI expresses the per time step “physics process” in terms of non-cyclic “physics operations” on dynamic bodies

* The INSPIRATION for how the frameworks are expressed came from different worlds:
– RI: PHIGS
– NI: RenderMan and Shake/Nuke

It remains to be seen if Naiad will live up to the huge bar they have set for themselves in learning and referencing the RenderMan approach. Exotic Matter would not be the first to want to match RenderMan’s success – but in the case of Naiad they have taken this to a very real and tangible software architectural homage. Whether the acknowledgment is valid, only time will tell.
Early signs are very promising – if the VES awards are any benchmark of success.

1 thought on “The Tech Behind the Tools of Avatar Part 2: Naiad”

  1. Pingback: Autodesk Maya Bifröst videotutorial

Comments are closed.