Sunday, August 23, 2009

Foaming at the Mouth

Summer is almost over and my last year of graduate school is about to begin.

I have spent most of the summer recreating the materials that I have lost during the crash; this did not take as long as I estimated. However, I did run into several technical problems, mostly concerning the creation of the foam between the moving gondola and the ocean. I will delve into the details of this problem and the journey to its solution in the following post.


nParticles
As stated before in a previous post, foam development was abandoned due to time constrains and the inability to utilize Maya’s nParticles on the hardware that was available to me. Thanks to the extra time that I was allotted over the summer, I had more hours to sit and research different techniques in order to produce this element. Although, a minor aspect, that most viewers won’t even notice, the foam plays an essential part in giving the illusion that the gondola is interacting with the water.

I originally attempted to use particle sprites instead of particle clouds, but couldn’t figure out a way to control the opacity and generation of the sprites. It seemed that I would have to learn scripting in order to do so, which was something that I wanted to avoid.


Fluids
I spent several days studying Maya’s impressive fluids system; I was able to come up with a satisfactory foam effect.

Foam created with Maya Fluids, click to play QuickTime.

The problem was that once the boat moved and the waves were running, the foam seemed to be “swallowed” by the water.

Foam being swallowed by the water, click to play QuickTime.

Constraining the fluid box to the boat, or trying to animate its translation and rotation separately was too difficult, as I had to adjust almost every frame and then check it in the render view. This took up about two weeks of my time and it still did not look satisfactory.

A positive result of this experiment is that I now knew the basics of Maya’s fluid system, and also, I was able to create usable foam for when the breaking waves hit the ocean.

Foam test for the breaking wave.
(See the last clip in this post for a final composite between the foam and the waves).
Click to play QuickTime.

Water splash, created by live action ink.
(Similar effects will be used to create the underwater and abstract sequences).
C
lick to play QuickTime.

While it worked for the breaking waves, it still did not work properly for the boat. I needed to find a way to create the foam, so that it would be automated and I wouldn’t have to spend too much time adjusting it in each scene.


Textures
The next attempt was to try and build a polygon mesh and apply an animated texture to it.
I created two sets of animated textures, using Particle Illusion, one for the bow of the boat and one for the wake.


Foam Texture, click to play QuickTime.

Wake Texture, click to play QuickTime.

This technique was faster to render than the previous fluid method, but still resulted in a similar problem of being “swallowed” by the ocean. Even though the render was faster, it still proved to be a cumbersome process that would take up too much time to adjust in each of the shots. More so, the animated texture files took up a lot of gigabytes.

Polygons with textured foam. The wake is projected on the Ocean Surface. Click to play QuickTime.

At this point I was ready to give up (not the first time). I left the project for a few days to work on some other things, and soon a new idea came to mind...


...Came Full Circle
I would generate an intersecting toon line between the gondola and the ocean, convert it into a mesh and emit the foam particles from that.

Toon line generated between the gondola and the ocean, click to play QuickTime.

This is what I tried originally with the cloud particles, which proved to be too resource heavy. I would have to bite the bullet and learn some scripting, in order to control the sprite particles, which were faster to render.

Fortunately, I came across Mike Rhone’s Explosion Rig Tutorial, which proved be very valuable as well as educational. Whatever the tutorial didn’t clear up, Mr. Rhone was very happy to help with via email.

Click to play QuickTime.

After reviewing the tutorial several times, and making sure that I understood the coding (learning through practice is easiest for me). I adjusted the parameters of the particle rig and attached them to the toon line that intersected between the gondola and the ocean.

Click to enlarge image.

As you can see in the test below, the foam is automatically generated and killed between the gondola and the ocean. This allows me to import this rig into any scene without having to do any major adjustments each time.

Notice how the foam automatically stays around the boat, click to play QuickTime.

The foam is ready to go, and I am able to focus on the more creative aspects of the project once again. Below, is a clip of the first fully composited shot. I’ve included the wake texture as a projection underneath the boat to complete the effect.

Below is the completed shot, composited and in Adobe After Effects:
Completed first shot with effects. Please forgive the poor compression and colors.
Click to play QuickTime.



A Note About Rendering Sprites

I would like to note that Maya can only render sprites through its Hardware Render. I have encountered a couple of problems using this render, and I would like to share the solutions that I have found in order to overcome them.

Black Frames with Hardware Render
If you are receiving a black or blank frame with the hardware render, try to change the camera clipping. I found that reducing it usually solves the problem.

Slow Rendering with Hardware Render
Generally, Hardware Render is very fast. I have encountered, however, that sometimes it’s even slower than software. At first this seemed very random, as a low resolution scene would take three hours to output, while the same scene at hi-res took a few minutes.

What I discovered, is that if you cache the particles, Hardware Render will work very fast. If they are un-cached, that is most likely the cause of the slow render.
Here is a quick tutorial about particle caching.