Making Dynamic Ocean Using Mesh + Bones

Hello, I’m making an Ocean Using Mesh and bones but I have a slight problem. The waves lag only in game, In studio it seems perfectly fine.

I’ve seen other people use a technique where the Mesh and bones only become visible when you get close enough to it.

Does anyone know how to do this? Please help.

Example of what I believe happens in this game (I think the game renders chunks only when the player is a certain distance away to prevent the bones from lagging)

1 Like

You could use Lighting.Fog it might help with lag a bit.

1 Like

That would only help conceal some of the unwanted effects by limiting the players vision making it harder for them to notice

That is true. So you might have tried this but dont animate the ocean in Server script. Have a table that stores points of area from the ocean in a table, loop through the table and find which one is closest, and animate that section of the ocean in the LocalScript.
Each point is for a part of the ocean.

1 Like

You could also try setting the parts a player cant see to server using network ownership maybe.

I’ll try this, I did some more research and found that a method some people use is Fustrum Culling, I have no idea how to do this… [Roblox] Frustum Culling Visualized - YouTube

That is actually pretty cool.
To set it up u I think this function could help

So if you could find the four corner’s of the player’s screen and set a specific length of how much of the ocean the player can see.

you can use this to visualize the rays.

Oh yeah, thanks i will go check it out.

I’ve created something, but its limited. The Ocean waves work, and it renders with the players Camera using the Fustrum culling method. The small problem is if i go over 5000 Chunks in the workspace (not enough) The CPU goes insane, and when a player joins they’re screen freezes For 5 - 10 minutes.

Hmm maybe add a loading screen and once all the chunks are accounted for destroy the loading screen.

Good idea! Hopefully this will work! (It would be nice if I could reduce the time to less than 5 minutes though)

Render the waves on the client and sync your function with workspace.DistributedGameTime

I render bones based on the parent mesh’s distance and bone’s distance from the character/camera. I also reduce render time the further out the bones are and stop at a certain distance. Distant bones that are able to be animated are also only animated if they are visible to the camera.

Still needs some work with characters floating on the surface but here is an example:

1 Like

This is amazing! Is it uncopylocked? if not I’ll try it myself.

I’m on mobile rn. So I can’t tell.

Can you send me an Open Source Version of the game? I’m ha img a lot of trouble creating it.

1 Like