Skip to content
Home » Boat Floating on the Waves – The Shrinkwrap Modifier in Blender

Boat Floating on the Waves – The Shrinkwrap Modifier in Blender

Spread the love

Today we’ll be talking about the shrinkwrap modifier. I’ll demonstrate it on an example of a boat floating on waves. The boat is supposed to move along with the waves, in the same rhythm. I will use the ocean modifier to produce the waves. In this project I’ll be using the 2.90 version of Blender.

Here’s the video version of this article:

So, let’s get started. Here are the steps to follow:

Step 1 – Add an Ocean Modifier

Start by saving the file, which is good practice, I think. You can leave the default cube because the ocean modifier will turn it into a plane anyway. Then go to the modifiers tab and select the Ocean modifier:

Step 1 – Add an Ocean Modifier

Step 2 – Set the Ocean Animation

To see the waves moving, we must animate the waves. Let’s start by setting the End frame on the Timeline to 480 (A), which, at the default frame rate of 24 fps will correspond to 20 seconds.

Go to frame 1 and add a keyframe (by hitting I) over the Time property. Then go to the last frame, set Time to 20 and insert another keyframe (B):

Step 2 – Set the Ocean Animation

Step 3 – Open the Graph Editor

The animation starts slow, then it accelerates (A) until it reaches its constant speed and at the end it slows down again (B). This is because it’s using nonlinear interpolation. We don’t need the acceleration and deceleration effects, so let’s change the interpolation type to linear. You can do it in the Graph editor, so switch the Timeline editor to the Graph editor:

Step 3 – Open the Graph Editor

Step 4 – Change to Linear Interpolation

To change the interpolation to linear, go to the Key menu, then Interpolation Mode and select Linear. Now the speed is constant:

Step 5 – Play the Animation Again

Switch back to Timeline and play the animation again. Watch the beginning and the end of the animation. There’s no acceleration or deceleration now.

Step 6 – Add the Boat

Now that we have the ocean, we also need a boat. It’s going to be a very simple one. Let’s add a UV sphere, move it up (G Z 2). and scale (S Y 2). Here’s what it looks like:

Step 6 – Add the Boat

Step 7 – Model the Boat

Go to edit mode, wireframe shading, front view. Select the upper part of the boat and delete the vertices:

Step 7 – Model the Boat

Step 8 – Add the Solidify Modifier

Back in object mode and solid shading, in the Modifiers tab (A) click on Add Modifier (B) and select the Solidify modifier. It will add some thickness to the boat. Set Thickness to 0.05 (C):

Step 8 – Add the Solidify Modifier

Step 9 – Apply the Solidify Modifier

Click on the down arrow and select Apply to apply the Solidify modifier:

Step 9 – Apply the Solidify Modifier

Step 10 – Select the Vertices for the Boat Floor

Go to edit mode, top view and select the vertices in the middle:

Step 10 – Select the Vertices for the Boat Floor

Step 11 – Collapse the Vertices

With the vertices selected, go to the Mesh menu, then under Merge select Collapse:

Step 11 – Collapse the Vertices

Step 12 – Flatten the Floor

In right view, wireframe shading, move the selected vertex (now there’s only one because they all collapsed to it) and move it up:

Step 12 – Flatten the Floor

until you can’t see the selection anymore. This means the floor is now flat:

Step 12 – Flatten the Floor

Here it is in solid shading and from a different angle:

Step 12 – Flatten the Floor

Your Panda3D Magazine

Make Awesome Games and Other 3D Apps

with Panda3D and Blender using Python.

Cool stuff, easy to follow articles.

Get the magazine here (PDF).

Step 13 – Finish the Boat Model

Go to object mode and select Shade Smooth from the Object menu:

Step 13 – Finish the Boat Model

This boat maybe isn’t perfect, but it’s OK for our example.

Step 14 – Put the Boat on the Water

In front view move the boat down (for me G Z -1.4 works fine). The bottom part of the boat should be under the sea surface.

Step 14 – Put the Boat on the Water

Step 15 – Play the Animation with the Boat on Water

If you now play the animation, the boat won’t budge. What’s even worse, the water will ‘pour’ into it from below from time to time. This doesn’t look realistic.

Step 15 – Play the Animation with the Boat on Water

Step 16 – Add a Plane

This is why we have to do something about it. Before we go on to the next step, let’s move the boat to the left (G X -5).

Step 17 – Add a Plane

We’ll add a plane, add the Shrinkwrap modifier to it so that it takes the shape of the surface of the ocean and then we’ll make the boat move along with it.

So, add a plane (Shift + A -> Mesh -> Plane) and move it up a bit so that it’s slightly above the sea level:

Step 17 – Add a Plane

Step 18 – Subdivide the Plane

With the plane selected go to edit mode and subdivide it. You will find the Subdivide option in the Edge menu (A). Then set the number of cuts to 3 or 4 (B).

Step 18 – Subdivide the Plane

Step 19 – Add a Vertex Group

We’ll need to assign a vertex group to the plane, so make sure the plane is selected, go to the Object Data tab in the Properties editor (A), hit the plus sign button (B) to add a vertex group and hit Assign (C).

Step 20 – Add the Shrinkwrap Modifier to the Plane

Go to object mode (A). Just for the sake of clarity, rename the Cube and Sphere in the Outliner to Ocean and Boat respectively (B). Now go to the Modifiers tab (C) and add a Shrinkwrap modifier to the plane. Set the Ocean as the target (D) and make sure Snap Mode is set to On Surface (E). With that done, you will see the plane attach itself to and take the shape of the nearest surface, which is that of the ocean:

Step 20 – Add the Shrinkwrap Modifier to the Plane

Python Jumpstart Course

Learn the basics of Python, including OOP.

with lots of exercises, easy to follow

The course is available on Udemy.

Step 21 – Play the Animation Again

If you now play the animation again, you’ll see that the plane is now moving along with the surface of the ocean:

Step 21 – Play the Animation Again

Step 22 – Add a Copy Location Constraint to the Boat

Select the boat and go to the Object Constraint Properties tab (A). Add a Copy Location constraint and set the target to the plane we just added (B). Then set the Vertex Group to the group we created (C):

Step 22 – Add a Copy Location Constraint to the Boat

Step 23 – Play the Animation Again

If you now play the animation, the boat will be moving along with the ocean surface.

Blender Jumpstart Course

Learn the basics of 3D modeling in Blender.

step-by-step, easy to follow, visually rich

The course is available on Udemy and on Skillshare.

Step 24 – Add a Copy Rotation Constraint to the Boat

We also want the boat to rotate along with the waves. So, with the boat still selected, add a Copy Rotation constraint and set the target to the plane (A) and the Vertex Group to the group again (B):

Step 24 – Add a Copy Rotation Constraint to the Boat

Step 25 – Move the Boat Up

Now, with the location constraint, you won’t be able to move the boat like you usually do. The boat is now too deep in water, we must move it up. To do that, go to edit mode, select all (A) and move the boat up so that the bottom part of it is under water but most of it is above the water:

Step 25 – Move the Boat Up

Step 26 – Animate the Location of the Boat

Go back to object mode. Now we want the boat to float from one place to another. To do that, we should actually animate the plane it’s attached to. So, select the plane and move it to the back (G Y 6), then go to frame 1 and add a Location keyframe (I -> Location):

Step 26 – Animate the Location of the Boat

Step 27 – Add Another Keyframe

Go to the last frame, then move the boat to the front (G Y -15) and add another Location keyframe (I -> Location):

Step 27 – Add Another Keyframe

Step 28 – Change the Interpolation Mode

We want the movement of the boat to be linear, too. So, let’s switch the Timeline editor to a Graph editor for a while and in the Key menu, under Interpolation Mode, select Linear:

Step 28 – Change the Interpolation Mode

Step 29 – Play the Animation

Switch back to the Timeline editor and play the animation. Now the boat should be moving from a distance toward the front of the scene, floating on the waves:

Step 29 – Play the Animation

Step 30 – Add Some Basic Materials

Although it’s not extremely important for this tutorial, however let’s add at least some basic materials to the ocean and boat (A). So, select the ocean, add a material and set its base color to any color you like. I set mine to hex 117175. Then select the boat, add a material and set its base color to any color you like again. I set mine to hex 503D1E. We don’t want to see the plane to which the boat is attached, so select it and click on the eye icon (B) next to its name in the Outliner. This will hide it in the viewport. To see the changes, switch to rendered shading (C):

Step 30 – Add Some Basic Materials

Step 31 – Let There Be Light

The scene is pretty dark. We could add a light or multiple lights, but for our purposes we’ll just set the world color to a light shade of blue. So, go to the World Properties tab (A) and set the color to hex B3F5FF (B):

Step 31 – Let There Be Light

Step 32 – Make the Ocean Bigger

Let’s make the ocean slightly bigger. The easiest way to do it is go to the Modifiers tab and in the Ocean modifier set the Repeat X and Y values to something bigger, like 3 for example:

Step 32 – Make the Ocean Bigger

Step 33 – Make the Waves Bigger

The ocean is pretty calm. Let’s make the waves bigger. In the Ocean modifier, under Wave, set Scale to 2:

Step 33 – Make the Waves Bigger

Step 34 – Turn Off the Overlays

Press the Show Overlays button to toggle off all the overlays, so all the helper lines, outlines, axes, the grid, etc., so everything that helps us move around the scene, but is not itself part of the scene:

Step 34 – Turn Off the Overlays

Step 35 – Play the Animation

We’re done. Play the animation and watch:

Step 35 – Play the Animation


Spread the love
Tags:

Leave a Reply