Custom water with Gerstner Waves and Animated Texture + Boat Physics

Hey there,

I had quit roblox for the past 3 or 4 months (maybe less, maybe more, no idea of the exact count) but I’ve decided to be back for now.

I was working on custom water before quitting, but I’ve just rejoined ya’ll and I found out that my water still works, why not showcase it. Yesterday I fixed some of the bugs and added an animated texture, hopefully you all will like it :smiley:

Technical stuff:

  • Boats rock on water (both side to side and back and forth) and will float according to the wave

  • Gerstner wave formula with 3 gerstner waves combined

  • All waves have an attribute based setting so that I can modify the wave stats without opening the script

  • Uses mesh deformation to work. All vertices of the plane update under 1.5 or 2 milliseconds depending on your computer. LoD implemented too: vertices will not update if they are 400 or more studs away from the camera. This value can be changed easily. Total vertex count: 1089

  • Multiple ocean meshes can be combined for larger oceans.

  • ColorCorrection and Atmosphere effects applied when the camera goes below the water.

  • Animated texture to replicate roblox terrain water visuals as much as possible.

  • Boat driving + spawning system

  • Time took to complete all this: approximately 20 or 30 days.

  • Looking forward to implementing a character swimming system.

Videos and Photos:

(Please let me know if they are not loading)

2022-04-23 (2)


Please give your feedback! Thanks and have a great day!

15 Likes

Videos aren’t loading! Can’t see any!

They seem to be working on my end, try using a vpn or reloading the page

1 Like

how did u do that? please make a tutorial!

1 Like

Unfortunately I dont have enough to time to do that.

I used the formulas at this page:

2 Likes

This looks really cool, I tried doing similar stuff before but never got it working and most of them were not very performant (especially when trying to make a infinite like ocean)

1 Like

What was the process like for summing together the three waves? In my own project, I’ve managed to get the formula to work, but the size of the observable water is usually (size of the plane * no. of waves)

Unlike in the catlike coding tutorial, where the position of each vertex is added to in steps, I tried summing them together all in one go. Were you able to come up with a better solution?

Nope,


Also use dark mode :skull:

It probably might be because u are using bone.CFrame and not bone.Transform. There is a significant between the two and to make your code work with transform you might have to do a good bunch of changes. Try it if you have the time, other than that I cant see anything else. The wave size doesnt increase with wave count in mine though.

1 Like

That’s great! Looks really cool
Also would you mind sharing the code? Or could I message you somewhere (Discord)? I know it took you long enough to say no but I’ve been struggling with wave physics for almost two weeks and can’t figure out how to make them properly… :confused: Waves are working but anything on them still won’t float.

Hey man sorry for not replying i wasnt active on devforum.

To place the boat on the waves i used a bodyposition, and then sampled wave height at the boats position and entered it into the bp to move it there. it uses the same function used for making waves otherwise it will be desynced.

I have 4 attachments at the right, left, rear, and front ends of the boat. i sample height again at these atts and then use this to angle the boat

local xVector = (bowPos - sternPos).Unit
local zVector = (portPos - starboardPos).Unit
local yVector = zVector:Cross(xVector)

gyro.CFrame = CFrame.fromMatrix(Vector3.new(), xVector, yVector, zVector)
3 Likes