Custom Waves Using Gerstner Wave Function (read notes very important)

Notes:

  • Please submit bug reports by commenting below, thank you.
  • I am not using Gerstner Waves (woops), but I am using sin waves. (Sorry will fix soomTM) - Maybe fixed
  • Working on foam.
  • Thinking of creating some sort of code where it unloads bones the farther away they are - For performance & looks reasons.

I would like to share my work on creating custom waves, so you do not have to take 2 days to figure these out. Also, I will explain how I made it. (magic)

Video of my creation:

Link to model on creator marketplace:
Custom Wave Using Gerstner Waves - Creator Marketplace (roblox.com)

How I made it:
I found information on how to do this just by looking up key words. I eventually came to this devForum page:

That only told me how to make the mesh with bones, so I had to code it myself.
This youtube video here:

Explained everything I needed to know after a couple rewatches.
I just played around with different combinations of math functions and code until I got what I currently have. Anyways, enjoy having custom waves without the hassle!

Change log:
9/22/23

  1. Changed some logic - maybe it’s using the gerstner wave function now?
  2. Added a tag (“wave_drift”) that can be used to makes objects float in the water.
  3. Added code to make objects float in the water.

8/31/23

  1. Added displacement in the x and z direction.
  2. Added 2 more textures.
  3. Changed the way textures are animated for a more realistic look.
18 Likes

thanks for making this! was looking for solutions to gerstner waves on ROBLOX for a long time, and I’ll have a mess around with your model now :slight_smile:

1 Like

Great contribution!

Also…

Find the Y value in a X,Z position?

Could you explain further on what you mean by that?

1 Like

Oh, sorry.

Say I have any given object. Using its X and Z position values, how can I determine the Y value that corresponds to its position in the water?

I just added up the x and z results in the script, note the current model does not use the gerstner wave function (woops) but I am working on it.

how optimized is this? just wondering

Optimized enough to run easily on my phone.

1 Like