Posted by Duncan Brinsmead, 12 March 2012 12:00 pm
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.
Please only report comments that are spam or abusive.