• 1/1

Boiling Water

Posted by Duncan Brinsmead, 12 March 2012 12:00 pm

 Download scene file fluidBoil.ma

This scene file shows an easy set up for a relatively fast to simulate boiling water effect using Maya Fluids. Creating a convincing boiling transparent liquid can be problematic, because of the internal bubbles and the way they affect the surface. When each bubble comes to the top it needs to displace the liquid at the top of the surface then burst... not simply open up a hole. Also the larger bubbles are not simple spheres but can deform somewhat.

The basic workflow show here is to create a 3D fluid, select the fishTank preset in the attribute editor, then flood fill the fluid to a density of 1 using the paint fluids tool. Create a bunch of poly spheres of random size and positions(I think it is generally better if the spheres are slightly squashed in y). Do poly combine to make it one mesh, then collide the fluid with them and animate the mesh to move upwards and press through the fluid. Finally hide this collision mesh as we only want to see the effect of the collision. Also increase the transparency on the fluid to see the internal bubbles.

However simple linear motion of bubbles looks a bit unnatural, so this example scene I created two objects... one with bigger spheres and one with smaller. The smaller one is more slowly, as small bubbles do not rise as fast as big ones. The animation curve starts slowly then speeds up as the boil gets going. As well to make it look a bit less uniform I created a lattice deformer for the two bubble meshes. The lattice cvs were pulled such that the bubbles rise slowly at the bottom then speed up as they get towards the top of the fluid. The cvs were also slightly randomized to make the bubbles deform as they move through the lattice. Note that when testing the motion of the meshes one can disable the fluid evaluation temporarily to speedup playback.

To make the water surface a bit more lively I lowered gravity on the fluid to 3.0. This makes this essentially a slow motion boiling, although it depends largely on the intended real world size of the fluid. The smaller the real world object the higher the gravity setting needed (one may also need more substeps for higher gravity settings or if the bubbles move faster).

To better handle small bubbles I increased the fluid base resolution to 130, and also increased the substeps and solver quality a bit. I also increased the surfaceThreshold to 0.38, which better shows the small bubbles. However a problem I noticed in the final render is that this is now causing some parts of the fluid that the solver thinks is liquid to be rendered as air (this creates a wiggly look along the boundaries and some strange persistent bubbles in the fluid towards the end) I think one should be able to fix this by increasing the liquicMinDensity attribute a bit, but I've not yet tried it.

To render the fluid I converted fluid to poly an assigned a blinn shader with transparency and refractions/reflection. A key to good water is the fresnel dropoff of reflectively with ray/surface angle. One can get this with the blinn shader using the specular rolloff attribute (this affects both specularity AND raytraced reflectivity). To keep specular highlights strong I make the specular Color value 4.0 then set the reflectivity to 0.25. (reflectivity is scaled by the specular color so in this case one needs to make it 0.25 or lower to keep it from effectively being greater than 1.0) On the fluid I used the Quad mesh method with smoothing iterations of 3. The quad mesh works well with poly smoothing. On the fluid output mesh I enabled smoothMeshPreview and set the previewDivisionLevels to 1 (2 would result in an excessive poly count).

Note that in this scene I did not set an initial state on the fluid, but rather used an animated emitter so that I did not need to include a large initial state file with this tutorial. Thus there is no fluid until frame 2. To have fluid on the first frame one can simply play one frame, set initial state, then delete the emitter or set its rate to zero.

A little motion blur might help this simulation, but will make it somewhat slower to render. To render with motionblur first cache the fluid (make sure to cache velocity on the fluid as this is required for the output velocity vectors used for motion blur on the mesh), then enable full deformation motion blur in the render settings.

Instead of creating the bubble meshes by duplicating poly spheres and doing mesh combine iteratively(creating larger and larger groups) another technque might be to create an nParticle system, emit into it using a volume emitter, adjust radius and radius randomize, convert to poly, then duplicate the resulting mesh and delete the particle system. One could use emission overlap pruning to avoid overlap of the bubbles if desired. One might be tempted dynamically animate the particles and collide the fluid with the particle output mesh. However I think this will have problems because the output mesh continually changes topology, which will likely create a problem for the fluid nodes computation of the collision boundary velocity. Perhaps some day we will add a particle fluid collision that displaces bubbles.

There is another trick one can use where particles emit heat into the fluid and the fluid has temperature pressure. This will create bubbles in the fluid where it is hot, but does not provide great results. However an advantage would be that the particles could also be pushed with the fluid flow. Yet another variation would be to make the bubble grids nCloth, in which case one can also push the cloth bubbles with the fluid flow by applying the fluid as a field on the nCloth. Self collision thickness and pressure can be used to keep the cloth bubbles from collapsing.

14 Comments

hoganburrows

Posted 9 March 2012 7:40 pm

very nice, more tutorials from Duncan please, fluids 101 please.......

jona vark

Posted 10 March 2012 8:09 am

awesome. As a Max user since V1 I toyed with the idea of switching to Maya on my last upgrade. I wish I had.

nice work and a great article.

mjmurdoc

Posted 12 March 2012 11:17 am

Pretty Great! Is there a more flexible way to build the bubbles? (More procedural? Perhaps using particle emitters with instanced geometry instead of having to duplicate and animate all the bubbles)

Duncan Brinsmead

Posted 12 March 2012 12:23 pm

You could use particle instancer, however you would need to bake out the instances somehow in order to collide with the fluid( there is an instancer bake script on creative crash I think). One can use the mesh output of particles to create the initial bubbles, but the motion would need to be animated separately because it will not work well if the topology of the colliding mesh changes over time. One could make it an nCloth mesh an animate it with forces, self collision and pressure. I tried experimenting with this, but one problem is that if the bubbles squash too much they can carry water up into the air too far. (possibly one might turn off auto-resize on the fluid so that water simply disappears if carried up too high)

Amin

Posted 2 April 2012 1:00 am

Good work

tnx

stooch

Posted 21 May 2012 1:34 pm

Hey Duncan, I am loving the fluids in Maya 2013, really great job on the solver. I was wondering if you had any plans to further optimize the auto resize feature. For example, it would be great if you could check for fluid cells that are not visible to camera and not resize into their direction? IE, give preference for auto rescale into those cells that are heading towards the cameras FOV.

Also, houdini has a nice feature where they break up the solve across multiple domains and merge them at the seams, it would be great if we had a similar feature so that we could solve across the render farm...

really great work though.

AndreCT

Posted 20 July 2012 6:54 am

this is more of a question related to fluids.
I am trying to find Duncans ink in water tutorial as i am currently trying to do an effect like that and struggling with the way it looks and some of the settings

AndreCT

Posted 25 July 2012 9:35 am

Hey Duncan, i am busy working on a bubble pop simulation and at the moment i am having a little issue that the pop looks like it is in a body of oil instead of water.
I have increased gravity and the solvers.
What other settings am i missing to give it more of a water feel

hoganburrows

Posted 5 October 2012 12:36 pm

I cant mesh more than 10,000 particles in maya Fatal error, make the marticle mesh work better.

(ps post more too, keep up the work)

Robbie Sidana

Posted 29 October 2012 7:58 am

Hello Sir, i have a scene consist of an experiment in chemistry subject. In my scene i have a cylindrical beaker placed above the burner and in this scene i want to show the boiling water effect in the beaker. As you already told to use fish tank preset in Maya but now I am facing the problem to show boiling water effect in my cylindrical object and the fluid container is cuboid shaped..
I don't have any knowledge of other fluid software like real flow or any other else.
So kindly guide me how to change the shape of the container or any other way to show this effect in cylindrical object in Maya only.
Thanx

Duncan Brinsmead

Posted 29 October 2012 5:22 pm

You could use a volume emitter to fill a cylindrical section of fluid( on the emitter make the volume type cylinder, fluidDropoff zero, and density method = replace ). Emit one frame then set initial state on the fluid and make the rate=0 on the emitter(emission off). Do fluid:makeCollide between the cylinder and your fluid.

silverbolt

Posted 20 June 2013 7:09 pm

Hey Duncen,
I have downloaded your Boiling water example, but my Maya would run only one or two frames, and then hang. Same is true with trying to use the fish tank preset.
I have a brand new windows 8 computer with i5 3.2 GHZ quad-core and 16 GB of RAM.
DO I need stronger hardware for running your Scene file, or is it my configuration that is lacking?

Thanks!

Duncan Brinsmead

Posted 20 June 2013 7:19 pm

No.. I did it on much lower end hardware running on win7. Is it locking up just running the simulation in the viewport or when rendering? What version of Maya are you using?

Duncan Brinsmead

Posted 20 June 2013 7:23 pm

It could be something to do with threading... fluids gets very slow if you have any other processes running that are threaded... like if you had a separate render running when playing the simulation the threading from that process conflicts with the fluid threading making the simulation slower than if it was not threaded at all. If you need the other process running then temporarily setting the threadcount to 1 in Maya can speed up the fluid playback( but you want to set it back when you don't have another process running ).

Add Your Comment

You must be logged in to post a comment.

Please only report comments that are spam or abusive.