Torpedo bubble trail with Maya Fluids

The trail of a torpedo is tricky to do because it combines fluid dynamics, surface and volume rendering as well as fog and light scattering. The technique used in the above Maya scene is to have one fluid that renders both as a volume and a surface mesh. The overall underwater fog was done with a second non-dynamic fluid.

Fluid Simulation

The first step was to create a 3d fluid with an emitter. The emitter was then modified to be a cylindrical volume that emits both density and speed( see "fluidEmitter1" in the scene). The speed emission simulates the thrust of the propeller using "Along Axis", while a little bit of "Around Axis" simulates the rotational effect. Turbulence on the emitter is also used with a relatively fast speed setting. Fluid dropoff is disabled so emission is uniform within the volume. Motion streak is enabled so that as the torpedo moves the emission does not strobe or form bands. The translation of the emitter was then animated ( the torpedo was parented to the emitter, but one could easily have done it the other way round). To better handle high speed thrust the substeps on the fluid node was increased. (although in this case it probably would be OK with lower substeps than were used)

Auto resize is enabled on the fluid to make things more efficient. All boundaries are set to "None" and the resize margin set to 2 to help keep boundaries from affecting the solve. High detail solve combined with density noise helps to provide detail in the flow without needing too high a fluid resolution. One then needs to do trial and error to determine good emission rate, density dissipation, density noise, and density buoyancy. I also added a little velocity noise.

Fluid Mesh

In order to get specular highlights I created a mesh from the fluid using "Modify: Convert: Fluid To Polyons". This initially enables "intermediateObject" on the fluid shape node, which keeps it from rendering. However in this case the effect of the volume combined with the surface is desired so navigate to you fluid shape and turn off intermediate object to make it visible again. On the fluid you may wish to lower the mesh resolution to make things faster and keep the poly count low. Also the surface threshold on the fluid should be adjusted carefully for the best effect (which will depend on the transparency of your fluid). One needs to assign a shader with specular highlights that is totally or very transparent("blinn1" in this scene). On the fluid shape you should enable visible in reflections/refractions in the render options(this is on by default for most other nodes, but is off on fluids for render speed). In order to add detail a volumeNoise bump map was applied .I would avoid enabling refractions on the shader as it is hard to integrate this well with the volume fluid render.

Bubble Shading

On the fluid selfShadow was enabled and realLights was turned off( is simpler and a bit faster to render ), using the internal direction light. The direction was set to ( 0,1,0 ) to model the overhead lighting. Ambient brightness was set quite high. One needs to carefully adjust the transparency along with shadow opacity, light and ambient brightness and color.

Underwater "Fog"

For the underwater fog effect I used a second, non-dynamic fluid (i.e. one with everything in contents methods set to OFF). I tried to get some of the scattered light effect off of the bubbles by creating a large fluid for the fog parented to the main bubble emitter. (see fluidShape2, under fluid1:fluidEmitter1) If you want to see this fluid you can set "Shaded Display" to "As Render" on fluidShape2. The color ramp input is set to center gradient and the color at the very center is light blue quickly falling off to dark blue. The transparency of this fluid is slightly tinted blue which is important for the colors of objects in the fog( in addition to the color ramp value). Opacity input is simply set to constant, with the right hand opacity ramp indice lowered to a desired opacity. Again real lights is turned off, and with shadows off there is no shadowing of this fluid. One might try using a stationary fog fluid illuminated by a moving light that has fast decay instead of moving it with the torpedo as was done in this scene. You could use the built in point light on the fluid or perhaps a linked linear light. Note that because this fluid was so large I needed to increase the shading quality on it to properly capture the color gradient. Otherwise the transparent outmesh of the fluid used for specular highlights became visible. This is because the integration of volume spans through the fluid is different for a single span than two spans( a transparent surface splits a span) when the shading quality is not high enough to fully resolve the shading inside the fluid. As with the bubble fluid, enable "visible in refractions".

To further fake the scattering of light from the bubbles into the water I added a tiny amount of shader glow on the bubble fluid. In general always turn off auto-exposure on the shaderGlow node(in hypershade) then hand adjust the glow and halo intensity... usually you need to lower them a lot. This avoid flicker during animation. As well set the shaderGlow quality to a high value( like 20).

Fire One!

Finally I added the sub and collided it with the bubble fluid (select sub and fluid then do "fluid: make collide"). In order to create a little blast in the tube at launch I animated the density pressure up for the first few frames. I also animated higher substeps to allow fast motion.

Possible Improvements

I just rendered this sequence without first caching the fluid, but it is safer generally to cache first then render and usually important if you are rendering on a farm.

Something that might be nice to add might be a bit of depth of field, slightly blurring things in the distance. Motion blur would also help, but might not be needed if there was depth blurring.

One might also add some floating particles for debris or fine bubbles and perhaps use the fluid as a field on the particles, setting conserve near zero on the particle shape. Use cloud type particles for better render integration with the fluids. Note that in some cases to get good render integration of the particles with the fluids you may need to enable "Volume Samples Override" and set volume samples on the fluid shapes.

Perhaps using real lights and incorporating a directional light with raytraced shadows could also help: At launch it is noticable that the fluid is bright inside the launch tube, where it should be shadowed by the sub. If you need to use many lights it is a good idea to link lights to your fluid, as many lights will wash out the shading if they don't have raytraced shadows, or be slow to render if they do.

12 Comments

arvmetal

Posted 16 February 2012 11:14 pm

Locks very realistic, please make a tutorial.
Thanks.

kealala

Posted 17 February 2012 1:49 am

Shoo~~t ! Can't see it . You know , In China ,No YouTube~~ Shoo~t

jona vark

Posted 17 February 2012 7:03 am

Awesome shot. Though as the bubble trail dies it exhibits the trademark fluid sim look. I don't quite know how to explain it except to say it has a fractal sort of look that I see often as particles dissipate. Almost as if it is too complex, mathematical.

mandark1011

Posted 17 February 2012 9:03 am

great look Duncan I never thought of using a fluid as a volume AND a mesh at the same time. Thank you!

noxy

Posted 17 February 2012 10:41 am

fantastic look for the bubbles! If I ever need to do bubbles again, I'm going to use some of these shading techniques. Shouldn't the bubbles rise a bit more? It seems odd that they linger and dissipate, especially towards the end of the shot.
Keep the tutorials coming Duncan. I used your hurricane technique on the opening of Journey to the Mysterious Island.

Duncan Brinsmead

Posted 17 February 2012 11:40 am

Yes, I think I could have used less dissipation, in which case the bubbles would not have hung around longer and risen more. Perhaps some more density buoyancy as well. The first test I did was perhaps too much the other way and I had a lot of bubbles in the tail rising up in a big plume. This also makes the fluid work harder and consume more memory as the overall bounds of the bubbles is larger, so I erred on the side of too little buoyancy and too much dissipation.

Duncan Brinsmead

Posted 21 February 2012 1:50 pm

If by gizmo you mean manipulator perhaps you accidentally changed the manipulator scale. In preferences under Manipulators the global scale controls how long the arrows are (for things like the the transform and scale manips)

sliles12

Posted 27 February 2012 1:55 pm

This is one of the clearest and most concise video tutorials I have seen. Thanks for providing insight into this use of fluids.

Travisphilips

Posted 1 March 2012 9:27 am

This is brilliant, thanks for posting Duncan.

john romeio

Posted 9 March 2012 12:35 am

Amazing one... again..

prasoon

Posted 26 May 2013 7:27 pm

Hello sir,
Since we can use maya fields as DMM force, can we use fluids as DMM force field ? I tried but it didnt work. Which fluids attribute will affect the DMM object as force?

Duncan Brinsmead

Posted 27 May 2013 6:56 pm

I tested it and it seems to work OK. Select the fluid and the dmm object and do "apply maya force to DMM object". You might need to make gravity zero to more easily notice the effect, as the push might be subtle for a slow moving fluid. The fluid simulation needs to have some velocity as that is what becomes the force. Turn on velocity draw on the fluid to see the velocity values. If you want the DMM object to exactly follow the fluid flow then you need then you also need some drag on the object to keep it from building momentum.