Performant, Procedural, Physics Based Skinned Mesh Ocean and Buoyancy Simulation!

Since the introduction of skinned mesh deformation and having further been inspired by tyridge77 's post I started working on my own skinned mesh ocean system.

Over the course of 2 years, on and off, I have continued to improve and refine this system, hoping to turn it into a passion project.

Today, I am excited to share with you the various physics-based interactions with Wind, Sea, and Sail that I’ve developed!



(Sails facing against the wind while raining)


Of the entire system I have a few things I want to showcase specifically here!

  • Procedural Skinned Mesh Ocean System :ocean:
  • “ShipAlign” Character Handling :person_standing:
  • Real-Time Physics Wind Based Sails :wind_face:
  • Ship Buoyancy Simulation :sailboat:
  • The Endless Horizon! :sunrise:
  • NPC Handling :person_cartwheeling:

There are a lot of attachments so I separated them into categories for your convenience.

More Attachments

Procedural Skinned Mesh Ocean System!


Real-Time Physics Wind Based Sails

Sails are also skinned meshes! By using parabolic equations, we can offset these bones based on the wind. We can also use these bones to raise and lower the sails!





Note: Both the waves and the sail displacements are computed in parallel to maintain under 1ms a frame in total :slightly_smiling_face:

"ShipAlign" Character Handling

Something I hated experiencing was not standing correctly on the deck of the ship. It took some time but with a lot of CFrame operations I was able to correct the stance of characters and their cameras accordingly.


(Before ShipAlign)

(After ShipAlign)

NPC Handling on ships

Using the same system above, ShipAlign, I was able to let NPCs pathfind onboard a dynamic ship in order to perform tasks for the player!

Ship Buoyancy Simulation

You might have seen the spheres and blocks inside the featured galleon; these are actually used to calculate the displaced volume and apply an equal force to raise the volume upwards!




It’s a little hard to showcase the buoyancy exactly, but look at it go up that wave! (Also, weight distribution is a pain, don’t judge me!)

The Endless Horizon!

Utilizing a combination of atmospheric effects, and multiple levels of detail for the water, the water smoothly transitions into the atmosphere!



Credits:
Atmosphere and sun movement
Screen Rain
Wind Lines
I could not find the original creator for the galleon model I used, if you know the original creator please let me know!

14 Likes

Hey! This simulation is impressive and I don’t have words to express my fascination, I can’t make myself with physics haha. Keep up the good work and wish you luck!

2 Likes

Yo, im trying to make something similair using vectorforces.
Firstly, is that similair to your strategy? could you give some insight on your bouyancy mechanics?
secondly, are you replicated the waves clientside? Im doing the tiling method for infinite oceans that causes no lag, but i feel like it make a slight disconnect between server and client which bothers me :frowning:

1 Like

wait, second question. you are using bones to deform the mesh right??? cuz if roblox added vertex manipulation that would be AMAZING but i havent seen it

1 Like

There actually IS vertex manipulation. Though im unsure if it useable in a live game or not. I plan to switch over to that so I can add dynamic level of detail to the wave resolutions.

Currently, yes, I am using bones to deform the mesh ocean.

The server doesn’t know where the waves are, but instead uses a planar equation and the position of bones (which are always arranged in a predictable grid) in order to find the height of the waves at any position in the worl.d.

First, with buoyancy, the entire ship is made massless except for a large yellow box who’s density is modified in order to achieve a certain weight for the ship. Secondly, the ship uses vector forces located at the cylindrical spheres to apply force equal to the amount of displaced volume of water (who’s density can be modified).

Also as for disconnect versus client and server, Ive never had this issue. Ive always used workspace:GetServerTimeNow().


(Old Picture)

I do recommend though, making sure your height lookup functions take into account the spacing between bones. As unless you have an ocean of infinite bone resolution, the spacing between them is a straight line unlike what is seen in a Gerstner wave, though you could also modify the equation itself to take this into account. This could be the reasoning behind the slight disconnect between client and server (X,Z displacement not being taken into account in height lookups)

Hope this helps!

1 Like

I see that you put a lot of Effort in this game and the Details are great.

2 Likes

This is just the ocean and sailing system :slight_smile: I may make a post about our for-honor like fast-paced dueling system, Dynamic NPC system, or cannon system. But those posts are a WIP :slight_smile:

2 Likes

really? could you link some docs on that? i just spend 20 minutes looking and i see nothing on that. that would be really cool if so cuz u could make some seriously cool waves.

when you say volume of water, what do you mean? My water parts are intangible and are planes with bones…

wait, i think we did it differently. for me, the client generates the waves, the server doesnt. that way its literally infinite with low overhead.

Yep, server doesnt own the waves but knows the heights using a lookup function (the planar equation i mentioned earlier).

My water is also intangible. By “volume of water” im referring to the amount of volume of the ship that is submerged, which is equal to the amount of water displaced

Here you go!

Oh wow, this is brillint im going to remake me ocean around this later lol. One new question: i figured out the whole boyant sphere based engine thing, the problem is that if i font lock its orientation using a bodygyro, it starts bouncing around like crazy. Im curious, fo you use a bodygyro to orientate the boat to the waves, or did i do something wrong?

Nope. The boat is self balancing due to the buoyant forces located around the ship. If one side dips too low below the waves then a stronger force is applied to push it backup.

Thats strange because mine flip flops around… also for some reqson its smoother when the yellow box is massless

How do you animate the bones? Is it done all by scripting - if so how?

Its done by scripting, using a formula…

Not to nitpick, but… isn’t the first one actually more realistic? You naturally orient yourself to stand “straight up” on a boat or ship… The character with ShipAlign enabled would be constantly falling over.