Realistic Oceans Using Mesh Deformation!

My apologies for the delayed response, you can do this by using this as the time element


1 Like

Sorry for bumping, but does anyone have a way of getting the height of the water at a x y pos?


The post you found is discussing a method for making water appear to float on a mesh in a Roblox game. Here’s a breakdown of what the instructions mean:

Find 4 points: You need to identify four points on the mesh where you want the water to appear. These points should form a shape that can be used as a reference for the water’s position.

Make your point fit inside them: Once you have the four points, you need to ensure that the point representing the water is contained within those points. This step is necessary to ensure that the water is confined to the desired area on the mesh.

Narrow it down to 3: From the four points, you need to select three points in such a way that all three points are on the same side of the triangle formed by those points. This step helps establish a plane on which the water will float.

Use interpolation between those 3 points: Interpolation is a mathematical technique used to estimate values between known data points. In this case, you’ll be using interpolation to determine the exact y-coordinate (vertical position) of the water’s surface based on its x and z coordinates (horizontal positions) within the triangle formed by the three selected points.

By following these steps, you should be able to create the effect of water floating on the mesh in your Roblox game.

1 Like

Hey, do you perhaps know why your Gerstner function is returning NaN

Because it is for me, and I’m trying to make floating things with it.

Here is my code:

for _, v in pairs(workspace.Floating:GetChildren()) do
	local transform, point = self:GerstnerPoint(v.Position)
	v.Position =, point.Y, v.Position.Z)

Here is what it is printing:


	WaveLength = 50,
	Gravity = 1.5,
	Direction =,0),
	FollowPoint = nil,
	Steepness = 0.3,
	TimeModifier = 2,
	MaxDistance = 1500,
1 Like

this ended up being exactly what I did and it worked perfectly :pray:

No biggie I am super glad I could help you

1 Like

Is there a way we could get this to run on a server script instead of a client?

wouldn’t it just put stress on the server and wouldn’t be that smooth?

Run visuals on the client, and only some logic to sync clients (just use workspace:GetServerTimeNow()), and float server-owned physics objects on the server.

When you move the waves on the client, you have the added advantage of being able to not animate bones that are to far away. Saving on calculations.

As far as the server is concerned, the sea should just be a flat plane. The server (and client!) can get a wave height approximations by plugging into the gerstner wave formula twice.

I wanted to replicate something like this since I’m working on a boat game. ocean ROBLOX [Progress 1] boat and infinite mesh deformation ocean - YouTube

But im lowkey clueless on where to start if I wanted to do this

This resource is definitely a good starting point.
I can also recommend YT-videos, or internet articles about gerstner waves (not necessarily about roblox!).

But be warned that it’s a pretty complicated subject.

Once you have a basic working system, the fun starts! Optimization!
The waves should be moved on the client. I found using a custom interpolation method to be much faster than TweenService for moving thousands of bones. As you should limit the amount of calulations every frame.

For boat movement, I found a BodyGyro, BodyPosition and BodyForce to work best for network receive rate. Having 4 forces to tilt the boat is expensive, the bodyGyro can handle tilting. Just get the waveheight at 3 positions, and construct a CFrame that goes through those positions.

1 Like

is there a way to scale this down without ruining the bones or anything else?

Hey, could you give me a code example. I’m honestly confused on how to do that.


anyone still have the model? original one got deleted :frowning:

I’ve tried to use this, but it makes remote events lag out the entire client ( I have no idea why). Is there a possible fix for this?