# \[Community Project\] FREE Ocean Water Shader

**URL:** <https://forums.unrealengine.com/t/community-project-free-ocean-water-shader/115372>\
**Category:** Game Development\
**Tags:** unreal-engine\
**Created:** [August 22, 2018, 11:00pm UTC](https://forums.unrealengine.com/t/community-project-free-ocean-water-shader/115372 "2018-08-22T23:00:54Z")\
**Posts on this page:** 20\
**Page:** 7

<div class="post-metadata">

**Author:** ![BigaCubensis](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@BigaCubensis](https://forums.unrealengine.com/u/BigaCubensis)\
**Post date:** [February 8, 2019, 12:08pm UTC](https://forums.unrealengine.com/t/community-project-free-ocean-water-shader/115372/123 "2019-02-08T12:08:55Z")

</div>

> [@NilsonLima](#):
>
> You gotta get good amount of vertices at that whole plane to make the waves good enough. Since you have a landscape done, you can make one shape which is fit for the water placement, it doesn’t need to be a circle, thou it is easier to do one.
> 
> The water out of the boat I am working on it, but it is not easy and right now I am with hands full from doing other stuff. But it is on the plan.

for water in boat, I was reading about a solution related to “Stencil Buffer”. Somehow they created two meshes for boat, one for external, one for internal and disabled rendering water with help of external mesh and stencil buffer but I dont know the details.

---

<div class="post-metadata">

**Author:** ![NilsonLima](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@NilsonLima](https://forums.unrealengine.com/u/NilsonLima)\
**Post date:** [February 8, 2019, 12:30pm UTC](https://forums.unrealengine.com/t/community-project-free-ocean-water-shader/115372/124 "2019-02-08T12:30:38Z")

</div>

> [@Maja2008dragon](#):
>
> Unfortunately if I change ocean top plane to any other mesh, Im getting large holes… ☹  
> Scaling the plane still gives weird results like triangular waves… (though as I tweaked them to smaller waves not just disturbing, but they are still there)
> 
> ![trianglewave.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/3X/3/9/39066c52d14200774ec945aa24f9d2e10f1b8984.jpeg)

I have never seen this behavior before… Did you disable the Landscape modulation at BP\_Ocean? Disable it if you don’t.

---

<div class="post-metadata">

**Author:** ![NilsonLima](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@NilsonLima](https://forums.unrealengine.com/u/NilsonLima)\
**Post date:** [February 8, 2019, 12:33pm UTC](https://forums.unrealengine.com/t/community-project-free-ocean-water-shader/115372/125 "2019-02-08T12:33:14Z")

</div>

> [@Maja2008dragon](#):
>
> for water in boat, I was reading about a solution related to “Stencil Buffer”. Somehow they created two meshes for boat, one for external, one for internal and disabled rendering water with help of external mesh and stencil buffer but I dont know the details.

I have posted a video about the use of stencil, but it won’t work out of the box as it was explained, because the underwater effects also use the stencil to work, so it will take a bit more changes than the ones I have explained in the video, but as I said I am looking into this.

---

<div class="post-metadata">

**Author:** ![BigaCubensis](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@BigaCubensis](https://forums.unrealengine.com/u/BigaCubensis)\
**Post date:** [February 8, 2019, 1:14pm UTC](https://forums.unrealengine.com/t/community-project-free-ocean-water-shader/115372/126 "2019-02-08T13:14:58Z")

</div>

> [@NilsonLima](#):
>
> I have never seen this behavior before… Did you disable the Landscape modulation at BP\_Ocean? Disable it if you don’t.

Yes, its disabled. Also, it seems as I tweaked wave speed, amplitude and other values to get smaller waves, buoyancy still exist but seems waves dont inflict the ship or its is too small to notice. (Though I tried set smaller mass scale and smaller density for my light boat to get more intense buoyancy.)  
Another wierd problem if I use two ocean BPs on scene, for two lakes. Even if I set the correct Ocean Manager reference for different boats, the sample boat seems still checks the another one, or no idea why it floats far above the ocean plane.

 ![landscapeoff.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/3X/6/8/68356fc7398d76685444f2dfc8d7f77142f45273.jpeg)

---

<div class="post-metadata">

**Author:** ![NilsonLima](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@NilsonLima](https://forums.unrealengine.com/u/NilsonLima)\
**Post date:** [February 8, 2019, 2:44pm UTC](https://forums.unrealengine.com/t/community-project-free-ocean-water-shader/115372/127 "2019-02-08T14:44:08Z")

</div>

> [@Maja2008dragon](#):
>
> Yes, its disabled. Also, it seems as I tweaked wave speed, amplitude and other values to get smaller waves, buoyancy still exist but seems waves dont inflict the ship or its is too small to notice. (Though I tried set smaller mass scale and smaller density for my light boat to get more intense buoyancy.)  
> Another wierd problem if I use two ocean BPs on scene, for two lakes. Even if I set the correct Ocean Manager reference for different boats, the sample boat seems still checks the another one, or no idea why it floats far above the ocean plane.
> 
> ![landscapeoff.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/3X/6/8/68356fc7398d76685444f2dfc8d7f77142f45273.jpeg)

I think the system was really not made to be used like lakes and I am almost sure someone tried this before and never made it to work properly and gave up. It would be less troubling implement buoyancy on another asset … there is even a guy who implemented a simple one which works nice, you could try this: [3D Projects - Elhoussine Mehnik](https://ue4resources.com/3d-projects)

He has two projects implementing buoyancy, one for ships and one which is simple buoyancy. It worth check them out.

---

<div class="post-metadata">

**Author:** ![NilsonLima](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@NilsonLima](https://forums.unrealengine.com/u/NilsonLima)\
**Post date:** [February 8, 2019, 3:12pm UTC](https://forums.unrealengine.com/t/community-project-free-ocean-water-shader/115372/128 "2019-02-08T15:12:52Z")

</div>

Follow a video with a discussion on why just following the methods using stencil in the ocean material is not working as expected and the next steps I will take to make it work:

[![](https://d3kjluh73b9h9o.cloudfront.net/original/4X/4/a/a/4aa799305c32620bb772820e2a6f81ab89d80e79.jpeg "UE4 - WIP Community FREE Ocean Project - Masking boats with Stencil - issue") ](https://www.youtube.com/watch?v=4XNaL5ePwPA)

---

<div class="post-metadata">

**Author:** ![Boruki](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Boruki](https://forums.unrealengine.com/u/Boruki)\
**Post date:** [February 24, 2019, 8:40am UTC](https://forums.unrealengine.com/t/community-project-free-ocean-water-shader/115372/129 "2019-02-24T08:40:41Z")

</div>

Hi Nilson.

I’ve never logged on to these forums to post before (only to read and learn). But having downloaded and started integrating this in to my game I felt I had to post a thank you. This is an incredible asset that you and the team have made available, for free, to the masses. I had a few issues with getting it to work (masking in particular), but you’ve set out to help people with that as well. Genuinely can’t thank you enough!

Also I didn’t realise how much I needed this in my project until I opened up the project and watched those rolling waves… amazing work!

For the masking I found that if I set the UnderwaterPPVolume on the BP\_Underwater that it would then take away the masked effect, and even if I did an undo it would still be gone. I’d have to close the map and re-open it without saving the changes. I don’t know if that indicates anything to you in terms of issues people may have been having?

---

<div class="post-metadata">

**Author:** ![Simigla](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Simigla](https://forums.unrealengine.com/u/Simigla)\
**Post date:** [February 26, 2019, 11:30am UTC](https://forums.unrealengine.com/t/community-project-free-ocean-water-shader/115372/130 "2019-02-26T11:30:40Z")

</div>

Super helpful and it’s pretty much perfect! Thank you so much for this, you’ve spared me lots and lots of hours of work on one of my projects.

---

<div class="post-metadata">

**Author:** ![NilsonLima](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@NilsonLima](https://forums.unrealengine.com/u/NilsonLima)\
**Post date:** [February 26, 2019, 12:30pm UTC](https://forums.unrealengine.com/t/community-project-free-ocean-water-shader/115372/131 "2019-02-26T12:30:08Z")

</div>

> [@Boruki](#):
>
> Hi Nilson.
> 
> I’ve never logged on to these forums to post before (only to read and learn). But having downloaded and started integrating this in to my game I felt I had to post a thank you. This is an incredible asset that you and the team have made available, for free, to the masses. I had a few issues with getting it to work (masking in particular), but you’ve set out to help people with that as well. Genuinely can’t thank you enough!
> 
> Also I didn’t realise how much I needed this in my project until I opened up the project and watched those rolling waves… amazing work!
> 
> For the masking I found that if I set the UnderwaterPPVolume on the BP\_Underwater that it would then take away the masked effect, and even if I did an undo it would still be gone. I’d have to close the map and re-open it without saving the changes. I don’t know if that indicates anything to you in terms of issues people may have been having?

The last video posted above just discuss that masking and underwater postprocess don’t work together as it is. It will be necessary a total rework on that, because the project used stencil for doing the underwater and unfortunately that conflicts with the masking which would use it too, and also there is no way to prioritize which will use it first, because the interior of a big ship or a submarine would be submerged and you want to see the underwater out of it while seeing the interior water free.

This is currently on top of my priority list regarding this project and as soon I have a bit of time I will dig into this.

---

<div class="post-metadata">

**Author:** ![NilsonLima](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@NilsonLima](https://forums.unrealengine.com/u/NilsonLima)\
**Post date:** [February 27, 2019, 1:46pm UTC](https://forums.unrealengine.com/t/community-project-free-ocean-water-shader/115372/132 "2019-02-27T13:46:49Z")

</div>

My first attempt on UE 4.22 preview 3 was not a good experience. There are visually several differences, mostly regarding illumination, planar reflections, surface is too flat, changes on lights crash, changes on ocean type crash, so maybe will be mentally healthier wait to the final 4.22 release instead of trying fixing things as it is for now. The errors are not in the plugin portion, so this is good news. There is a portion of code inside Advanced Buoyancy (because of changes on the rendering module) which will deprecate in 4.23, meaning a simple recompilation won’t work until the code is fixed and I hope to leave this fix done in 4.22 before 4.23 coming out. I will still send bug reports to Epic as much as I can, so I hope they don’t rush the release before fixing the issues.

---

<div class="post-metadata">

**Author:** ![unit23](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/unit23/32/1223962_2.png) [@unit23](https://forums.unrealengine.com/u/unit23)\
**Post date:** [February 27, 2019, 6:31pm UTC](https://forums.unrealengine.com/t/community-project-free-ocean-water-shader/115372/133 "2019-02-27T18:31:26Z")

</div>

> [@NilsonLima](#):
>
> **This project is currently being maintained by:**
> 
> - @DotCam\_
> - @Zoc
> - [NilsonLima](https://forums.unrealengine.com/member/365555-nilsonlima)
> - [EvoPulseGaming](https://forums.unrealengine.com/member/727857-evopulsegaming)
> - @[TK-Master](https://forums.unrealengine.com/member.php?1127-TK-Master)
> 
> **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.

Thank you all for keeping this project afloat, recently added the Ocean to my 4.21.2 project. The entire process took only about 20 minutes (including compilation of shaders). Looks very realistic, exactly what I needed.

---

<div class="post-metadata">

**Author:** ![unit23](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/unit23/32/1223962_2.png) [@unit23](https://forums.unrealengine.com/u/unit23)\
**Post date:** [February 27, 2019, 6:35pm UTC](https://forums.unrealengine.com/t/community-project-free-ocean-water-shader/115372/134 "2019-02-27T18:35:49Z")

</div>

Thought. It would be nice to have sea ice too, currently I model the landscape close to the water surface, but the waves lap over it. Not a big issue, maybe I try adding a buoyancy mesh, shaped like ice. With big waves and depending on the sea ice thickness, you could also expect sea ice parts breaking up, rafting over each other, so this opens another layer of possibilities…

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_6ec91933](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_6ec91933](https://forums.unrealengine.com/u/anonymous_user_6ec91933)\
**Post date:** [March 3, 2019, 11:29am UTC](https://forums.unrealengine.com/t/community-project-free-ocean-water-shader/115372/135 "2019-03-03T11:29:44Z")

</div>

does anyone know how to make an AI boat in this? get them to move to a set location

---

<div class="post-metadata">

**Author:** ![NilsonLima](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@NilsonLima](https://forums.unrealengine.com/u/NilsonLima)\
**Post date:** [March 3, 2019, 11:38am UTC](https://forums.unrealengine.com/t/community-project-free-ocean-water-shader/115372/136 "2019-03-03T11:38:37Z")

</div>

> [@SpartanDevTeam](#):
>
> does anyone know how to make an AI boat in this? get them to move to a set location

I never did myself (AI and stuff), but if you move the PlayerStart to one of the small boats and press ‘E’ (a message appears when you are in the right spot) you take control of the boat and can drive it. It is then a matter of checking what the code does (it is in blueprint) and use as a base for the AI boats.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_6ec91933](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_6ec91933](https://forums.unrealengine.com/u/anonymous_user_6ec91933)\
**Post date:** [March 3, 2019, 11:47am UTC](https://forums.unrealengine.com/t/community-project-free-ocean-water-shader/115372/137 "2019-03-03T11:47:03Z")

</div>

> [@NilsonLima](#):
>
> I never did myself (AI and stuff), but if you move the PlayerStart to one of the small boats and press ‘E’ (a message appears when you are in the right spot) you take control of the boat and can drive it. It is then a matter of checking what the code does (it is in blueprint) and use as a base for the AI boats.

I’m not that great myself :\ was hoping there was an easy way, or one already working

---

<div class="post-metadata">

**Author:** ![NilsonLima](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@NilsonLima](https://forums.unrealengine.com/u/NilsonLima)\
**Post date:** [March 3, 2019, 12:38pm UTC](https://forums.unrealengine.com/t/community-project-free-ocean-water-shader/115372/138 "2019-03-03T12:38:28Z")

</div>

> [@SpartanDevTeam](#):
>
> I’m not that great myself :\ was hoping there was an easy way, or one already working

Give me week or two and I will sort this out. I need to review the whole AI thing again so at least I can do it properly with best practices in mind. Likely to post a video.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_6ec91933](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_6ec91933](https://forums.unrealengine.com/u/anonymous_user_6ec91933)\
**Post date:** [March 3, 2019, 12:40pm UTC](https://forums.unrealengine.com/t/community-project-free-ocean-water-shader/115372/139 "2019-03-03T12:40:09Z")

</div>

sweet can’t wait 🙂

---

<div class="post-metadata">

**Author:** ![NilsonLima](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@NilsonLima](https://forums.unrealengine.com/u/NilsonLima)\
**Post date:** [March 5, 2019, 8:18pm UTC](https://forums.unrealengine.com/t/community-project-free-ocean-water-shader/115372/140 "2019-03-05T20:18:13Z")

</div>

I have just committed an update for anyone wanting to test with UE4.22 preview 4 available at Epic Launcher. There were some adjustments necessary for the planar reflections (which touching it too much may lead to a crash). Don’t forget to submit any crash report to Epic to help the devs to fix bugs when they appear!

[https://github.com/UE4-OceanProject/OceanProject/tree/OceanProjectNilsonLima](https://github.com/UE4-OceanProject/OceanProject/tree/OceanProjectNilsonLima)

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_6ec91933](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_6ec91933](https://forums.unrealengine.com/u/anonymous_user_6ec91933)\
**Post date:** [March 10, 2019, 1:02am UTC](https://forums.unrealengine.com/t/community-project-free-ocean-water-shader/115372/141 "2019-03-10T01:02:37Z")

</div>

Any luck with the ai boats?

---

<div class="post-metadata">

**Author:** ![Gallonmate](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Gallonmate](https://forums.unrealengine.com/u/Gallonmate)\
**Post date:** [March 10, 2019, 3:32am UTC](https://forums.unrealengine.com/t/community-project-free-ocean-water-shader/115372/142 "2019-03-10T03:32:25Z")

</div>

There’s an AI boat in this awesome guys boat physics project. You can use, adapt it, or learn from it.

> <https://twitter.com/HoussineMehnik/status/976202196873334784>

[Previous page](https://forums.unrealengine.com/t/community-project-free-ocean-water-shader/115372.md?page=6)

[Next page](https://forums.unrealengine.com/t/community-project-free-ocean-water-shader/115372.md?page=8)
