Realistic Ocean Showcase

I started seeing a few examples of realistic water using mesh deformation, and decided to see how far I could push that concept. Here’s the result:

Roblox Oceanic

And the game itself:

https://www.roblox.com/games/77019283/The-Ocean-Experience

I saw a few other developers making shallow ocean looking waves. But I wanted to see large, slow-moving swells that appear to have mass.

The water is dynamically optimized for performance, so feel free to play it on your phones, tablets, or Xbox as well! (Just turn up your graphics to get the experience.)

70 Likes

How do you get the ships to go with the waves at an angle?

1 Like

It measures the height of the waves at multiple points along the hull of the ship, then does a bit of math to figure out the angle from there.

2 Likes

How do you make the waves move???

It’s stated in the beginning of this post. He used mesh deformation.

How would it measure the height of the waves?

Finding the height of a wave at a point is actually pretty complicated. Since the equation for the waves moves each point on three axis, it takes more than just solving for the inverse.
I use an iterative technique to solve a system of equations that yields the Y-coordinate elevation at a given (X,Z) coordinate.


For those interested in the math:

Suppose we use the equation f(x,z) = (x’, y’, z’) to generate our ocean. It maps a coordinate on a plane to a coordinate on the surface of a wave.

We want to find the height at a given point. That is, we want to find the y’ value for a given the (x’, z’) coordinate. Unfortunately, our equation can’t give us that explicitly. We can’t simply solve our equation for y’ because the result gives us infinitely many solutions. We have an equation with five variables, we know two, x’ and z’, and we’re trying to solve for one, y’. It doesn’t work.

Fortunately, each of our infinitely many solutions are at a local maximum near (x, z), because f(x, z) only displaces (x’, z’) by a small amount (i.e. the waves only move by a small amount horizontally). So, using an iterative gradient descent algorithm, we can find the values of y’, x, and z that satisfy f near (x’, z’).

We can do this by starting with a guess. Say, x1=x' and z1=z' as our first guess. Then plug that guess into f to get a new (x", y", z") coordinate. Given how that coordinate compares to our initial guess, we can make a new better guess, (x2, z2), and plug it in again. Keep doing this until the outputs (x", z") are very close to the original (x', z'). The resulting y" in the vector is the elevation at the point (x', z'). In other words, f(x',z') = (x", y", z").
5 Likes

The showcase looks amazing! I love how realistic the water looks, the models (ships and oil rig) also look amazing.

The water looks plasticy and seems more like a solid than a liquid, this image is base Roblox water you can generate in Roblox studio.

image

The water’s motion looks unnatural, real water should look a bit more like waves overlapping each other.

Water

Other than that it’s decent for movement in water.

unfortunately due to limitations on how PBR works the overlapping of water and movement of micro-waves on the surface isnt really possible. however i agree it needs to be more shinyyyyy

i was using the speedboat and it was constantly going under the water, i think you need to increase the bouyancy, also add more points where it calculates the height of the water. otherwise this is actually quite nice. i have some nice boat models i can donate if you’d like.

do you have any plans of making this open source?

2 Likes

I don’t have plans to make this open source currently.
I’m planning on using it for an actual game in the near future, so I don’t want to give it away.

1 Like

Sea of Thieves when?

Honestly, this is really cool. Lovely job!

oh if thats the case then sign me up to be a tester or something haha im a sailor at heart so a game like this is really something i would be interested in. im a PBR environment artist and i make boats so lmk.

1 Like

Your reply seems mostly antagonizing and doesn’t improve the conversation at all. Try being a bit more positive. What you’re describing is also not really feasible…

In my opinion, this is an excellent use of mesh deformation and far better than what the default terrain offers. Excellent job on the math to figure out how to angle the boats correctly as well.

3 Likes

Anybody who’s interested, have a look at this. It’s a lifesaver

5 Likes

I am aware i meant how do i do mesh deformation

I’m curious on what method you used to make objects float on top of the moving waves as they change. Did you use raycasting to detect the water? If so, could the new shapecast feature be utilized?

No raycasting, just pure math to compute the surface of the water.
My post explains it a bit:

1 Like