[Community Project] FREE Ocean Water Shader

**Welcome to the community created Ocean Simulation, Weather (WIP), and Dynamic TOD system! **

**The point of this project is twofold. First, it aims to provide a realistic ocean water simulation that is both highly customizable, and being as physically accurate as possible. The second aspect is in regards to the weather and time-of-day setup.

The reason the Weather/TOD is in the same project is due to how much of the ocean itself is driven by the weather around it, to allow integration of real life ocean simulation, both parts are necessary for effects such as wind, rain, and storms. The Beaufort Scale will be implemented to allow custom control of the sea state and weather in one place.**

This project is currently being maintained by:

List of Contributors

  • Handkor - Initial Shader + Code for Buoyancy
  • Nadrugal - Additions to the SkyDome
  • Komodoman - Fish flocking AI and a variety of fish
    and more to be added shortly, currently rewriting this post.

Want your name on this list? Feel free to make improvements to the OceanDemo project, and either PM me or Post in the thread below with your addition! Even if you don’t think you can help yet, that’s no problem! Any suggestions can be left by posting below as well.



To download (or fork) the project, use the GitHub link below.

This is the original GitHub Link - https://github.com/UE4-OceanProject/OceanProject


This system uses techniques from many tutorials, however it would not have been possible without the help of the following users (Especially Handkor, he deserves a lot of credit for this!):
Handkor, JBaldwin, berna , ufna, Ehamloptiran, KhenaB, gregdumb and many others. Click on their names to see the corresponding threads!

For those wanting more info on how the waves are created mathematically, THIS ARTICLE goes over everything. Specifically have a look at the section on “Gerstner Waves” for the actual equations that produce the waves.


The above is kept as a quick reference and the original thread https://forums.unrealengine.com/comm…n-water-shader will stay untouched until @DotCam is back (hopefully he is fine wherever he is and getting his health improved).

Please forward your questions here from now on until we have some feedback.

Thanks for you support and don’t forget to give your contributions when you think they are useful to others in the spirit of this project!

NilsonLima added: Just to clarify: I don’t have any rights on this asset. I just support it, given for free information, making videos explaining concepts used at it. If you want to attribute inside your project anything about this work, you can mention the GitHub page and @DotCam as the creator.

Hello all, just wondering whether exploring Niagara for crest foam particles is an option? I’ve been trying to figure out a way to spawn particles on a mesh and take a mask into account for emission. This could go a long way toward making larger waves feel more dynamic. I’ve managed to apply the mask within the particle material before, which looks fantastic, but means you need to spawn particles across the entire ocean mesh even for invisible/hidden particles. If I get any further with this, I’ll happily contribute it here.


That sounds neat!

If you have a current point of interest/branch committed, I could go ahead and put the Dynamic TOD/Solar system in place. The Dynamic Weather may have to wait, as I’ve run into an instruction count limit on hlsl, inside of loops and have to rethink/write the loops without breaking anything. (Or I could just put in the c++ version for now, that way people can start contributing weather effects based off of the data)

@EvoPulseGaming I just came back from a long trip and need to catch up on things. I didn’t have anything ready to commit. My FFT Ocean got stuck on changes on the FFT portion because I really needed to change it once I have determined with Epic that I could not use that code (talking legal stuff takes time) and I want this thing going right from the begining. If its the case, we will create a new repository.

I saw some videos from @Deathrey today, showing his progress on the Ocean shader he will futurelly use as contribution for this project, that was so good, I told him that as a project administrator for this community ocean project, that he is granted on the use of the ship assets from this project, into his videos and even if he wants to submit the work for any Epic programs as in NVidia’s Edge Program, Unreal Dev Grants etc that I am sure he can win a spot among the finalists! @Amanda.Bott keep an eye at Deathrey’s work :wink: Anyone interested in seeing his videos, keep an eye on the Unreal Slackers discord server at #work in progress section.

I want to create planet, but if there is no way to curve ocean plane then i just want to use a lot of ocean water in squares like in quad sphere.Please tell me there is a way to turn of infinite generating ocean water plane .Or I need to just delete “InfiniteSystem” in “BP_Ocean” components,but then how to set “BP_Ocean” to render as square…? Or however there is a way to curve ocean plane (infinite)

Okay, there is a way to turn of infinite generating ocean water plane , just make is stationary ,but how to set “BP_Ocean” to render as square,because now i have circle…and then curve ocean plane to planet like form (optional)

Currently there is no option to disable the infinite ocean, unless going into the plugin C++ code and changing it to not do anything with the ocean plane mesh if you select this in the combobox as choice for the infinite ocean system. It is just a matter of simple and careful changes. The next planned release which will receive a major overhaul will include this.

The above currently deal with the infinite ocean part, but for having the ocean into a sphere or using it on parts of an sphere is something I never tried and despite it might sound neat it will incur in several performance issues. The current infinite ocean system is all about to make a square plane with more triangles in the camera position (center) and less triangles moving far from center (the edges) to be scaled up to fit the camera fustrum, this just to keep the number of triangles the same no matter if far or near the water surface. With this explanation, you will realize that your ocean into your planet to look good, will need quite a good amount of triangles along its whole surface and only mountains (if any) at ground level will occlude extra triangles out of the scene. So, the only way to have this done with good performance is forgeting about the ocean at certain distance and placing a simple water material in a sphere (your planet) which is hidden while the camera is near the surface and when the camera is far about certain amount you will just hide the current sphere with ocean to make appear the sphere with the simple water material. This can be achieve with LODs if needed be (same mesh, but different materials each LOD).

In the current overhaul we will use Quatree to show the water surface, so it is great for near the surface, but far from it we want to have a different approach. We might even make a demo map for a planet like surface (meaning we will need to handle the gravity), so this is just something else to make the development even longer. Hopefully we will achieve that, but not in a short timeframe, since this project is a community effort where people contribute when they have spare time.

Hello, do you know how I could activate the underwater line? I saw in your files that it was coded, but at home it does not work. It may be a reference story or ocean height on the Z axis. I’m talking about this

I also saw that you had to add Update swim volume to match the waves but it does not work at home. Everything else works perfectly. Thank you again for this great plug in.

Can you help me please ? I’ve been trying for a while, but I do not have the knowledge to do it. I am a beginner sorry …

Watching the following video you will learn how to migrate the assets to a new project and have everything setup:

Thank you for the answer. I already did it a long time ago. That said I remember that I had obtained an error during the compilation with visual studio 2017. I had repeated several times and always the same error. Yet the ocean worked well in my project.

You really can not explain to me how to correct these 2 problems?

Underwater effects are a postprocess effect, so if you didn’t set up properly yours this is why it is not working, and BP_Underwater aswel. The project need to have Custom Depth settings at Project Settings set with Enabled with Stencil (which is not default), and this is one setting that might prevent it to work.

Thank you for your help. I activated this option in the settings of my project, but it did not correct the problem. Can you give me more precision to correctly configure this effect please?

I use your underwater post process.

I will make a small video, upload it tomorrow explaining how to do it, surely the video above contains all which is necessary to set up a new project with the asset, so I think you are just missing some setting elsewhere.

I thank you very much it’s perfect. It’s really not easy for a beginner, but essential for not having a bug. Thanks again.

Make sure to register into Discord server in the link at my signature to get in touch with others using the asset aswel, and below the video as promissed, with hope it will solve your doubts:

Thank you very much for the video. Unfortunately this did not correct the problem. So I think that’s the mistake I had when compiling with visual studio 2017.

I will reinstall the plug in and migrate to 4.20. I hope everything will work well. Thanks for your help.

It works, everything works. I migrated ocean shader in 4.20, my project too. Re migrated your plug in in my project 4.20 and everything works perfectly. Finally perfectly … except my map. I used the world compositing. But in 4.20 my project crash when I load my maps or when I click on play …

I do not know yet if I stay in 4.20 and do it again. Or stay in 4.19 …

Anyway, thank you very much for the help provided and your superb plug in.

EDIT ; I had to install the sdk windows 10 for visual studio 2017 to work properly. No errors when compiling the project with your plug in. If it can help someone.

Due to some people not recognizing the effort done for “free” making videos for the Community FREE Ocean, downrating all the videos while some were made to attend specific requests from users, I will stop producing them and also leaving the support for it.

Should have kept them unlisted in a playlist. Pretty sure ones, who randomly ended up there surfing tube, downvoted the vids.