Boat Floating Simulation in Maya

by HighMarsOrbit in Design > Digital Graphics

132 Views, 0 Favorites, 0 Comments

Boat Floating Simulation in Maya

Floating boat.png

In this Instructable, you'll learn how to create a simulation of a boat floating on Autodesk Maya using Maya's BOSS ocean simulation system.

You'll learn how to create realistic ocean waves, foam, boat wake, and accurate lighting, as well as how to simulate the boat floating and bobbing on the water as it travels. We will also add some environmental effects to really make the scene pop.

No addons are needed. All these effects are possible in native Maya, which you can get for free as a student. No Maya knowledge is required to follow along. By the end of this instructable, you will have a completed render that you can export as a video and tweak as you like. With all that said, let's set sail!

Supplies

  1. Auotdesk Maya (download for students here: https://www.autodesk.com/education/edu-software/overview)
  2. Free HDR Skydome (explained later, found here: https://design.tutsplus.com/articles/freebie-8-awesome-ocean-hdris--cg-5684)
  3. Free boat model (explained later, found here: https://www.cgtrader.com/items/780645/download-page)
  4. Any EXR file viewer (I used Cinesync Play, found here: https://www.cinesync.online/downloads)
  5. Any video editing software (I used Premiere Pro, but Davinci Resolve is a great free alternative)

The Beginning Begins: Download and Install Maya

Maya download 1.png
Maya download 2.png
Maya download 3.png

First things first, we need to dowload Autodesk Maya, the 3D modeling software of choice for this simulation. Go to the link in the supplies section, and if you are a student, you get Autodesk products for free. Verify your school email and download the latest edition of Maya. Follow the instructions to install.

Setup the Project

Plugin manager access.png
Plugin manager.png
300 frames.png

Open up Maya and create a new project. Save it wherever you want. Go to Maya's Plugin Manager, and verify that bifrostGraph, bifrostshellnode, bifrostvisplugin, and Boss are all enabled (Load and Auto Load). We will be using these plugins to create our ocean. Increase the duration of the project to 300 frames or so, so that the boat that we add later has some time to move around.

Create the Ocean Plane

Add plane.png

The way BOSS works is that it deforms existing geometry, so we need to create some geometry for it to deform. Create a plane and increase the size and subdivisions in the side panel to increase the fidelity of the ocean.

Create the BOSS Ocean

Workspaces menu.png
Boss editor menu.png
Boss editor first wave.png
Spectral wave properties.png

Switch over to the Bifrost flluids workspace, open the BOSS editor, and add a Spectral Wave. This wave type simulates the waves generated on the real ocean. This will be the the first layer of waves, the coarse ocean waves. In the property editor, make the waves start on frame 1. Do this for any wave you add, since BOSS defaults to starting them on frame 2.

As a note, BOSS simulates oceans in meters, whereas by default Maya units are in centimeters, so the ocean waves you are simulating are 100 times "smaller" than real life. Keep this in mind when adding in other models, like boats.

With that said, when editing the wave parameters, there are two main options: Patch Size and Resolution. The way that BOSS works is that it simulates a section of ocean the size of the Patch Size, and the Resolution is the size of a "window" into that patch. You want the Patch Size to be somewhat large so you don't have weird artifacts and so you can have larger waves, but not too large, or your computation times will be ridiculously high.

Tweak Parameters

First wave parameters.png
Wave with artifacts.png

Now it is time to tweak parameters so we get the waves we want. Enable Horizontal Displacement. This makes it so that waves can essentially push each other over. Mess about with the amount. Also mess about with the Wind Speed, Wind Fetch, and Ocean Depth. Keep the Ocean Depth high since we are simulating the middle of the ocean. Wind Speed and Wind Fetch make the waves larger. Make sure that your parameters aren't too crazy, or you might get weird artifacts in the ocean (visible as black spots or lines).

Add Finer Waves

First wave.png

Now that we have our coarse waves, we can add some more detail by adding a second layer. Go back to the BOSS editor and add another Spectral Wave. Make sure to start it at frame 1 as well. Tweak the parameters until you get something you like.

Cache

Boss editor second wave and cache continuously.png

Once you are happy with your waves, click the "Cache All" button to cache out all the waves and play out the simulation much faster. This prevents your computer from having to recompute everything each time.

Make the Water Look Like Water

Apply new material menu.png
Assign new material window.png
Material preset.png

Now we have a white plane that kind of looks like an ocean, but it needs to look like water! To do this, right click the plane, go to Assign New Material > New Material, and select an aiStandardSurface under the Arnold Section. Arnold is Maya's renderer, and we want to add a surface shader, so that is why we use an aiStandardSurface. Select the preset as "Deep Water". This will make the ocean look something like water in the render view.

Lights!

Add skydome light.png
Skydome light color select.png
Skydome light menu.png
Skydome in plance.png

We need to light the scene to actually see anything. To do that, we are going to use a Skydome Light. Find a nice, free HDR Skydome. These textures are large, 360 degree textures that are perfect for acting as our skybox. The one I used is in the Supplies section. I recommend one with minimal (but not zero) clouds and a clearly visible sun, ideally over the ocean. The clear sun will make very good sparkles on the ocean, and the clouds will make good reflections. Make sure you have some ground, since the ocean is partially transparent. If your texture has no ground, it will show as black. Add a Skydome Light, and in the Color section, set it to a File object, and select the HDR file you just downloaded. This makes the Skydome Light emit the color of the HDR texture, exactly what we want. Check the render view, and make sure everything looks correct.

Add Foam

Enable foam wave 1.png
Shader foam emission.png
Rendered, foam adjusted.png

The ocean is looking more like an ocean (albeit a weird one floating in space, but we'll get there). However, the ocean is still missing something critical: foam. To add foam, go to the first wave (the coarse waves) in the BOSS editor and enable foam. You'll want to reduce "Cusp Min" to reduce the amount of foam generated. Recache everything to generate the foam.

To actually see the foam, go to your surface shader for the water in the Hypershade editor. Under the Emission section of your water shader, set the first frame of the cached foam as the file input, and click "Use Image Sequence". You should now have some good foam in the render view!

Test Render

Render sequence menu option.png
All frames sequence render.png

Now is a good time to discuss how to do a test render. If you want to preview a step of your process, you may want to render out your entire project. To do this, you'll need to render a sequence. To do that, go to the Rendering workspace, and go to the render settings. Input your rendering settings and which frames you want to render. Keep the resolution low for test renders to save time. When you want to render the sequence, go to Render > Render Sequence. This will output a series of .exr files to whatever folder you specified. To view these, you'll need to use any free .exr viewer. I used Cinesync Play, as mentioned in the Supplies section.

Making the Ocean Bigger

Warning plane subdivision.png

We have a good looking ocean, but it is a bit too small. We could increase the size of our BOSS plane to something ridiculous, but that would be extraordinarily expensive in terms of computation time. Instead, we can take advantage of the fact that the cached wave files are just displacement maps (essentially, textures that tell the renderer how much to deform the geometry), and as such can be tiled infinitely on a much coarser mesh.

First, however, we want to get some very high-quality displacement maps. Make your BOSS plane very large (50x50 or so) and crank up the resolution to 1024. You'll get a warning, but ignore it. To avoid repetition when tiling the displacement maps, set the Patch Sizes of both of your waves to numbers that have a very high Least Common Multiple (like 79 and 101, for example). This prevents repetition. Also, increase the resolution to 1024. Cache the sim once you have everything dialed in.

Creating a New Ocean Plane

New plane for tiling.png
Create displacement as projection.png
Color as displacement.png
Place3d texture.png
Actual displacement.png
Projected 1st wave.png
Hypershade after tiling work.png

Create a new plane and scale it to the same size as the BOSS plane. Add a new aiSurfaceShader as its material, and make its present Deep Water as well. Open this shader in Hypershade and click Show Connections.

On the shader, under Displacement, add a file, but instead of clicking on the file item, right click and click "Add as Projection". Connect the color instead of the alpha to Vector Displacement of the displacement shader. In the file node, select the appropriate cache file and click Use Image Sequence. This tells the shader to use our displacement maps as actual displacements for the ocean texture.

Back in the viewport, there is now a Place3D texture. Rotate it so that is facing down (-90x) and set its scale in all axes to be half of the patch size of whatever the size of the waves generated the displacement map you are projecting.

To add the second wave, do the exact same thing, but add the two colors together using a ColorMath node.

For foam, do the same thing but insert it into Emission Weight in the surface shader instead of Vector Displacement. Additionally, for the foam, since it is non-realistic, the scale of the Place3D texture is not as important. Mess with it until you get a result you like.

Tiling

Arnold plane subdivide.png

Since the textures wrap, we can go ahead and scale the ocean up as large as we want. You can increase the subdivisions on the plane for more detail.

Fixing the Horizon

Arnold renderer fog.png
Distance fog.png
Render settings.png
Distance fog better.png

Our sim now looks a lot more like an ocean. Some things stand out, though. First, our foam obviously tiles. This is because we only have one foam texture. We can avoid showing the tiling by simply never raising the camera up high enough that the tiling can be seen.

Second, however, the horizon looks very off. That is because no matter how large our ocean is, it eventually stops, and that is visible. To fix that, we will add some distance fog, which will obscure the end of our ocean. To do that, go to the rendering settings, then go to Arnold Renderer > Environment > Atmosphere. Add an aiFog element. Set the normal to (0, 1, 0) to make sure that the fog falls off in the Y direction (up). Fiddle with the ground point, distance, and height until you get some distance fog that obscures the horizon, but not too much that you can't see anything.

Rendering Settings

Imagers.png
Lens effect settings.png
Render no lens.png

At this point, we can also tweak some rendering settings to make the render look better. Some subtle vignetting on the edges of the image along with some bloom on the sun to make it really shine would look great. To add these, go to the render settings, then go to Imagers and add an imager for Lens Effects. Add bloom (but not too much) and a bit of vignette. Play with the values and look at the renders until you have something you are happy with. (Ignore the boat in the photo, we haven't added it yet).

Boat Time!

Boat interior shader.png
Render no lens.png
Boat test render.png

It is now time to add the boat you saw in the last step. Find a nice model of a boat, or make one yourself. The one I used is in the Supplies section. Import it into the scene. You will have to scale it down, since as I mentioned before, the ocean is 100 times smaller than what it would normally be. Scale it down by a factor of 100 on all axes.

You may need to create a simple surface shader for the boat. Do the same thing as with the ocean, but leave the preset alone and for the color just put in the supplied texture file. My boat had many different texture files supplied (one for base color, one for glossiness, etc). Add those to the appropriate spots in the shader.

Fiddle with the parameters on the boat shader until it looks good.

Action!

Boat start.png
Boat end.png

Now, let's make the boat move. Go to frame 1 and put the boat where you want it to be. Click the "S" key to set a keyframe. Then go to the last frame, and put the boat at the end of where you want it to be, and click "S" again. You may have to go to the Animation Editor and make the animation curve linear so the boat moves at a constant speed. Click Play to see the resulting animation. This looks obviously unrealistic, since the boat doesn't bob at all, but we'll get to fixing that in a moment. First, let's add some wake.

Boat Wake

Wave solver properties.png
Boat geo properties.png
Boat wake generator settings.png

When boats move through water, they create a wake. BOSS has support for that. In the BOSS editor, add a Wave solver, then click the boat to add it as a geometry influence. Disable the other two solvers and hide your big tiled plane so you can isolate the wake. Change the resolution to about 10 times the size of the ocean plane, and adjust other parameters as needed to make the wake look good. Add some capillary waves for secondary effects from the wake. You may want to consider increasing the generator and collider offset to get the wake out in front of the boat. Cache the wake.

Boat Wake Projection

WrapUV texture disable.png

We will implement the boat wake as a bump map onto the main result plane. Add the wake as a cached projection just like everything else, and disable Wrap U and Wrap V so it doesn't tile. Adjust the Bump Depth to get the wake to appear as you like.

Boat Bobbing

Final boat outliner.png
Complete node setup.png

We have wake, but the boat looks terrible. It doesn't look realistic moving at all, and that's because it is moving in a straight line. Ideally, we want the boat to react to the waves. We will do this by adding 4 locators and placing them each at the boat's bow, stern, mid-left, and mid-right. Make sure to parent them to the boat so they move as required.

Next, open the node editor. For each locator, feed its world position and the out_mesh of the BOSS output into a closestPointOnMesh node. This returns, as you may imagine, the closest point on the BOSS mesh. Average the resulting Y positions together. This is the "average" height of the boat.

Subtract the left and right Y positions and the stern and bow positions. These are the two tilts (front-back, side-to-side) of the boat.

For each of those 3 values, have the following setup: Have a blendWeighted node and a frameCache node. Set the output of the blendWeighted into the frameCache Stream. Set the 1st input of the blendWeighted as the Varying output of the frameCache. Set the 2nd input as the value of interset. Get a subtract node and subtract 1 from time1 (the global time). Set this to the varyTime of the frameCache node. Set the weights for the blendWeighted to .5 and .5, but you can adjust as you like. The blendWeighted and frameCache setup helps smooth out the bobbing of the boat, so it is much less jerky.

Boat Bobbing Adjustment

Boat node movement fixed.png

Run the Y position that you calculated through an addition node to add some adjustable gain to the height (to make sure the boat is floating the right distance off of the ocean). Run the tilts through some multiply nodes to do the same (to make sure it is not tilting too much or too little). Feed the Y height into the Translate Y height of the boat node. Feed the stern - bow tilt into Rotate Z. Feed the left - right tilt into Rotate X. Play around with the gains to get the floating you want.

More Foam

Bifrost liquid solver.png
Bifrost emission region.png
Bifrost liquid props.png
Bifrost guide.png
foam properties.png
guide mesh properties.png
guide properties.png

If you noticed, you will see that the boat currently does not make any spray as it cuts through the water. To fix this, we need some more advanced foam simulation. We will use Bifrost Fluid Simulation to do this. Hide the big plane and enable the spectral waves in the BOSS editor. Reduce the subdivisions of the BOSS plane for performance. In the Bifrsot Fluids menu, create a new liquid solver.

Select the boat, then hold Ctrl and select the liquid container, and then go to Bifrost Fluids > Emission region. This makes the boat emit the particles. In the liquidProperties, change the master voxel size to 0.1. In the region properties, change the thickness to 2. You can adjust these values to get different foam.

To generate the foam only on the ocean, select the BOSS output and the liquid container, then go to Bifrost Fluids > Guide.

To prevent particles from being generated within the boat, select the boat and liquid container, and then go to Bifrost Fluids > Collider. Set the thickness to 0.05 in the collider properties.

Finally, to get foam, select the liquid container, then go to Bifrost Fluids > Foam. Delete the liquid object. Under foamProperties, increase the emission rate 10 times for more particles. Reduce the min liquid speed, min liquid churn, and min liquid curvature. Adjust to get the foam you want.

Under the guideMesh, reduce the velocity scale to 0.75, and under the guide properties, reduce voxel scale to 1.5. Run a test render and adjust as needed. Our scene looks pretty good now!

Camera!

Camera path.png
Camera motion curve.png
Rebuild curve.png
Curve adjust.png

We've gone a bit out of order (lights, action, camera), but let's get some nice camera movement going. We want to sort of follow the boat as it moves, but also pull up to see the ocean. Duplicate your perspective camera with Ctrl+D a couple of times and move them to the points along the path you want the camera to take.

Go to Animation and Curves, and click the "V" key to snap to points. Create a curve, and click on each camera in the path, in order, to make the curve. Hide or delete the extra cameras.

Go to Modeling, and select the curve. Click Curves > Rebuild and open the dialog. Add 10 spans or so for more points to control. Click F8 and click V to disable snapping. Adjust the points as needed until you are happy with the path of the camera.

Click Create > Cameras > Camera and Aim. Switch back to the Animation workspace.

Animate the Camera

Camera move render settings.png

Select the camera group and the curve you just created, then go to Constrain > Motion Paths > Attach to Motion Path. Add a locator as a child under the boat group, and put it in the center of the boat where you want the camera to aim. This will make the locator move with the boat. Select the locator and the aim of the camera you just made, then click Constrain > Point. Adjust the locator as needed to correct the aim of the camera. This will make the camera follow the path while aiming at the boat

Make any adjustments you need, then change the render camea in the render settings to the one you made and render the sequence to test.

Final Render

High res render settings.png

Once everything looks good, you'll want to crank up the rendering resolution for your last render. This will take a while. The render outputs a bunch of .exr files. Stitch them together in a software of your choice (I used Premiere Pro, but you can use any free one, like DaVinci Resolve) and voila! You have a completed video!

Marvel at Your Success

Floating Boat in Maya

Congratulations! You've made it to the end. That's not an easy feat. 3D work is tedious, and it can take days or weeks tweaking parameters to get the results you want. Take a break and marvel at your success.

By following along with this insutrctable you've learned:

  1. How to use Maya
  2. How to create an ocean using Maya's BOSS system
  3. How to work with textures in Maya to make your ocean and boat look good
  4. How to modify Maya's rendering settings to improve the quality of your render
  5. How to use Maya's Hypershade Editor to make the boat float and bob

If you want, try adding more things, like:

  1. Making the boat curve as it moves
  2. Adding another boat
  3. Making the clouds move overhead

You have all the skills to make realistic ocean simulations in Maya. The sky is the limit!