Join Aaron F. Ross for an in-depth discussion in this video Floating objects, part of Maya: Creating Fluid Effects (2013).
The Maya Ocean renders as a displaced surface as we've seen, however, it's also dynamic and that means that we can float objects on the surface of the ocean, and the position and optionally rotation of the objects will be driven by the shape of the waves. Here I've got a scene with a Maya Ocean with default shader parameters. If I press play you can see we've got some moving waves here. I'm going to import an object that I can then float on the surface of the ocean.
Go to the File menu and choose Import and scroll down a bit, you're looking for 02_05_jetski, select that, and then over in the Import options you might want to check the Namespace Option section, and make sure that Use namespace is on and the option down here labeled Merge is selected. That just means that Maya is going to import the file nodes and not change their names, go ahead and click Import. Now I've got a jetski in my scene, but it's very large relative to the ocean.
If we go out to the top view, tap the spacebar, dolly back in the top view. You'll see that the jetski is actually larger than the entire ocean plane currently. Let's scale it down so it is at 1/100 scale. Select it and go over to Channel box, drag your mouse across the X, Y and Z scale values and type in .01m. Now it's at approximately the correct scale for the Ocean. Back to the Camera view, I'll tap the spacebar, press the 5 key, so we can see shading.
Currently it's not dynamic. If I press Play we don't see any motion on the jetski itself. I'll select it and just move it up a little bit and then go into the menus and make it float. With the object selected, go into the Dynamics menu set and choose Fluid Effects>Ocean>Float Selected Objects, and then rewind and play back and you'll see that in fact it is floating on that surface dynamically. You'll note that a locator has been created, so the locator is a dummy object or a null.
With that locator selected you can see in the Channel box that translate Y is in purple, that means it's got an incoming expression. That's what's driving the vertical position here. The other channels are all open and free for us to animate, so for example if I needed to move it forward I could select translate Z and middle mouse drag in the viewport here, just pull that forward closer to me. Translate X as well, I can move it but I can't move it in Y, because that's being controlled by the expression, play that through.
If your object is too high or too low relative to the ocean, then you can move it relative to the locator. My object is simply just parented to that locator The locator is what's actually moving according to this expression. I can select the object itself and move it relative to the locator to move it up or down. So now it's not going to go below the ocean surface as much. Okay, so that's how you can make an object float and you can animate the position and rotation of the floating locator here.
So I can select to Rotate tool and turn it in any direction I need it to be. This is the technique you'd want to use if in fact you are going to animate the rotations by hand with traditional key framing. Let's also look at how we can make an object float and have its rotations driven by the Ocean shader. Okay, so I'm going to delete these, I'll just select that locator and press delete and re-import my jetski; File>Import, select the file, import it, select it, set its scale down to 1/100th, .01.
This time instead of using Float Selected Objects, I'm going to use Make Boats, with the object selected back in the Fluid Effects menu, Ocean>Make Boats. We also get a locator once again, but you'll notice that the Rotate X and Rotate Z Channels also have expressions in them now. I'll move it forward a little bit, translate Z, so we can see a little bit more clearly. Press Play, and now it's bobbing around according to the shape of the waves.
I can still animate it in position X and position Z and I can still animate it in rotate Y to steer the boat in different directions.
- Simulating convincing surfaces of water and other liquids
- Creating dynamic ripples with fluid pond and wake emitters
- Testing simulations with interactive playback
- Rendering water surfaces
- Controlling render tessellation
- Floating objects dynamically
- Rendering an underwater scene