Dynamic Wave Simulation

I’ve been curious to know how I could create a wave system like the one found in Fishing Simulator.

What are the optimization tricks to maintain such a performant wave system? Do they use mesh deformation? What math formulas should I learn to accomplish this?

MedalEncoder_jr3v0BvnUy

I would also like to know how I can use these waves to affect objects like boats etc.

2 Likes

This is done using math.noise and mesh deformation

2 Likes

Interesting! How would I be able to affect floating objects on water with this? Im curious to know how dynamic occurences such as heavy objects dropping in water would also work in creating ripple effects

I suppose for ripple effects it not that hard but for floating I am not really sure. I suppose you can view this? How to make swimmable part

Realistic Oceans Using Mesh Deformation! I found a tutorial for the exact thing.

2 Likes

Ah I see, thank you for your help! I’ll come back to this thread to post progress and findings for anyone else who’s curious :eyes:

After a bit of research I found these resources:


Skinned Ocean Mesh Tutorial:

Ocean Waves Resource: (thanks to @.jacktystlc)


Here’s two of my theories for this:

How can we make ripples?

The skinned wave mesh comes with hundreds of bones on a 2048x2048 plane. We can make ripples by mathematically detecting when an object comes into contact with our water. When we detect this, we want to find the nearest bone(s) to the place of impact and sink them to create that ripple-like motion. Then, we can have this effect apply to nearby bones up to a certain point.

How can we make infinite water?

This post by @.iamtryingtofindname is helpful because it allows us to “infinitely” have running water. To do so, we would have to place a pre-set amount of water planes, and then dynamically move bones around our character at a certain distance to give the illusion that the water is infinite.


More findings will come later if any ^^

As promised, I found a solution to my question by searching around and I am sharing the trade secrets to a performant Mesh deformation Gerstner wave implementation!

:warning: BEFORE YOU READ :warning:

I need to give a HUGE thanks to the following links for being so helpful as I
have NEVER used blender before, but I was able to achieve a professional intended
standard by using these resources:


Important Links:

Important Notes:

  • Higher amounts of Bones make your waves look nicer at the cost of performance for every CFrame operation with your Quadtree’s (if you use them).

  • Gerstner waves are created by using Tchodial Waves. This is common practice for any engine as a graphics performance.

  • When making floating ships, you likely want to use 3 points of contact instead of the 2 points of contact found within the original ModuleScript to avoid waves from overflowing your ship. (this doesnt do anything, but it does affect how boats visually appear which can look buggy to users)


Educational Sections

Section I (Programming)

After deciding to make a seas game with realistic water, I decided to go on a search for optimized Mesh deformation solutions that were performant and worked as intended. I ended up stumbling across a post by @iamtryingtofindname who implemented an effective performant Tchodial wave module that used Gestner waves to deform an ocean mesh for a realistic wave simulation.

Excited, I downloaded the RBXM file and I imported it into Roblox Studio. After playing around with it for a bit, I knew I had to upscale the module as it only supported preset waves that were synced upon startup. Unfortunately, manually placing dozens of heavy mesh deformation MeshParts with hundreds of bones would significantly impact
performance.

With the mesh deformation part out of the way, I decided to come up with a Quadtree solution that would plant mesh deformed MeshParts on a grid-based system which would only use up to 9 waves. This was a significant factor as it cut both
my manual development labor down significantly and would become more effective than placing each wave mesh manually without impacting performance. After completing this implementation, I was left with a consistent 210-220 FPS+.

Section II (Blender Mesh Deformation)

After perfecting my code (for the time being of course haha), I decided to invest some time into making my waves look better. The original mesh from @iamtryingtofindname’s resource was nice, but I wanted to go for something that fit my game’s style better. If you look in the original scripting resource for Gestner wave’s, you can find @twiceLanguish’s tutorial for custom Blender meshes. Unfortunately, I was totally unexperience with Blender, so I took a substancial amount of wrong turns and a handful of confusing situations that got me nowhere.

Eventually, I was able to create my own mesh deformation texture which makes my ocean pop a lot more! The texture originates from a mesh in the toolbox that I cant seem to find, but the ID is here if you need it: [rbxassetid://6196053948].


Conclusion

Anyways, to wrap this up I ABSOLUTELY recommend that you guys also take this journey to find your own Gerstner wave solutions! I definitely learned a lot (and crashed my computer twice making bones… :cry: ) and I found it very fun to do so!

5 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.