Physical Water Surface

Physical Water Surface is an easy to use and physically correct water shader with great performance. It features a large database of wave spectra for different sea states, an automatic buoyancy system, seamless sea state transitions and extensive documentation.

Get Physical Water Surface here on the Marketplace
Please don’t forget to rate Physical Water Surface on the Marketplace page, your feedback is very appreciated!

Click here to read the complete documentation online before your purchase

http://i.imgur.com/nuWczUA.gif

Features

  • Realistic water motion: A Gerstner Waves implementation using physically correct wave spectra
  • Adaptive sea state: Water motion adapts to selected wind speed (1 m/s to 35 m/s) and fetch length (50 km to 1500 km)
  • Seamless Stea State Transitions: Beaufiful and completely smooth transitions between different sea states and wind directions
  • High quality buoyancy system: Physically accurate buoyancy that sets up automatically. Floating objects can fully interact with the UE4 physics system
  • Great performance: Buoyancy is implemented in Blueprint and can be automatically nativized to C++ code (verified to work with 4.14 and higher)
  • Infinite Ocean System: The water plane translates and scales with the camera, creating the impression of an infinite ocean
  • Water Material tiles infinitely: Use the supplied water plane mesh, or apply the water material to your own mesh
  • Six example maps are included that show how all the different features work, making your first steps easy
  • A player controlled boat is included to get you started
  • Water is hidden inside of boats
  • NavMesh is supported and builds on the water plane
  • Compatible with Orbit Weather and Seasons
  • Complete and and extensive documentation available online before purchase here

Watch the trailer:
watch?v=Wwyw_Uw26DQ
Check out my Channel for more videos

Here are some high quality 60 fps Gfycat videos:

The wind speed and fetch length can be easily changed with beautiful and completely smooth transitions between different sea states:

https://www…com/watch?v=wI-bdmQCFN8

For the next video I’ve used Physical Water Surface to improve the water shader from Vehicle Game (available for free in the Launcher). If you already have a water shader that you want to improve, you can follow the same approach. Have a look at the tutorial in the documentation for a detailed description of the steps.

watch?v=n9TFqB5waZA

Tutorials about using Physical Water Surface (courtesy of Scorpion Venom Studio Games):
watch?v=wLQ9QSJfQsg

https://www…com/watch?v=fEUoAlZz-zo

If you have any questions or comments, please post in this thread.

Get Physical Water Surface here on the Marketplace
Please don’t forget to rate Physical Water Surface on the Marketplace page, your feedback is very appreciated!

Link to old development thread

Update History

  • Update 1 (June 21, 2016)
  • Update 2 (February 7, 2017)
  • Update 3 (February 9, 2018)
  • Update 4 (April 5, 2018)
  • Update 5 (April 18, 2019)
2 Likes

Great Asset and worth the money! Very useful for realistic water motion and actual buoyancy! Also nice tech behind it.

Definitely not cheap stuff like some world machine terrains or similar standard assets with some materials attached to it that everybody could do.

I’ve made some improvements to the look of the water surface that will be included in the next update of Physical Water Surface.

The water surface far away was quite noisy. The first picture is the old look, and the second picture is the improved version.

5fed9e19b632d4104f13a85f03fa31befe20fbb8.jpeg FarAwayNew.jpg

The second thing I fixed was the repeating foam texture. Again, the first picture is the old look, and the second picture is the improved version:

4143caf625ab267fed867149db3f74422cacf68f.jpeg

8ed6d72dd5cddfbcc68f0ac70f017182a95a2d8b.jpeg

Of course, the foam can also be disabled completely if you wish. I’ve also implemented the possibility to fade out the foam at a certain distance from the camera.

i’ll get this once i see shorelines , looking good keep up the good work

I finally found some time to look into this today.

There is one issue which can be solved I think. The buoyancy point are static in their relative mesh positions. See video. With environmental interaction the actors will be head down soon and do not receive buoyancy anymore.
It should not be too difficult to move the buoyancy points dynamically depending on the actors rotation. Or just put buoyancy point on all corners. Can you comment on how to do this, what bit of BP to modify? I do not want to dig through everything right now.

The other issue is that the ocean states do not change continuously, but if you change fetch length for example, the Gerstner equations seem to reset and you the waves change over completely the moment you change a parameter resulting in a different ocean.

Otherwise, nice work! Good runtime performance.

Concerning your first question: By default, just one flat layer of buoyancy points is created. If these default points are in the middle of the actor, it will stay upright and not tip over. This behavior can be seen in my videos, and also in the DemoMap that is included with Physical Water Surface. I’ve made this the default behavior because it’s probably what most people want. In your case, if you want to allow the boxes to rotate freely, you should have buoyancy points in all eight corners of the box, and maybe one in the middle.

With a small modification, this should be possible. In the vector variable “Points” of the Buoyancy Blueprint, the coordinates of the automatically generated buoyancy points are stored. In the Event Graph of the Buoyancy BP, look for the section titled “Generate Auto Points Array”. In this section, the function GenRectangularPoints (or GenCircPoints) is called. This function generates the point coordinates and writes to the Points variable. As a first try, you can just remove these function calls (but don’t forget to connect again the surrounding nodes with an execution wire) and define eight points in the corners of the box as a default value of the Points variable.
Please let me know if this works for you, I will help you get this working. This is a feature that obviously needs to be supported out of the box in the future.

Concerning your second question: Yes, continuously changing the ocean state is not implemented at the moment, and it’s not an easy problem to solve. I’m not sure yet what is the best approach to implement this. Maybe it’s possible to blend together the “Normal” and “World Position Offset” material inputs of two Water materials with different wind speeds. Do you need this in your game? Do you want to continuously change wind speed, fetch length, or both?

I’m glad that you like the Physical Water Surface! I’m looking forward to seeing the amazing things people to with it

I managed to get more points by just copy/pasting the bit where you add a new point to the array and add some offset to the float height.
More crucial are the manual points. It seems you just stopped finishing it half-way through.
Can you finish the manual points? It is just adding a vector array that is editable and ‘Show 3D Widget’ on and then repeat what you do with autopoints. From hands on user experience, this is crucial. Then you can move the buoyance points around as you like.

Gradually, or continiously, changing the ocean state is a must. Without it, you would have to put a loading screen or something every time the weather gets stormy and the ocean changes. On top, the physics objects fly around if the ocean suddenly changes. This is not visible in your video because of the non-physics single point buoyancy. From what I gather, you use a look up table to hop to change the troichoid parameters by jumping between different parameter sets. I have not looked up the troichoid/Gerstner equations, but would not it be possible to change parameters continiously and feed them into the troichoid and thus achieve gradual change of the ocean shape. And if not shape, then at least the wave amplitude. Is not there a parameter that can be continiously changed without the troichoid hopping from one state into another? And if it not there, how about adding an extra parameter that just multiplies the amplitude. That would be enough to go to rough sea from calm sea in a first approximation. Those parameters could then forget the look up table and could be floats that cna be changed every frame.

Cna you update those two things; 1. manual points, 2. Parameters exposed to gradually go from calm sea to rough sea. Can you do it by tomorrow? :slight_smile:

I tested some more how to get different waves at runtime and now simply multiply the world position offset during runtime and the height for buoyancy. Never mind the normals at high waves. That kind of works, but only up to moderate offsets. Then the waves go crazy. Better would be to grab the k variables and the other ones that you have and have them exposed as scalar parameters (or some coefficients in front of them) during runtime so that you can grab them with some blueprint by their material instance and change the sea state gradually.

Also faded out the normals with distance by dividing R,G of the normals with screen depth. That gets rid of the noise at distance. Only blue, i.e. Z-normal, left at distance, i.e. all looking up.
Also tried depth fade for foam, but it is pretty useless, because it cuts off right at the border of the water-object overlap. I think this is the only UE4 method to get foam, so that’s useless. Better do a transparency fade with some slightly different color and overall foam in the sea.

We are just looking into what to do next. The more I look into this, the more it looks like the next game will be Arrr, Matey! :slight_smile:

watch?v=pMGQ_FsGybk

The Manual Points mode will be working in next update of Physical Water Surface that will be released very soon. In this update, the Points variable is public and can be edited manually in Manual Mode.

Concerning the transition between different ocean states, I will implement this but it will take some time to find a good solution. The waves going crazy is exactly the thing that needs to be avoided. I suspect that just gradually changing the wave parameters will not look good. I will do some testing with this and let you know what I find.

I tried yesterday to gradually change the sea state and it works for the variables A,k1,k2. On top of that the world position offsets can be multiplied directly before the node input. Omega (i.e. wave speed) is not yet working and result in a ‘rewind/fast forward’ effect of the sea state.
So I can now change the wave height and the size in x and y gradually, but not the speed. That’s ok for now.
I multiply the A, k1 and k1 in your water setting where you add them to arrays by factors and these are the factors I gradually change by increments of 0.01…0.0001. So now I can hold down a button and the sea state changes gradually.
To go from one look up table sea state to another, I will implement a (custom) lerp between the k1, k2, A Arrays of two sea states that runs for every single Gerstner Wave. That avoids jumping directly to the new sea state and instead moves there gradually over like 1000 frames or something. For the omega I have to look into the equations to see how to change it so that the sea state does not ‘rewind’ or goes ‘fast forward’. But Amplitude, and the two wavenumbers k1 and k2 are a good start.

Can you post a reference where the equations are shown?

Edit: just saw omega is the frequency which is multiplied with the time directly in the simple wave equation. Therefore the rewind/fast forward effect… that is tricky to change gradually.
Maybe like this example with a phase called ‘offset’, that compensates the ‘time-jump’:
Bad, fast forwarding: (k1x -w1t) -> (k1x -w2t) with w2 = 1.562w1 … this is equal to going to 1.562 the time and keeping w1
Good: (k1
x - w1t-offset) -> (k1x -w2t-offset) with w2 = 1.562w1 and with offset changing from 0*t to (w2-w1)t = 0.562current time … that changes the frequency, but at the same time avoids fast forwarding of the wave to the future position by pushing it back with a phase shift.

What you describe is actually very close to what I’m planning to implement. As you said, compensating the phase shift is one of the main challenges. Also, when interpolating between wave parameters, ideally the wave parameters should be sorted in such a way that the we interpolate between similar values.

Then I will wait for your update with the gradual sea state change.
The other thing I am trying right now is having a seadoo acting properly with the water surface. Turns out the high linear damping when submerged makes it instantly stop when I stop accelerating (force applied).
Might be worth avoiding the object buoyancy-hopping out of the water by implementing a opposite force proportional to z-speed, i.e. water push-away resistance, instead of simply upping the linear damping.

Today, I tried Physical Water Surface in VR with my newly arrived Oculus Rift CV1 and UE 4.12. I wasn’t expecting it to run too well because I haven’t yet done any VR optimizations, but I was pleasantly surprised. With a few floating objects, it runs at the required 90 fps on my GTX 980 Ti. So if you have bought Physical Water Surface I encourage you to try it yourself with the VR headset of your choice, it should just work with the “VR Preview” in the Editor. It would be very interesting for me to hear how the performance is on a GPU with minimum VR spec (GTX 970 or AMD 290), so I can make a version of the material optimized for VR.
The great news is, Physical Water Surface in VR looks amazing! Motion in VR looks great, and seeing the complex water motion, in correct scale, together with the reflections of the sun looks fantastic. Because the scale is correct, the waves really seem to have mass.
In the upcoming update of Physical Water Surface there is a new map included with a player controlled boad, with the camera mounted on the boat. Just using this map in VR Preview is one of the better VR experiences I have had thus far. I think one of the reasons for that is that most VR experiences put you in a static environment. I think that with little effort, this can be turned into a numer of different amazing VR experiences, for example fishing or whale watching.
So please try give it a try and let me know how the performance is on your GPU, and which VR specific improvements you would like to see for Physical Water Surface.

Hey ,

I envy you! I do not have a VR headset at hand right now.

I spent the weekend implemented a phyics based boat driving mechanism with lift, sway resistance and so on. Quite some fiddling to actually be aware of all forces.
There are a few things that I can suggest from this hands on experience for the next update, in addition to the things above.

  • do not use linear damping, it does not work with boat driving. Instead used forces in x,y,z that are opposite to the velocity and proportional to it. Then you can decouple x,y,z damping. Boat gliding needs that. The z force will work against buoyancy with same effect as damping.
  • make not just anysubmerged flag, but do an array with flags for all buoyancy point to check if they are one by one submerged. Needed for selective water splashes around the boat.
  • expose variable to adjust number of Gerstner waves added. Less Gerstner waves give smoother surface, better for gameplay. (not tried yet)

Do you know of a solutiion for UE4’s transparancy sorting issues. At really high waves occluding themselves, transparant materials will sometimes skip surfaces and render that wave behind the first wave first (known UE4 issue).

Overall, really exciting! 3:40min is mighty!

watch?v=2sR1gcBBN2o

I’m planning to replace the linear damping with my own damping implementation. The reason for this is that with linear damping, the damping depends on the absolute speed of the boat, but it should depend on the relative speed between boat and water. If the water surface is moving at 1 m/s in a certain direction together with the boat, the relative speed is zero and there should not be any damping. But with the standard linear damping, there is. I already calculate the relative speed between the water surface and the points, so it will not be much work to use that as input for the damping/drag.

The sorting issue I haven’t encountered yet.

That’s right actually with the relative speed. The way I did it, at zero speed at least with the x,y,z, split-damping, there is only bouyancy z speed acting and drag from the waves, so relative speed in x,y is not high. But I could not create a ‘surfer’ riding the wave actually without relative speed in the equation.

, I tested a new foam method that I picked up in the forum. It uses the DistanceToNearestSurface node and works if you generate mesh distance fields in the project settings. (and set skylight to moveable). It measures the true distance to a surface and with this you can produce foam around any object/any wave height. Really cool. Like at 1:50min foam under the rock.

it looks so cool !
is there a way to add transparency and reflections to the water ?

Yes it it possible. Look at the first video BlueBudgie posted above, he added transparency to the water surface. Screen Space Reflections are there and enabled by default, but in many videos they are not visible because of the lighting conditions.

Have a look at these two videos, there you can see the reflections:

(at 0:30)
watch?v=Wwyw_Uw26DQ

watch?v=n9TFqB5waZA

In the water material that comes with the pack, you can also fade out the normals with a snippet like this.
That takes the heavy noise away at large distances and makes the material look good from high altitudes.

I’ve implemented something similar (reducing the noise at large distances) in the upcoming first update of Physical Water Surface that should be released by Epic any day now. The ocean now looks good from war away and also from high above.