13.07.2015 Views

Controlling Fluid Simulations with Custom Fields in Houdini Master ...

Controlling Fluid Simulations with Custom Fields in Houdini Master ...

Controlling Fluid Simulations with Custom Fields in Houdini Master ...

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>Controll<strong>in</strong>g</strong> <strong>Fluid</strong> <strong>Simulations</strong> <strong>with</strong> <strong>Custom</strong><strong>Fields</strong> <strong>in</strong> Houd<strong>in</strong>i<strong>Master</strong> ThesisPeter ClaesN.C.C.A Bournemouth UniversityAugust 21, 20091


Contents1 Abstract 32 Introduction 33 Previous work 33.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33.2 Proprietary Systems . . . . . . . . . . . . . . . . . . . . . . . . . 43.2.1 Rhythm and Hues' Field Expression Language Toolkit . . 43.2.2 ILM's directable, high resolution re . . . . . . . . . . . . 43.3 Research . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53.3.1 Introduc<strong>in</strong>g noise <strong>in</strong> the velocity eld . . . . . . . . . . . 53.3.2 Target driven smoke animation . . . . . . . . . . . . . . . 63.4 A broader public . . . . . . . . . . . . . . . . . . . . . . . . . . . 63.4.1 Node based dynamic simulations . . . . . . . . . . . . . . 63.4.2 A brief history of Houd<strong>in</strong>i's dynamic context . . . . . . . 74 Technical Background 84.1 What are microsolvers? . . . . . . . . . . . . . . . . . . . . . . . 84.2 How do volume elds work <strong>in</strong> Houd<strong>in</strong>i? . . . . . . . . . . . . . . 94.2.1 Den<strong>in</strong>g scalar and vector elds . . . . . . . . . . . . . . . 94.2.2 Nam<strong>in</strong>g volume primitives . . . . . . . . . . . . . . . . . . 94.2.3 Rest eld <strong>in</strong>terpolation . . . . . . . . . . . . . . . . . . . . 104.2.4 Volume eld viewport visualization . . . . . . . . . . . . . 104.2.5 Houd<strong>in</strong>i specic tra<strong>in</strong><strong>in</strong>g . . . . . . . . . . . . . . . . . . . 114.3 The equations of uids . . . . . . . . . . . . . . . . . . . . . . . . 114.3.1 The <strong>in</strong>compressible Navier Stokes equations . . . . . . . . 114.3.2 The steps to solve the Navier Stokes equations . . . . . . 124.3.3 Vorticity Connement . . . . . . . . . . . . . . . . . . . . 154.4 Up Res technique . . . . . . . . . . . . . . . . . . . . . . . . . . . 194.5 Distributed simulations . . . . . . . . . . . . . . . . . . . . . . . 195 A workow for us<strong>in</strong>g and creat<strong>in</strong>g custom volume elds <strong>in</strong> Houd<strong>in</strong>i.205.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 205.2 The implementation of an attribute transfer tool <strong>in</strong> SOPS to helpdene custom volume elds. . . . . . . . . . . . . . . . . . . . . . 205.2.1 A po<strong>in</strong>tcloud based approach . . . . . . . . . . . . . . . . 215.2.2 A metaloop based approach . . . . . . . . . . . . . . . . . 225.3 Examples of custom elds . . . . . . . . . . . . . . . . . . . . . . 255.3.1 Colour eld addition . . . . . . . . . . . . . . . . . . . . . 255.3.2 Advect by curve . . . . . . . . . . . . . . . . . . . . . . . 265.3.3 <strong>Custom</strong> fuel and heat <strong>in</strong>jection . . . . . . . . . . . . . . . 296 Conclusion 312


1 AbstractThere are various dierent algorithms and techniques for uid simulation, bothphysical simulation and more artistic simulation. Some of these techniquesare available to the general public through exist<strong>in</strong>g 3d software packages. Thepurpose of this thesis is about develop<strong>in</strong>g a workow that provides more controlfor artistic uid simulation <strong>in</strong> Houd<strong>in</strong>i. This workow consists of two ma<strong>in</strong>elements, the development of a tool that helps <strong>with</strong> the creation of customvolumetric elds and the implementation of these elds <strong>in</strong> Houd<strong>in</strong>i's dynamiccontext.2 Introduction<strong>Fluid</strong>s and gaseous materials are hard to art direct. Physical simulation of reand smoke can result <strong>in</strong> realistic results, but can also make it harder to controlthem as they are bound by certa<strong>in</strong> rules. For certa<strong>in</strong> shots <strong>in</strong> lms a physicallyimpossible behaviour might be required and that is when artists need to be ableto truly direct where the smoke or re needs to go and how it needs to get there.In two dimensions it is straightforward to pa<strong>in</strong>t strokes on a canvas to denewhere certa<strong>in</strong> densities, colours or other properties should be. In a 3D eld itbecomes a lot harder to dene these artistic strokes.Sometimes it is not the movement that needs to be dierent, but the look.There might be a demand to mix dierent types of smoke together, for <strong>in</strong>stancea red gas and a blue gas form<strong>in</strong>g purple gas when they mix. If this colourproperty is l<strong>in</strong>ked to the behaviour perhaps only the red gas is <strong>in</strong>ammable, orperhaps they become <strong>in</strong>ammable when they start mix<strong>in</strong>g, similar to chemicalreactions. Because of this complexity <strong>in</strong> both look and behaviour, software thatcan handle this could be a useful tool. This project focuses on the developmentof a tool and workow that can provide this k<strong>in</strong>d control <strong>in</strong> Houd<strong>in</strong>i.3 Previous work3.1 IntroductionThere are several approaches to creat<strong>in</strong>g volumetric eects. The two ma<strong>in</strong>approaches are either us<strong>in</strong>g a large amount of very transparent particles asdeveloped by Frantic Films [1] and render<strong>in</strong>g them to an accumulation buer orus<strong>in</strong>g a voxelgrid, ray-march<strong>in</strong>g through the volume [8]. Both approaches couldbenet from additional user control through custom elds. However, most of thecurrent solutions are either part of visual eects studios proprietary software,or programmed <strong>in</strong> isolated simulators.Some of the uid solvers that are <strong>in</strong>corporated <strong>in</strong> ma<strong>in</strong>stream 3d applicationsprovide not enough control to be able to create more advanced visual eects.A plug-<strong>in</strong> such as FumeFx for 3dsmax is basically a black box <strong>with</strong> little extracontrol beyond the provided parameters. Similarly the uid solver <strong>in</strong> Maya is3


Figure 1: Separate user dened elds comb<strong>in</strong>ed <strong>in</strong>to a nal velocity eld, createdby Rhythm and Hues us<strong>in</strong>g FELT. Image taken from [6]also limited <strong>in</strong> terms of control. These solvers will provide good results quickly,but are not able to be extended or <strong>in</strong>ternally modied by users for more specicrequirements.3.2 Proprietary Systems3.2.1 Rhythm and Hues' Field Expression Language ToolkitAn example of a proprietary system that helps dene 3d scalar and vector eldsis a tool developed by Rhythm and Hues. They create and comb<strong>in</strong>e user denedvector elds us<strong>in</strong>g FELT, their Field Expression Language Toolkit as can beseen <strong>in</strong> Figure 1. The result<strong>in</strong>g velocity eld is used to drive particles for themovie The Incredible Hulk [6].3.2.2 ILM's directable, high resolution reILM has created high detailed re for the movie Harry Potter and The HalfBlood Pr<strong>in</strong>ce, us<strong>in</strong>g particles that were rst advected by a low resolution uidsimulation and then were used to ll up eld <strong>in</strong>formation such as temperature,velocity for high resolution 2d elds [10]. Those elds are then processed bya uid solver solv<strong>in</strong>g velocity, density and temperature. The particles are projectedon 2d slices perpendicular to the camera, similar to the way sprites facethe camera as can be seen <strong>in</strong> Figure 2. Because the slices are 2d, the resolu-4


Figure 2: High resolution 2d uid conta<strong>in</strong>ers controlled by <strong>in</strong>formation fromprojected particles created by ILM. Image taken from [10]Figure 3: Advect<strong>in</strong>g the simulation <strong>with</strong> curl noise where turbulent energy isdetected. Image taken from [14]tion can be raised quite high. The <strong>in</strong>terest<strong>in</strong>g part is that the relatively smallamount of particles are used as a way to dene the high resolution elds. Theparticles represent a custom eld, this h<strong>in</strong>ts towards the idea that the customeld does not need to have a very high resolution as some of the simulationsonly used 20.000 to 100.000 particles.3.3 Research3.3.1 Introduc<strong>in</strong>g noise <strong>in</strong> the velocity eldAnother example of the use of a custom eld to give more <strong>in</strong>terest<strong>in</strong>g results<strong>in</strong> uid simulation is the <strong>in</strong>troduction of curl-noise for procedural uid ow [3].They generate turbulent velocity elds based on Perl<strong>in</strong> noise. This type of noiseis procedural but could just as well be added to uid simulations, which is whatis be<strong>in</strong>g done <strong>in</strong> [14] <strong>with</strong> the additional condition that the curl noise is notadvect<strong>in</strong>g the velocity everywhere, but only where their physically motivatedenergy model dictates it as can be seen <strong>in</strong> Figure 3.5


Figure 4: The dierent states of target driven smoke us<strong>in</strong>g custom elds. Imagetaken from [7]3.3.2 Target driven smoke animation<strong>Custom</strong> elds can also be used to create target driven smoke animations, as <strong>in</strong>[7]. They <strong>in</strong>troduce a driv<strong>in</strong>g force term that causes the uid to carry the smoketowards a particular target and they also add a smoke gather<strong>in</strong>g term whichprevents the smoke from dius<strong>in</strong>g too much due to numerical dissipation. Thecore concept beh<strong>in</strong>d this technique is us<strong>in</strong>g the gradient of a blurred densityeld of a target shape as direction vectors to advect the velocity eld of thesmoke. The result<strong>in</strong>g vector eld looks like all the vectors are po<strong>in</strong>t<strong>in</strong>g towardsthe target shape. Because the start and end shape might have dierent densitiesor the smoke might lose density along the way, density is added as it <strong>in</strong>terpolatesbetween the two shapes as can be seen <strong>in</strong> Figure 4.3.4 A broader publicThe above approaches use custom elds and geometry to ga<strong>in</strong> more controlover the simulation, but they are separate or proprietary software solutions.Because they are custom built they have the advantage that they will t <strong>with</strong><strong>in</strong>the pipel<strong>in</strong>e of a particular company and are able to explore new hardwareplatforms such as the GPU. The drawback is that these tools are not veryportable and useable by a broader public.3.4.1 Node based dynamic simulationsOne company that is try<strong>in</strong>g to change the way uid simulations are set upis Exotic Matter <strong>with</strong> their software called Naiad [5]. The creators are MarcusNordenstam and Robert Bridson who have both contributed greatly to thedevelopment of uid solvers over the past ten years. Robert Bridson has publishedseveral <strong>in</strong>sightful papers and also the book <strong>Fluid</strong> Dynamics for ComputerGraphics [2]. At its core Naiad is a dynamics solver and a simulation framework.Naiad allows for the creation of a description of a simulation scene. Thisdescription can then be simulated. The description can be made through a nodebased <strong>in</strong>terface which resembles that of node based composit<strong>in</strong>g software as can6


Figure 5: The node based operator graph <strong>in</strong> Naiad, by Exotic Matter. Imagetaken from [5]be seen <strong>in</strong> Figure 5. They are try<strong>in</strong>g to establish a Nip (Naiad Interface Protocol)format which is similar to a RenderMan RIB format, but then for dynamicsimulation. This has not been done before and will hopefully help establish astandard for dynamic simulations. This is also one of the few systems whichuses a node based approach for uid dynamics, the other major node baseddynamics system is part of Houd<strong>in</strong>i.3.4.2 A brief history of Houd<strong>in</strong>i's dynamic contextS<strong>in</strong>ce Houd<strong>in</strong>i 8 node based dynamic operators (DOPS) were <strong>in</strong>troduced ands<strong>in</strong>ce Houd<strong>in</strong>i 9 uids and gas microsolvers were added. Houd<strong>in</strong>i 10 brought afurther development of a preset pyrosolver which can produce high quality pyrotechnicresults comb<strong>in</strong>ed <strong>with</strong> an extensive pyroshader. They also <strong>in</strong>troduced7


Figure 6: The various microsolvers available <strong>in</strong> Houd<strong>in</strong>i's dynamics context.an upres technique which greatly <strong>in</strong>creases the detail <strong>in</strong> the nal high resolutionresult. To handle these high resolution simulations they allow distributedsimulation over a network of computers. These developments and techniqueswill be expla<strong>in</strong>ed <strong>in</strong> greater detail <strong>in</strong> the next section as they are important tounderstand the proposed workow and tool.4 Technical BackgroundHoud<strong>in</strong>i's node based architecture is open and not a black box. For example thepreset pyrosolver is a digital asset, which means it can be unlocked, modiedto support extra functionality and saved as a new custom solver. ThereforeHoud<strong>in</strong>i is very well suited to get more control over uid simulations. However<strong>in</strong> order to determ<strong>in</strong>e where to <strong>in</strong>sert extra functionality and make modicationsan explanation of some of the current uid techniques and their implementation<strong>in</strong> Houd<strong>in</strong>i is required. Some of the equations of uids will be expla<strong>in</strong>ed forcompleteness and some of the equivalent microsolver networks will be shownalongside.4.1 What are microsolvers?Microsolvers are nodes <strong>in</strong>side of DOPS that perform specic tasks related tothe uid solv<strong>in</strong>g process. Instead of solv<strong>in</strong>g various aspects of a uid simulation<strong>in</strong> one big solver node as is done <strong>with</strong> the preset smoke- or pyrosolver, amicrosolver performs only a specic mathematical task. By wir<strong>in</strong>g these microsolverstogether more complex operations can be performed, this is how thebigger smoke and pyro solvers were created. Some microsolvers are digital as-8


sets, which means they are built from a network of smaller microsolvers <strong>in</strong>side.There are currently around 60 microsolvers <strong>in</strong> Houd<strong>in</strong>i 10 as can be seen <strong>in</strong>Figure (6). It is beyond the scope of this thesis to cover all of them so <strong>in</strong>stead afew of the more important ones of which the equivalent often shows up <strong>in</strong> uidequations will be covered. Microsolvers are wired together by us<strong>in</strong>g a mergedop, the order of the <strong>in</strong>puts is very important as it will dene which microsolvercontributes to the nal result rst. The order of operations works from left toright, top to bottom. This is quite dierent from the pure top to bottom nodeow <strong>in</strong>side of the surface operators context (SOPS).4.2 How do volume elds work <strong>in</strong> Houd<strong>in</strong>i?4.2.1 Den<strong>in</strong>g scalar and vector eldsVolume elds <strong>in</strong> Houd<strong>in</strong>i come <strong>in</strong> two types: scalar elds and vector elds. Theyare dened as primitives <strong>in</strong> SOPS (surface operators) but can also be created<strong>in</strong> DOPS (dynamic operators) and represent an attribute of the volume, themost commonly known is the density scalar eld. Other custom elds can bedened us<strong>in</strong>g a volume sop which will dene an empty volume primitive or aniso-oset sop which will dene a volume based on the closed mesh of an <strong>in</strong>putgeometry. One of the more powerful ways to dene custom volumes is by us<strong>in</strong>gthe volumevop. This runs CVEX (Houd<strong>in</strong>i's vertex expression language) overa set of volume primitives, the operations can be dened through code or bybuild<strong>in</strong>g a CVEX VOP (vertex operators) network. Not only do you have a lotof low level mathematical functionality, us<strong>in</strong>g VOPS will compile the result<strong>in</strong>gnetwork <strong>in</strong> vex code which will make it a lot faster to run <strong>in</strong> comparison tonormal expressions which would have to be <strong>in</strong>terpreted. This volumevop is usedas part of the tool that was developed to dene custom elds <strong>in</strong> SOPS.In DOPS elds can be created us<strong>in</strong>g a (SOP) Scalar Field node or a (SOP)Vector Field node. The (SOP) part allows you to reference elds from SOPS,but sometimes temporary elds are needed to store results of calculations andthe eld is created <strong>with</strong>out the need to reference it from SOPS as it will be lledup <strong>with</strong> data that is calculated from other elds <strong>in</strong> DOPS. To quickly create anempty eld based upon the properties such as the dimensions and resolution ofanother eld, a Gas Match Field microsolver can be used.A scalar volume eld such as density will conta<strong>in</strong> a s<strong>in</strong>gle primitive, whereasa vector eld such as velocity will conta<strong>in</strong> 3 primitives, one for each component.By convention the velocity eld is named vel, the components are vel.x, vel.yand vel.z.4.2.2 Nam<strong>in</strong>g volume primitivesIt is important to give the correct names to scalar elds before merg<strong>in</strong>g them<strong>in</strong>to a s<strong>in</strong>gle vector eld. Some elds are recognised by the preset shaders, suchas the color eld (Cd), but are not yet supported by the preset uid solvers.By modify<strong>in</strong>g the preset shaders you can have custom elds <strong>in</strong>uence the look9


and create extra output variables that can be rendered to separate image planesfor greater control <strong>in</strong> a composit<strong>in</strong>g application. Another useful eld to haveas part of the simulation is the rest eld, which basically carries a set of uvcoord<strong>in</strong>ates that can be used to map textures to the uid.<strong>Fields</strong> can be given any name, but only certa<strong>in</strong> specic elds will be pickedup by the Mantra render eng<strong>in</strong>e, for example if the vel eld is detected andmotion blur for render<strong>in</strong>g is turned on, the <strong>in</strong>formation of the velocity eld willbe used to apply motion blur on a fast mov<strong>in</strong>g uid simulation.4.2.3 Rest eld <strong>in</strong>terpolationIn the preset smoke solver a s<strong>in</strong>gle rest eld is advected along <strong>with</strong> the otherelds. This rest eld is then used <strong>in</strong>side a volume shader to map various k<strong>in</strong>dof noise to the uids and <strong>in</strong>crease the detail of the smoke as is also described<strong>in</strong> [17]. When this rest eld is advected far away from the <strong>in</strong>itial position, thetextures will become distorted which can give undesirable results. In the newpyrosolver <strong>in</strong> Houd<strong>in</strong>i 10 a second rest eld (rest2) is <strong>in</strong>troduced to solve thisissue. The <strong>in</strong>itialization of both elds (rest and rest2) is staggered <strong>in</strong> time andthe pyro shader cont<strong>in</strong>ually <strong>in</strong>terpolates between them. For example if the resetvalue on the pyrosolver is set to 50, the rest eld will be re-<strong>in</strong>itialized every50 frames, start<strong>in</strong>g at the rst frame. The rest2 eld will also be re-<strong>in</strong>itializedevery 50 frames, but will start at frame 25 (half of the reset value). The pyroshader has a correspond<strong>in</strong>g Reset Rate parameter that should be set to thesame value. This will cause the shader to <strong>in</strong>terpolate between the two rest elds<strong>with</strong>out show<strong>in</strong>g any popp<strong>in</strong>g when the rest elds are re<strong>in</strong>itialized.r e s t : +−−−−−−−−−−−−−+−−−−−−−−−−−−−−−+−−−−−−−−−−−−−−− ( e t c )r e s t 2 : −−−−−−+−−−−−−−−−−−−−−−+−−−−−−−−−−−−−−−+−−−−−−− ( e t c )At each + <strong>in</strong> that graphic, the eld resets. The pyro shader then constantlycross-fades between the two elds, such that a given eld has full contributiononly at the reset frame [12].4.2.4 Volume eld viewport visualizationWith<strong>in</strong> DOPS there are dierent way to visualize the <strong>in</strong>formation stored <strong>in</strong>a eld. This visualization can greatly help to visually debug the values of aeld. To be able to enable this visualization for a specic eld, a Scalar/VectorField Visualization node needs to be attached to the data <strong>in</strong>put of a eld. Thisvisualization can consist of:• show<strong>in</strong>g the eld as smoke (useful for density),• as straight l<strong>in</strong>es depict<strong>in</strong>g both length and direction of the values of avector eld (generally useful for a static or dynamic velocity eld),• as streamers, which are curves depict<strong>in</strong>g the ow of a vector eld, (usefulfor view<strong>in</strong>g the <strong>in</strong>terpolation of the velocity between voxels)10


• as an axis aligned plane that shows a coloured slice <strong>in</strong> the volume, mapp<strong>in</strong>gthe values of the eld to the colours on the plane. (useful for temperature)With<strong>in</strong> SOPS a volume will generally be visualized as smoke when the values ofthe eld are positive. This means as well that when you are try<strong>in</strong>g to visualizea eld that has negative values, such as velocity or temperature, noth<strong>in</strong>g willbe shown <strong>in</strong> the viewport <strong>in</strong> SOPS, even though the data is actually there. Aquick check can be performed by tak<strong>in</strong>g the absolute value of the data <strong>in</strong>sidea volumevop just for visualization purposes to make sure the data exists. Atthis po<strong>in</strong>t visualiz<strong>in</strong>g your custom elds <strong>in</strong> dops will give you more options asdescribed above. The reason why this section on visualiz<strong>in</strong>g volumes <strong>in</strong> SOPS is<strong>in</strong>cluded is because it is not <strong>in</strong> DOPS, which means no solv<strong>in</strong>g needs to happento visualize the eld which makes it faster to shape volume elds <strong>in</strong>dependentof the previous frames. Also it is important to understand negative values arenot displayed <strong>in</strong> the viewport as this clarication will hopefully avoid confusionlater on when the tool is used and there seems to be no output.4.2.5 Houd<strong>in</strong>i specic tra<strong>in</strong><strong>in</strong>gSidefx, the creators of Houd<strong>in</strong>i, provide a great set of masterclass tutorials onuids and the pyrotools on their website which will help when learn<strong>in</strong>g how touse microsolvers and understand volume elds <strong>in</strong> Houd<strong>in</strong>i [15].4.3 The equations of uidsA signicant amount of research has already been done <strong>in</strong> the area of computationaluid dynamics (CFD) for simulat<strong>in</strong>g smoke, re or various types ofliquids. A few of the equations will be covered to help expla<strong>in</strong> the componentsthat make up a simple smoke solver <strong>in</strong> Houd<strong>in</strong>i.4.3.1 The <strong>in</strong>compressible Navier Stokes equationsThere is a consensus among scientists that the Navier Stokes equations are avery good model for uid ow [17]. That is why they tend to be used as afoundation for a lot of solvers, that will then <strong>in</strong> some way modify or extendthese equations:∂⃗u∂t + ⃗u · ∇⃗u + 1 ∇ρ = ⃗g + v∇ · ∇⃗u (1)ρWhere:⃗utρgvvelocitytimepressurebody forcesviscosity∇ · −→ u = 0 (2)11


And (1) is called the momentum equation and tells us how the uid acceleratesdue to the forces act<strong>in</strong>g on it and can be derived from Newton's equation−→ F = m−→ a as expla<strong>in</strong>ed <strong>in</strong> [4]. And (2) is the <strong>in</strong>compressibility condition andstates that the divergence of the velocity must always be equal to zero. Thisconstra<strong>in</strong>t ensures that the sum of all velocities enter<strong>in</strong>g and leav<strong>in</strong>g at a po<strong>in</strong>t<strong>in</strong> space is zero. When this is conserved, the total mass is conserved over theentire simulation [18].4.3.2 The steps to solve the Navier Stokes equationsThree ma<strong>in</strong> steps will be required to solve the Navier Stokes equations, thesesteps are very well described <strong>in</strong> [18] but will be <strong>in</strong>cluded here aga<strong>in</strong> for completenessand some of the explanations of the terms summarized.1. Advection2. Diusion and External forces (Body forces)3. pressure/<strong>in</strong>compressibilityAdvection( −→ u · ∇) −→ uAdvection represents the fact that the motion of the uid causes motionof the entities <strong>with</strong><strong>in</strong> it. This can be thought of as the velocity of the uidmov<strong>in</strong>g itself along, and is sometimes referred to as self-advection because ofthat property. The advection part of the equations can also be used to modelmotion of other entities <strong>in</strong>side the uid [18].With<strong>in</strong> Houd<strong>in</strong>i the Gas Advect microsolver can be used for advect<strong>in</strong>g one orseveral elds at the same time. For more advanced <strong>in</strong>teractions between elds,other actions can be performed at this step that will update the elds. This canbe seen <strong>in</strong> the node tree for the elds_updates section <strong>in</strong>side the preset smokesolver <strong>in</strong> Figure (7). For <strong>in</strong>stance:• A Gas Blur is used to diuse the temperature eld,• A Gas Calculate is used to cool the temperature eld or to copy <strong>in</strong>formationfrom a source eld <strong>in</strong>to a heat eld.• <strong>Fields</strong> are not the only th<strong>in</strong>g that can be advected, geometry can as well,such as vorticle geometry which is expla<strong>in</strong>ed <strong>in</strong> the external forces step.Diusion and External forces12


Figure 7: The node tree for the update elds section <strong>in</strong> the preset smoke solver<strong>in</strong> Houd<strong>in</strong>i as described <strong>in</strong> (4.3.2)13


Diusionv∇ · ∇⃗uThe diusion allows the velocity to propagate outwards from its currentlocation, <strong>with</strong> the viscosity parameter controll<strong>in</strong>g how fast this happens. Highviscosity yields thick and slow uids while, while a low viscosity yields livelyuids [18].With<strong>in</strong> Houd<strong>in</strong>i the viscosity can be implemented us<strong>in</strong>g a Gas Diuse microsolver.This outwards go<strong>in</strong>g velocity is a modication to the velocity eld.External forces⃗gThis is considered as the sum of all external forces. Some typical forcesare w<strong>in</strong>d, drag or gravity, but also <strong>in</strong>clude more advanced forces that requireseparate simulations, such as the forces generated by temperature dierences.These external forces can be extended and provide a lot more control by add<strong>in</strong>guser dened volumetric elds. This is one of the areas that will be extended <strong>with</strong>custom elds den<strong>in</strong>g them <strong>in</strong> SOPS <strong>with</strong> the custom tool that is developed.With<strong>in</strong> Houd<strong>in</strong>i these forces can be represented by a variety of Gas Microsolvers,that create the total result<strong>in</strong>g force when merged together. Typicalmicrosolvers that are part of the preset smoke solver for the forces componentare the follow<strong>in</strong>g and can be seen <strong>in</strong> the node tree of the forces section of thepreset smoke solver <strong>in</strong> Figure (8):• Gas Vortex Connement: to re-<strong>in</strong>troduce some of the lost velocity due tonumerical dissipation, a high vortex connement force will <strong>in</strong>troduces alot of swirl<strong>in</strong>g motion <strong>in</strong> the simulation,• Gas External Forces: both for external forces relative to density or absolute.When relative it will scale the velocity by another eld, maskedby the density, when absolute it will simply scale the velocity by anothereld <strong>with</strong>out the mask,• Gas Buoyancy: to calculate an approximate buoyancy force dependent ona temperature eld,• Gas Diuse: for the viscosity force, as expla<strong>in</strong>ed <strong>in</strong> the diusion stepabove,• Gas Vorticle Forces: for <strong>in</strong>troduc<strong>in</strong>g extra swirl<strong>in</strong>g motion around eachvorticle, accord<strong>in</strong>g to the vorticle attributes. By default when add<strong>in</strong>gvorticles, the vorticles are particles that exist throughout the entire volumeand that are advected by the velocity,• Gas Calculate: for sett<strong>in</strong>g m<strong>in</strong>imum and maximum speed limits if required.14


Figure 8: The node tree show<strong>in</strong>g the body forces <strong>in</strong>side the preset smoke solver<strong>in</strong> Houd<strong>in</strong>i as discussed <strong>in</strong> (4.3.2)Pressure and Incompressibility (non-divergence)PressurepThe pressure can be considered as the uid from the area <strong>with</strong> high pressurethat will be pushed by the pressure towards the area <strong>with</strong> lower pressure. Thisforce is represented by the gradient of the pressure eld, p [18].The <strong>in</strong>compressibility condition∇ · −→ u = 0Another way to th<strong>in</strong>k about pressure is that it is whatever it takes to keepthe velocity divergence-free so the <strong>in</strong>compressibility condition is satised [4].With<strong>in</strong> Houd<strong>in</strong>i these terms come <strong>in</strong> the shape of a Gas Project Non Divergentmicrosolver that removes any divergent portions of a velocity eld. Theseare parts of the velocity eld that represent expansion or contraction. Thisis done by comput<strong>in</strong>g a pressure eld that counteracts any compression andapply<strong>in</strong>g that pressure eld <strong>in</strong>stantaneously [16].4.3.3 Vorticity ConnementWhen simulations of stable uids are run, some of the velocity is lost due tonumerical dissipation which is the results of a necessary weighted averag<strong>in</strong>g step15


dur<strong>in</strong>g the advection term. It has the eect of un<strong>in</strong>tentionally add<strong>in</strong>g viscousbehavior to the uid, which can damp down some of the <strong>in</strong>tricate turbulentbehavior seen <strong>in</strong> natural smoke and re[13]. In [8] a method is described fordetect<strong>in</strong>g the vorticity and add<strong>in</strong>g the rotational forces back <strong>in</strong>. Each smallpiece of vorticity can be thought of as a paddle wheel try<strong>in</strong>g to sp<strong>in</strong> the oweld <strong>in</strong> a particular direction. Articial numerical dissipation damps out theeect of these paddle wheels and the key idea is to simply add it back.The vorticity connement calculation is a good example <strong>in</strong> Houd<strong>in</strong>i of howsome of the microsolvers and elds can be used together. A Vortex Connementmicrosolver exists, but it is really a digital asset made out of smallermicrosolvers.These are the steps that are executed <strong>with</strong><strong>in</strong> the Vortex Connement microsolverand the accompany<strong>in</strong>g node tree can be seen <strong>in</strong> Figure (9):1. Create the elds for temporary results: curl (vector), curl magnitude(scalar) and vortex direction (vector) us<strong>in</strong>g Gas Match Field microsolvers.2. Calculate the curl of the velocity eld <strong>with</strong> a Gas Analysis microsolverand store the result <strong>in</strong> the curl eld.3. Calculate the length of the curl eld and store it <strong>in</strong> the curl magnitudeeld us<strong>in</strong>g a Gas Analysis microsolver.4. Calculate the gradient of the curl magnitude eld and store it <strong>in</strong> the vortexdirection eld us<strong>in</strong>g a Gas Analysis microsolver.5. Normalize the vortex direction eld us<strong>in</strong>g a Gas Analysis microsolver.6. Calculate the cross product between the vortex direction eld and the curleld <strong>with</strong> a Gas Cross microsolver and store the result back <strong>in</strong> the vortexdirection eld.7. Multiply the vortex direction eld by a scalar to <strong>in</strong>crease the amount ofconnement us<strong>in</strong>g a Gas Calculate microsolver.8. Multiply the vortex direction eld by a connement eld to <strong>in</strong>crease theamount of connement only at specic location <strong>with</strong><strong>in</strong> the eld us<strong>in</strong>g aGas Calculate.9. Update the velocity by add<strong>in</strong>g the vortex direction eld to it us<strong>in</strong>g a GasCalculate microsolver.10. Clear the temporary elds by copy<strong>in</strong>g 0 <strong>in</strong>to them us<strong>in</strong>g a Gas Calculatemicrosolver.From the above steps it becomes clear that the Gas Calculate, the Gas Analysisand the Gas Match Field are very useful microsolvers, and will come back allthe time. They are some of the mathematical build<strong>in</strong>g blocks to build morecomplex operations. While develop<strong>in</strong>g these operations the visualization of theresult<strong>in</strong>g steps can be very helpful as shown <strong>in</strong> Figure (10).16


Figure 9: The node tree <strong>in</strong> Houd<strong>in</strong>i for the Vortex Connement microsolvershow<strong>in</strong>g all the steps as described <strong>in</strong> (4.3.3)17


Figure 10: The geometric representation of the steps <strong>in</strong>side the Vortex Connementmicrosolver as described <strong>in</strong> (4.3.3). Red represents the curl eld after step2, green represents the gradient of the curl magnitude eld after step 5, bluerepresents the vortex direction after step 8.18


4.4 Up Res techniqueIn Houd<strong>in</strong>i 10 a new technique was <strong>in</strong>troduced were a low resolution simulationcan be used as the basis for a higher resolution simulation. The key conceptis that you get the general motion from the lower resolution simulation and<strong>in</strong>troduce high frequency noise <strong>in</strong>to the velocity eld, but only where there isa high curvature. The <strong>in</strong>troduced noise has a low amplitude so it does not<strong>in</strong>terfere <strong>with</strong> the general motion com<strong>in</strong>g from the low resolution velocity eld.A cut down version of the pyrosolver is used for the Up Res phase as a lot of the<strong>in</strong>formation is com<strong>in</strong>g from the low res elds rather than hav<strong>in</strong>g to be calculatedfrom scratch. Because it is still a high resolution simulation it can take a longtime. The foundations for this Up Res technique were <strong>in</strong>itially built <strong>in</strong> Houd<strong>in</strong>i9.5 based on [11]. It then became a fully <strong>in</strong>tegrated tool support<strong>in</strong>g Constant,Wavelets and Curl noise. The Gas Up Res solver is also a digital asset, whichmeans it can be modied to support custom user dened elds com<strong>in</strong>g from thelow res simulation or added <strong>in</strong> to support a certa<strong>in</strong> type of control or new typeof noise. Those elds can then be up-ressed and written to disk at the end ofeach simulation step.4.5 Distributed simulationsRunn<strong>in</strong>g high resolution simulations can take a lot of time. Therefore the functionalityhas been built <strong>in</strong> to be able to split a heavy uid conta<strong>in</strong>er <strong>in</strong>to slices.These slices represent partitions of the volume. The amount of overlap betweenthe slices that is required for a good distributed simulation depends on the speedof the uid and needs to be set by the user. There are several ways the slicescan be dened, but by default they will partition the space <strong>in</strong>side the conta<strong>in</strong>ersimilarly to a b<strong>in</strong>ary tree. Each slice can then be calculated on a dierentmach<strong>in</strong>e that is connected to a host mach<strong>in</strong>e that is runn<strong>in</strong>g a tracker. Themach<strong>in</strong>es share the data between them <strong>in</strong> the overlapp<strong>in</strong>g regions through <strong>in</strong>terprocess communication. The speed ga<strong>in</strong>s are signicant, but not l<strong>in</strong>ear as theextra overlap and communication between mach<strong>in</strong>es takes up a bit of additionalprocess<strong>in</strong>g power. The simulation generally runs as fast as the slowest mach<strong>in</strong>e.If all the mach<strong>in</strong>es have the same specications this is not a problem, but if oneof them is signicantly slower than the others, the faster mach<strong>in</strong>es will not beused as eciently.Sidefx has provided Hqueue, a python based renderfarm software to help<strong>with</strong> this distribution. However HQueue was not tested for this project due tolimited adm<strong>in</strong>istrative permissions. Instead a few shell scripts were written thatremotely start a tracker and the simulations and make use of the exact samedistribution techniques. Aga<strong>in</strong> it is convenient that open access is provided tothe distribution techniques <strong>with</strong>out forc<strong>in</strong>g users to use HQueue.19


5 A workow for us<strong>in</strong>g and creat<strong>in</strong>g custom volumeelds <strong>in</strong> Houd<strong>in</strong>i.5.1 IntroductionThe aim of this project was to get more and better control over uid simulationsus<strong>in</strong>g custom elds. To be able to have this k<strong>in</strong>d of control the problem isapproached from two sides. The rst side is by den<strong>in</strong>g custom elds <strong>in</strong>side ofSOPS, the second side is by us<strong>in</strong>g microsolvers to <strong>in</strong>tegrate those custom elds<strong>with</strong> exist<strong>in</strong>g solvers and perform certa<strong>in</strong> mathematical calculations to solve therequired needs <strong>in</strong>side of DOPS.These custom elds are dened <strong>in</strong> SOPS and brought <strong>in</strong>to DOPS. In orderfor them to work correctly they need to be <strong>in</strong>serted <strong>in</strong> a uid solver at theright place, some of this has been covered <strong>in</strong> section (4). <strong>Custom</strong> elds canadd any k<strong>in</strong>d of data to the simulation. For example: add color, temperature,velocity, fuel, density, etc. Some of these attributes are already supported by thepreset solvers and can be easily modied. Others will need extra implementationthrough the use of microsolvers. There has already been done a lot of work <strong>in</strong> theeld of computational uid dynamics and some of the preset solvers <strong>in</strong> Houd<strong>in</strong>icover a lot of this functionality. The aim of this project is not to create a fulluid solver <strong>with</strong> a combustion model from the ground up, but rather to be ableto modify and augment exist<strong>in</strong>g solvers.By controll<strong>in</strong>g the uid simulation through custom elds, depend<strong>in</strong>g on whatexactly is modied, some of the physical accurateness of the simulation will belost, but that is the whole po<strong>in</strong>t as by <strong>in</strong>troduc<strong>in</strong>g custom elds (art-)directablesimulations are possible. The goal of this project is not to build a physicalsimulator, but rather to understand a physical simulator and then <strong>in</strong>sert extraelds <strong>in</strong>to it to augment the possibilities of the solver. Ideally the uid ow andturbulent behaviour is ma<strong>in</strong>ta<strong>in</strong>ed <strong>with</strong><strong>in</strong> the modications, but if certa<strong>in</strong> eldswill be overwrit<strong>in</strong>g other elds because this provides better visual results thenthis is considered an improvement.5.2 The implementation of an attribute transfer tool <strong>in</strong>SOPS to help dene custom volume elds.There are a few microsolvers <strong>in</strong>side DOPS that will allow to br<strong>in</strong>g data fromSOPS <strong>in</strong>to DOPS already:• The Sop Scalar/Vector eld microsolver which can br<strong>in</strong>g <strong>in</strong> a fog volumethat has been dened <strong>in</strong> SOPS through an iso-oset sop.• The Gas Particle To Field microsolver allows po<strong>in</strong>t attributes from particlesto be copied <strong>in</strong>to a eld, after the particle geometry has been dened<strong>in</strong>side a SOP Geometry dop. This microsolver allows for most of the requiredfunctionality, but it is <strong>in</strong> dops which requires the simulation to cookup to the current frame as soon as a change is made.20


• The nal option is <strong>with</strong> a Gas Field Vop which provides all the functionalityfrom vops so you can reference <strong>in</strong> any object from a dierent context,or from a le on disk.In SOPS however this attribute transfer from po<strong>in</strong>ts to volumes does not existand is a welcome addition as it does not have the requirement to simulate all theprevious frames to dene the eld. Also the result<strong>in</strong>g custom volume elds caneasily be used to advect particles <strong>in</strong>side of a pop network by us<strong>in</strong>g an Advect ByVolumes pop <strong>with</strong>out even go<strong>in</strong>g near DOPS. The reason that this just works isbecause the tool follows the standards used by Houd<strong>in</strong>i to dene volume eldsas described <strong>in</strong> (4.2).5.2.1 A po<strong>in</strong>tcloud based approachThe rst approach to transferr<strong>in</strong>g po<strong>in</strong>t attributes from a number of po<strong>in</strong>tsmakes use of po<strong>in</strong>tcloud functionality <strong>in</strong>side of a volumevop <strong>in</strong> sops. The underly<strong>in</strong>gtechnicalities are hidden away beh<strong>in</strong>d an easy to use <strong>in</strong>terface. I deliberatelykept this digital asset compact as it needed to perform only a s<strong>in</strong>glefunction. The rst <strong>in</strong>put requires an empty volume, the second <strong>in</strong>put requires atits lowest level a number of po<strong>in</strong>ts. The volume eld name can be specied, aswell as the attribute to transfer and the attribute type. The attribute type willalso dene the type of volume that is created (either a scalar or vector eld).The distance threshold denes how big the <strong>in</strong>uence radius of each po<strong>in</strong>t is. Inthe pcloud tab a maximum search radius is provided to prevent voxels look<strong>in</strong>gup values from po<strong>in</strong>ts outside this radius. Also the maximum number of po<strong>in</strong>tsto use when perform<strong>in</strong>g the lter<strong>in</strong>g operation can be set here. Generally thedefault values work for most scenarios.Internally the asset creates a box that matches the position and divisions ofthe voxel grid. Then an attribute transfer sop is used to transfer the attribute tothe grid of po<strong>in</strong>ts. The grid is used <strong>in</strong>stead of us<strong>in</strong>g the po<strong>in</strong>ts directly becausethe attribute transfer sop uses a metaball kernel <strong>in</strong>side to dene the fallo ofthe attributes and give softer results around the edges of a shape. These po<strong>in</strong>tsare then referenced by a volume vop which will read them as if they were apo<strong>in</strong>tcloud from disk. For each voxel it will then lter the attribute value andassign it to the output density. The output density is just a name <strong>in</strong>side thevolume vop, it could just as well be the x component of a velocity eld. The realnam<strong>in</strong>g of the volume occurs before or after the volume vop assigns the valuesto the eld. In case of a vector eld and a vector attribute each <strong>in</strong>dividualcomponent is handled at a time and then the result<strong>in</strong>g scalar elds are mergedtogether to form the result<strong>in</strong>g vector eld.This gives quite accurate results, but can get slow for high resolution volumes,as the attribute transfer sop can take a while to cook. Bypass<strong>in</strong>g theattribute transfer and us<strong>in</strong>g the po<strong>in</strong>ts directly will denitely speed it up, butdoes not give as nice results, this bypass is triggered by turn<strong>in</strong>g on the Use RawPo<strong>in</strong>ts checkbox on the digital asset <strong>in</strong>terface <strong>in</strong> the pcloud tab. Also this approachdoes not allow a way to dene a transfer radius per po<strong>in</strong>t, only a globalradius can be used.21


Figure 11: The parameters of the metaball-based volume attribute transfer tool.5.2.2 A metaloop based approachThe orig<strong>in</strong>al way of den<strong>in</strong>g volumes through metaballs <strong>in</strong>volves copy<strong>in</strong>g metaballsonto the po<strong>in</strong>ts, convert<strong>in</strong>g them to a fog volume us<strong>in</strong>g an iso-oset <strong>with</strong>the Mode set to Meta Balls. The problem is that this only uses the density ofthe metaballs and none of the potential other attributes.The volume attribute transfer tool is based upon this workow but aga<strong>in</strong>makes use of vops functionality to perform the lookup of the attributes manually.Similar controls are provides as <strong>with</strong> the po<strong>in</strong>tcloud approach, althoughthis tool was further developed and presets were added to make it easy for usersto transfer popular attributes that can be used from a drop down menu. The<strong>in</strong>terface of the tool can be seen <strong>in</strong> Figure (11). This tool also allows the possibilityto dene a per po<strong>in</strong>t transfer radius by us<strong>in</strong>g the pscale attribute if it ispresent on the template geometry.Inside of the digital asset, expressions are used to help dene the presetsett<strong>in</strong>gs. Metaballs are copied onto the template po<strong>in</strong>ts and are then referencedby a volumevop. Inside of the volumevop a while loop is created that will loopthrough all the metaballs, lookup the value of each one at a given position andadd the result together. This is the default density calculation. When try<strong>in</strong>g toadd a dierent attribute together the results were very blocky, the reason whythis was happen<strong>in</strong>g was because the attribute would be dened as a solid box ofa constant value <strong>with</strong><strong>in</strong> the bound<strong>in</strong>g box of a metaball. This is a problem verysimilar to 2d sprites that have not had there alpha channel premultiplied. Sothe solution was to multiply the attribute <strong>with</strong> the density value of the metaball,this problem is represented <strong>in</strong> Figure (12). The density needs to be multiplied<strong>in</strong>side the deepest level of the metaloop, just before the attribute is added to theresult of the previous metaball, not as a post multiplication operation because<strong>in</strong> overlapp<strong>in</strong>g areas the mask<strong>in</strong>g will be <strong>in</strong>correct, the post multiplication eect22


Figure 12: Premultiplication problems: The image on the left shows the attribute<strong>in</strong> grey and the density of the metaball <strong>in</strong> white.The image on the rightshows the correct premultiplied values.is shown <strong>in</strong> Figure (13), the artifacts are not that visible <strong>in</strong> a still frame but willcause jitter<strong>in</strong>g dur<strong>in</strong>g animation.At this po<strong>in</strong>t the values are simply added together, which works well fordensity, but not so well for velocity or color. For example <strong>in</strong> the case of particlesbe<strong>in</strong>g emitted from a s<strong>in</strong>gle po<strong>in</strong>t <strong>in</strong> space and then spread<strong>in</strong>g out from thatpo<strong>in</strong>t over time, what would happen is the density would be accumulated andlook good, but because of the dense number of particles at that s<strong>in</strong>gle po<strong>in</strong>t, thevelocity eld would grow extremely large and when this entire result<strong>in</strong>g volumeis then rendered by mantra <strong>with</strong> motion blur turned on, huge streaks are createddue to the high velocity accumulation.So more control was needed to dene the k<strong>in</strong>d of mathematical calculationthat takes place. Therefore an averag<strong>in</strong>g operation and a switch is added, so theuser can choose whether to accumulate the values or to average them. This is nottrivial and this choice should be provided to the user. A temperature eld for<strong>in</strong>stance might require either accumulation or averag<strong>in</strong>g, both could work andwill give dierent results. The presets try to alleviate this issue for some of thepopular attributes based upon what works better for those attributes <strong>in</strong> mostscenarios so the user does not need to worry too much about this. However ifthe accumulation of velocity attribute were required, the user can set the presetto other and dene v as the attribute, vector as the type and add as theblend operation as the other preset allows any custom attribute to be used.Because the copy sop <strong>in</strong>side of the asset transfers the template po<strong>in</strong>t attributes,the special attribute pscale can be used. When a pscale attribute isdened on the template po<strong>in</strong>ts, the metaballs will be scaled based on the pscalevalue. This tends to give good results, however when the pscale goes to zero,jitter<strong>in</strong>g <strong>in</strong> the volume might occur if the po<strong>in</strong>ts are mov<strong>in</strong>g. It would be as ifthe small metaball would only occasionally be picked up by a voxel when it is <strong>in</strong>close enough proximity. A better way of deal<strong>in</strong>g <strong>with</strong> this problem is by us<strong>in</strong>gthe weight attribute <strong>in</strong>stead of the pscale. This will not modify the radius, butwill <strong>in</strong>stead result <strong>in</strong> more of a fad<strong>in</strong>g eect. The best results can be achievedwhen both are used together.23


Figure 13: Incorrectly post-multiply<strong>in</strong>g of the attribute (temperature) by thedensity will cause artifacts, note the band<strong>in</strong>g <strong>in</strong> the brighter areas, that becomemore apparent <strong>in</strong> an animation.24


Figure 14: The preset smoke solver <strong>with</strong> the color eld added to it, as described<strong>in</strong> (5.3.1)5.3 Examples of custom eldsThe next sections will talk about how some setups can be created and what isrequired to implement the custom elds <strong>in</strong> dops for each example.5.3.1 Colour eld additionOnce the colour (Cd) attribute is transferred onto a volume <strong>in</strong> SOPS us<strong>in</strong>g thevolume attribute transfer tool, the necessary elds can be added <strong>in</strong> DOPS, thenode tree can be seen <strong>in</strong> Figure (14) :1. A Sop Vector Field, Cd, is dened to br<strong>in</strong>g <strong>in</strong> the newly dened Cd eldfrom SOPS. This eld will conta<strong>in</strong> the color <strong>in</strong>formation throughout thesimulation.2. Another Sop Vector Field, Cd_source, is dened us<strong>in</strong>g the Cd eld fromSOPS. This eld will be used to add color <strong>in</strong>formation to the Cd eld atthe beg<strong>in</strong>n<strong>in</strong>g of every frame. If this eld is animated, it is required thatthe Time and SOP Path are always evaluated. The Time parametershould be set to $T.3. Us<strong>in</strong>g a Gas Calculate <strong>with</strong> a the calculation set to Maximum, the dest<strong>in</strong>ationeld set to Cd and the source eld set to Cd_source will copy<strong>in</strong>formation from the source <strong>in</strong>to the dest<strong>in</strong>ation eld at the start of everyframe us<strong>in</strong>g a maximum operation.4. Advect the color eld by the velocity, us<strong>in</strong>g a Gas Advect microsolvers25


Figure 15: Two spheres emitt<strong>in</strong>g density and color <strong>with</strong> a vortex force applied.5. Diuse the color eld us<strong>in</strong>g a Gas Diuse microsolver, the diusion rateshould match the density diusion rate. For fast mix<strong>in</strong>g of the color, thisvalue can be <strong>in</strong>creased.In Figure (15) two spheres can be seen emitt<strong>in</strong>g density and color <strong>in</strong>formation<strong>in</strong>to a simulation. This simulation has the color elds dened as copies of thedensity values for either the red or the blue component of the Cd vector eldand does not actually require the transfer tool <strong>in</strong> SOPS. In Figure (16) you cansee a helix curve emitt<strong>in</strong>g density, colour and the temperature eld is driven bythe red values of the colour which causes the red smoke to rise quicker. The hueof the colour is mapped to the parametric u value of the curve.5.3.2 Advect by curveIn this example the tangent vectors of a curve are used as an extra force thatis cont<strong>in</strong>uously added to the velocity eld. A relatively large amount of force isapplied. Also the density eld is temporarely blurred, the gradient is taken fromthis blurred density, then normalized and applied as an additional force. Thecomb<strong>in</strong>ed force po<strong>in</strong>ts towards the density of the curve and along the tangentof the curve. A sphere is placed at the bottom of the helix and is emitt<strong>in</strong>gdensity <strong>in</strong>to the simulation. The density and tangent velocity elds can be seen<strong>in</strong> Figure (17).The node tree can be seen <strong>in</strong> Figure (18) and consists of the ma<strong>in</strong> follow<strong>in</strong>gareas:26


Figure 16: A helix curve emitt<strong>in</strong>g density, colour and temperature <strong>in</strong>to thesimulation. The red component of the colour is driv<strong>in</strong>g the temperature, thatis why the red smoke is ris<strong>in</strong>g quicker.Figure 17: The density eld and tangent velocity eld dened by a helix curveand used to advect smoke.27


Figure 18: The node tree for the dierent steps for the advect by curve simulationas described <strong>in</strong> (5.3.2).1. Dene a few custom sop vector elds to hold to custom dened volumesfrom sops, such as the density source (the little sphere), the custom densityof the curve, the tangent velocity and the gradient velocity (which will becalculated at a later step).2. Calculate noise by den<strong>in</strong>g new custom elds <strong>with</strong> the Gas Match Fieldmicrosolver, a scalar noise_eld and a vector noise_vel eld and denethe noise <strong>in</strong> the noise_eld <strong>in</strong>side of a Gas Field Vop us<strong>in</strong>g an Anti-Aliased Flow Noise vop. By us<strong>in</strong>g a Gas Analysis microsolver we cancalculate the gradient of the noise_eld and store it <strong>in</strong> the noise_vel.3. Calculate the gradient of the blurred density of the curve. Create a newtemporary eld to store the blurred_custom_density us<strong>in</strong>g a Gas MatchField, match<strong>in</strong>g the custom density eld of the curve. Copy the custom_density<strong>in</strong>to the blur_custom_density us<strong>in</strong>g a Gas Calculate. Blurthe blur_custom_density eld us<strong>in</strong>g a Gas Blur. Calculate the gradientof the blur_custom_density and store the result <strong>in</strong> the gradient_velocity.F<strong>in</strong>ally normalize the gradient_vel us<strong>in</strong>g a Gas Analysis. The resultantforce will appear to be always po<strong>in</strong>t<strong>in</strong>g towards the helix shape.4. Add the forces to density. By us<strong>in</strong>g Gas Calculate nodes, the variouscustom velocity elds can be premultiplied by higher values for a morepowerful eect and added to the velocity eld.The simulation can get unstable when too much force is added, so it can beuseful to add a low velocity damp on the pyrosolver, or even turn on speedlimits.A few stages of the simulation can be seen <strong>in</strong> Figure (19).28


Figure 19: A few stages of the advection by curve. These images were ipbookedfrom the viewport.5.3.3 <strong>Custom</strong> fuel and heat <strong>in</strong>jectionThe follow<strong>in</strong>g examples all make use of the combustion model <strong>in</strong>side the pyrosolver.By provid<strong>in</strong>g fuel and add<strong>in</strong>g temperature, smoke and ames can begenerated from the result<strong>in</strong>g density and heat elds. Some of these simulationswill have vorticle geometry <strong>in</strong> them to add more turbulent motion.Fuel from curve In this example the helix curve was used to dene an <strong>in</strong>itialfuel eld <strong>in</strong>side of the pyro object. A fuel eld is a default eld and does notneed a custom eld unless you want to have an animated fuel eld, for thisexample however the fuel eld is static. Only one custom eld is added to addtemperature to the bottom part of the fuel eld. The buoyancy direction on thepyrosolver is set to a negative y direction to avoid the heat from ris<strong>in</strong>g throughthe helix and ignit<strong>in</strong>g other parts before it is supposed to get there even thoughthat is visually quite <strong>in</strong>terest<strong>in</strong>g as well. The only step dur<strong>in</strong>g the advectionprocess that is added is to add temperature from the custom source temperatureeld to the temperature eld that will then be used by the combustion modeland start the ignition. The burn rate on the pyrosolver is set to 2, so it burnsquite fast and the temperature output is set to 6, so a lot of heat is generatedwhich will keep the simulation go<strong>in</strong>g. The dierent elds at dierent stages canbe seen <strong>in</strong> Figure (20).Fuel from animated geometry In this example an animated model of atree is used as a source geometry to dene animated volumes of both fuel andtemperature. The animated model was provided by Nick Hampshire, who createdthe animation through a real-time spr<strong>in</strong>g solver that he programmed forhis <strong>Master</strong> thesis [9]. As the geometry represents a mov<strong>in</strong>g po<strong>in</strong>t cloud at itslowest level it works will <strong>with</strong> the attribute transfer tool. The fuel eld hasthe appearance of spread<strong>in</strong>g out through the branches which was achieved bycopy<strong>in</strong>g an animated attribute from a static mesh of the tree to the animatedmesh of the tree. The attribute simply spreads <strong>in</strong> a radial fashion, although itwill spread faster at the outer po<strong>in</strong>ts of the branches and slower at the root of29


Figure 20: The purple eld represents the fuel, the yellow eld is the burn andthe white eld is the density result<strong>in</strong>g from the combustion <strong>in</strong> the fuel fromcurve example.the tree where the branches are thicker, the animated geometry <strong>with</strong> the spread<strong>in</strong>gattribute is then baked to disk to speed up the rest of the network. Thisattribute is then transferred us<strong>in</strong>g the volume transfer tool. The temperatureeld is the same as the fuel eld. The tree geometry came <strong>with</strong> po<strong>in</strong>t velocitieson it but those could alternatively be calculated <strong>with</strong> a trail sop as the topologydoes not change over time. These velocities are also transferred <strong>in</strong>to a customeld.In DOPS those three custom elds are brought <strong>in</strong> <strong>with</strong> Sop Scalar/Vectorelds and their SOP path and Time ($T) parameters are set to Always evaluate.Dur<strong>in</strong>g the simulation step the elds are added to their respective target eldsus<strong>in</strong>g Gas Calculate microsolvers. The fuel eld is not added <strong>with</strong> a maximumoperation as this added too much fuel <strong>in</strong>to the simulation which resulted <strong>in</strong> amassive explosive reaction, so <strong>in</strong>stead it is copied every frame and overwritesthe old fuel data from the previous frame. A Gas Dissipate is also added toslowly dissipate the density. The various stages can be seen <strong>in</strong> Figure (21).Fuel from particles In this example a simple terra<strong>in</strong> is modeled and particlesfall down from above the terra<strong>in</strong> and collide <strong>with</strong> it. A particle that is collid<strong>in</strong>gis added to a collision group. Outside of the particle network <strong>in</strong> sops, the po<strong>in</strong>tsthat are not <strong>in</strong> the collision group are deleted. The amount of collisions caneasily be <strong>in</strong>creased or decreased depend<strong>in</strong>g on the birthrate parameter of thesource pop <strong>in</strong>side the pop network. At each frame there are generally betweenone and three particles <strong>in</strong> the collision group. By us<strong>in</strong>g an attribute transfer,the normal from the collision surface is transferred to the particle. Now thevolume attribute transfer tool is used to dene the fuel and temperature eldsbased upon the metaball density. A custom velocity eld will also be generated<strong>with</strong> the tool, us<strong>in</strong>g the normal attribute from the particles which has just beentransferred from the surface.30


Figure 21: Top: The stages of the animated fuel eld, Bottom: The stages ofthe rendered burn<strong>in</strong>g tree.In DOPS the setup is very similar to the fuel from animated geometrysetup. Because fuel, temperature and velocity are only added where the particlesare currently collid<strong>in</strong>g and a low number of particles is collid<strong>in</strong>g per frame,not too much fuel is added each frame. Therefore <strong>in</strong> the Gas Calculate themaximum between the custom_fuel_source and the fuel is calculated. Thecustom_fuel_source eld is premultiplied by a factor of 5 to <strong>in</strong>troduce morefuel <strong>in</strong>to the simulation. The transferred custom_velocity_source is heavilypremultiplied by a factor of 150 before be<strong>in</strong>g added to the velocity eld. S<strong>in</strong>cethe velocity direction is com<strong>in</strong>g from the surface, the explosions are not directedstraight at the sky. On the pyrosolver the <strong>in</strong>eciency <strong>in</strong> the combustion modelis set to 0.6 which causes some of the fuel to not be fully burnt. The burn rateis set to 0.8 which will cause the fuel to take longer to be consumed. This cangive good results comb<strong>in</strong>ed <strong>with</strong> the <strong>in</strong>itial velocity as the burn<strong>in</strong>g fuel will beadvected by the velocity and will cont<strong>in</strong>ue to be burn as it is lifted up <strong>in</strong>to thesky. A small amount of velocity damp is also <strong>in</strong>troduced so the velocity wearso after the <strong>in</strong>itial boost. The dierent elds can be seen <strong>in</strong> Figure (22).6 ConclusionThe control Houd<strong>in</strong>i oers over manipulat<strong>in</strong>g dynamics and perform<strong>in</strong>g moreadvanced mathematical calculations is extensive and there are many more microsolversto study. Also uid dynamics for computer graphics is a populartopic of research and new developments are happen<strong>in</strong>g all the time. A signicantamount of time for this project went <strong>in</strong>to research<strong>in</strong>g exist<strong>in</strong>g ideas <strong>in</strong> uidsfor computer graphics and <strong>in</strong> how volume elds and the microsolvers work together<strong>in</strong> Houd<strong>in</strong>i. Ga<strong>in</strong><strong>in</strong>g a complete understand<strong>in</strong>g of how the preset smoke31


Figure 22: Fuel, temperature and velocity are transferred from collid<strong>in</strong>g particlesand set o small explosions. The fuel is purple, the heat is yellow, and thedensity is white. The <strong>in</strong>itial velocity upon collision is shown as the big red l<strong>in</strong>es.32


and pyrosolver work took time. This research only started to become more applicablehalf way through the project as various experiments were developed. Alot more experiments can be done, especially by modify<strong>in</strong>g the velocity eld, butit seemed more valuable to focus on a wider range of dierent types of customeld implementations to show a broad use of the tool and the possibilities byus<strong>in</strong>g custom elds. The aim was to ga<strong>in</strong> control over uids by us<strong>in</strong>g customelds and this has been achieved through the prototype experiments. Theseexperiments are by no means production ready, as higher resolution simulationscould have given much more detailed results. But that would also have taken alot more time.The ma<strong>in</strong> strength of this project is that the tool that was built is easy touse <strong>with</strong> a variety of applications, yet enables users to use all the functionalityof sops, from creat<strong>in</strong>g geometry such as curves or particles to den<strong>in</strong>g specicanimated po<strong>in</strong>t attributes through expressions or vops to create those artisticvolume elds. And because the tool follows conventions for den<strong>in</strong>g volumeelds, the elds can be used <strong>in</strong> other context besides dops, like pops or forrender<strong>in</strong>g <strong>with</strong> Mantra. With<strong>in</strong> the metaball tool there is still an optimizationthat could be made when deal<strong>in</strong>g <strong>with</strong> vector elds, because the volume vopis used separately for each component and ideally would only be used once forall the components <strong>in</strong> one go. This would speed up the tool signicantly asthe metaball loop only needs to be executed once <strong>in</strong>stead of three times. Theproblem lies <strong>with</strong> the output of the volume vop <strong>in</strong> SOPS, which seems to allowonly a s<strong>in</strong>gle scalar eld to be exported and what is needed is a vector eldexport option.The microsolvers <strong>with</strong><strong>in</strong> Houd<strong>in</strong>i are powerful mathematical build<strong>in</strong>g blocksthat are able to build bigger structures like vortex connement or entire solvers,however s<strong>in</strong>ce the author was quite new to the eld of uid dynamics a goodunderstand<strong>in</strong>g and knowledge base needed to be built up rst before more <strong>in</strong>terest<strong>in</strong>gexperiments could be set up. By follow<strong>in</strong>g the mathematical equationsalongside the microsolver networks and be<strong>in</strong>g able to visualize the outcome ofa given calculation <strong>in</strong> the viewport so it would make sense on a geometric level,the author was able to get a good understand<strong>in</strong>g of uid solvers and how tomodify them. The author recommends learn<strong>in</strong>g Houd<strong>in</strong>i uids this way as youget <strong>in</strong>formation from both sides. Overall this project has been an <strong>in</strong>terest<strong>in</strong>gexperience even though it was biased more towards the research side than theproduction side than was orig<strong>in</strong>ally planned. By putt<strong>in</strong>g the equations next tothe microsolver node networks the author hopes to have been able to create abetter understand<strong>in</strong>g for other Houd<strong>in</strong>i users or perhaps opened up the doorfor researchers who would want to use Houd<strong>in</strong>i for development of uid solvers.By not focus<strong>in</strong>g on the implementation of one big digital asset perform<strong>in</strong>g onespecic eect, but <strong>in</strong>stead build<strong>in</strong>g a small and comparatively light, very usefulbuild<strong>in</strong>g block to help dene custom elds, a much broader application of thetool is possible. The tool is like a microsolver <strong>in</strong> SOPS.33


ThanksThanks to Coen Klosters for tak<strong>in</strong>g the time to meet several times <strong>with</strong> methroughout the course of this project to discuss Houd<strong>in</strong>i uids and a great thanksfor giv<strong>in</strong>g an extremely <strong>in</strong>terest<strong>in</strong>g masterclass. Thanks to Nick Hampshire forlett<strong>in</strong>g me use his L-system animation. Thanks to my classmates for bounc<strong>in</strong>gideas back and forth and for giv<strong>in</strong>g feedback on some of the experiments. Thanksto Jon Macey for giv<strong>in</strong>g useful advice dur<strong>in</strong>g the mid-term crits and for po<strong>in</strong>t<strong>in</strong>gme <strong>in</strong> the right direction towards resources developed by previous MSc students.Thanks to the houd<strong>in</strong>i community at www.odforce.net and at www.sidefx.comfor clarications and for shar<strong>in</strong>g <strong>in</strong>sightful scene les.References[1] Christopher Batty and Ben Houston. Visual simulation of wispy smoke. InSIGGRAPH '05: ACM SIGGRAPH 2005 Sketches, page 114, New York,NY, USA, 2005. ACM.[2] Robert Bridson. <strong>Fluid</strong> Simulation for Computer Graphics. A K Peters,2008.[3] Robert Bridson, Jim Houriham, and Marcus Nordenstam. Curl-noise forprocedural uid ow. In SIGGRAPH '07: ACM SIGGRAPH 2007 papers,page 46, New York, NY, USA, 2007. ACM.[4] Robert Bridson and Matthias Müller-Fischer. <strong>Fluid</strong> simulation: Siggraph2007 course notes. In SIGGRAPH '07: ACM SIGGRAPH 2007 courses,pages 181, New York, NY, USA, 2007. ACM.[5] Robert Bridson and Marcus Nordenstam. Naiad [computer program], August2009. http://www.exoticmatter.com/overview/ [Accessed 17 August2009].[6] Gordon Chapman, Jerry Tessendorf, and Michael A. Kowalski. Art direct<strong>in</strong>gparticle ows <strong>with</strong> custom vector elds. In SIGGRAPH '08: ACMSIGGRAPH 2008 talks, pages 11, New York, NY, USA, 2008. ACM.[7] Raanan Fattal and Dani Lisch<strong>in</strong>ski. Target-driven smoke animation. InSIGGRAPH '04: ACM SIGGRAPH 2004 Papers, pages 441448, NewYork, NY, USA, 2004. ACM.[8] Ronald Fedkiw, Jos Stam, and Henrik Wann Jensen. Visual simulation ofsmoke. In SIGGRAPH '01: Proceed<strong>in</strong>gs of the 28th annual conference onComputer graphics and <strong>in</strong>teractive techniques, pages 1522, New York, NY,USA, 2001. ACM.[9] Nick Hampshire. Dynamic animation and remodel<strong>in</strong>g of l-systems.N.C.C.A., Bournemouth University, August 2009.34


[10] Christopher Horvath and Willi Geiger. Directable, high-resolution simulationof re on the gpu. In SIGGRAPH '09: ACM SIGGRAPH 2009 papers,pages 18, New York, NY, USA, 2009. ACM.[11] Theodore Kim, Nils Thürey, Doug James, and Markus Gross. Waveletturbulence for uid simulation. In SIGGRAPH '08: ACM SIGGRAPH2008 papers, pages 16, New York, NY, USA, 2008. ACM.[12] Mario Marengo. Sidefx forum post on "explosion us<strong>in</strong>g pyrofx", Jun 2009.http://www.sidefx.com/ [Accessed 17 August 2009].[13] David M<strong>in</strong>or. Physical simulation of re and smoke master thesis.N.C.C.A., Bournemouth University, September 2007.[14] Rahul Nara<strong>in</strong>, Jason Sewall, Mark Carlson, and M<strong>in</strong>g C. L<strong>in</strong>. Fast animationof turbulence us<strong>in</strong>g energy transport and procedural synthesis. InSIGGRAPH Asia '08: ACM SIGGRAPH Asia 2008 papers, pages 18,New York, NY, USA, 2008. ACM.[15] Sidefx. Video tutorials, 2008 - 2009. http://www.sidefx.com [Accessed 17August 2009].[16] Sidefx. Gas project non divergent dynamics node - help le, 2009. Houd<strong>in</strong>i10 help le.[17] Jos Stam. Stable uids. In SIGGRAPH '99: Proceed<strong>in</strong>gs of the 26th annualconference on Computer graphics and <strong>in</strong>teractive techniques, pages 121128, New York, NY, USA, 1999. ACM Press/Addison-Wesley Publish<strong>in</strong>gCo.[18] Mya Yee W<strong>in</strong>. The implementation of 2d uid solver plug-<strong>in</strong> for houd<strong>in</strong>i8.2.A thesis submitted for the degree of M.Sc Computer Animation, NCCA,Bournemouth University, September 2007.35

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!