# Gradually flatten overlapping vertices on XY-Plane

I would like to connect plane with ocean modifier to a flat plane.

I m thinking to keep an x-distance overalapping and i would like to apply a weighted-average that will start moving gradually all vertices of ocean plane to the flat plane.

Does anyone know how that can be achieved?

In link below I have attached the blender file. https://files.fm/u/rty9tnrz3

P.S I would like to use this technique for animation purposes

You could select all vertices along the rightmost edge of the ocean, activate proportional editing with a sufficiently large radius and scale to zero in Z-direction. (Will try to post screenshots later, if necessary!)

In case you want to keep the ocean modifier, you might be interested in using the lattice modifier

With the lattice vertices scaled to zero height at the right side, the ocean will gradually lose amplitude towards the right. Use the "linear" interpolation to get it totally flat on that side.

• Would that method could apply even when the ocean changes with time? A quick screenshot would be very helpful! Thanks!! Jan 13, 2021 at 12:36
• Wow that's awesome!! Thanks alot for sharing!! Jan 13, 2021 at 13:46

Method 1 : Applying the ocean modifier first

In edit mode, select your whole mesh, create a Vertex Group and assign a weight of 1 to everything.

Create a plane which you will hide later that is at the same height as your beach plane. Create another plane with the same width as your ocean mesh.

In your ocean mesh, add a Vertex Weight Proximity modifier, set the vertex group to the one you just created, set the target object to the strip, set the proximity mode to geometry and SHIFT - Click and drag on Vertex, Edge, and Face to select everything. Set the falloff accordingly to your prefered method of interpolation.

Set the Highest to 0m and increase the Lowest value. You might have to come back after the next step to increase or decrease it to get the desired effect.

Now add a shrinkwrap modifier, set it to project along negative and positive Z on the target plane and set the vertex group.

Now hide the two planes. Here's the result with and without the shrinkwrap :

Here's how to tweak the settings :

Method 2 : I found a workaround to keep the ocean modifier alive. It is kind of a hack. But I don't really understand why we can't use vertex groups in a Vertex Weight Proximity if they have not first been initialized on the mesh with a weight of 1. Seems like an oversight unless I'm missing something.

So, before adding the Proximity and Shrinkwrap modifier, you need to add 3 modifiers : Ocean, Solidify, and Mask. The actual settings of the ocean are irrelevant here.

The idea is to take advantage of the fact that since Version 2.83 you can set a custom vertex group for the shell resulting from a solidify modifier. We are then masking all the vertices that are not part of that shell, since they will not get affected by the shrinkwrap.

Result :

Method 3 :

Just thought of another method with a simple lattice. Keep your ocean modifier and add a lattice. Scale it in Object mode so that it is slightly larger than your ocean mesh.

Go into the lattice settings and reduce the V to 1 and increase the U to something like 30. You should have something like this for now :

Go into edit mode with the Lattice selected, activate proportional editing with O or click there :

Select the top and bottom points of the last 3 or 4 columns of your lattice, and scale along Z by 0 (S - 0 - 0). Scroll the mouse wheel a few times to get this kind of shape :

Go out of edit mode, select the Ocean Mesh, and add a Lattice modifier. Set the lattice object to the one you just created. You might have to input a value > 1.00 to get a good smoothing (I don't know why...) so that the end of the ocean is almost perfectly flat.

Result :

• Hi @Gorgious and thanks for your very detailed answer!! If i apply the ocean modifier wouldn't that also mean that my ocean will freeze in an animation? Jan 13, 2021 at 12:45
• I updated the answer with a possible solution to keep the ocean modifier Jan 13, 2021 at 12:59
• Amazing Gorgious! Love it! Thanks!! Jan 13, 2021 at 13:55