[Community Project] FREE Ocean Water Shader

You can’t open a project saved in a later version with an earlier version, things like blueprints will disappear or not be accessible. You can only open earlier with newer versions, but in the case of this project which has C++ code, each new engine release might affect written code with changes in the engine source APIs, and this is the case with UE4.23. The project won’t work in 4.23, I have checked that already, needs code updates from us. The only map we place all the features is the IslandMap. All other maps are there as example. You can check via the commits at Github that those map are like that since forever.

I did get OceanProject-Master to run on 4.23, I just had to right click on the project file Generate Visual Studio Files and change version to 4.23, it will take a long time to open the first time and sit at 45% for many minutes (20) but after it finishes all the shaders it worked fine.

I am using VS17, Windows 7, 7 year old processor 3770K, with 32GIGS of ddr3 memory, and a 1080GTX << If you have better hardware you should a shorter time to get the editor open the first time.

Note: The last time I was using this around 4.17 I went through and cleaned out all the content except the flag waving and the Ocean content to reduce the size and also removed the Time of Day as I didn’t need any of it.

Once you open the project you will have 3GIGS of space being used. The .zip is 922MB.

If you guys have interest I will create a new branch with everything removed except the Ocean if not I will do it again for myself. Please let me know!

Hey @NilsonLima, I’ve got a few questions if you don’t mind.

  1. I’m using 4.19 and followed by your videos of masking water out of the ship/boat. I’ve set 5 stencil value to the inner part and 0 for the outer part and everything worked out for me but I got another issue: planar reflections are now rendering the inner part on top of the outer one when looking from certain angles. I tried to exclude inner part from planar reflections by adding it to ‘Hide Actors’ array in the planar reflections component of the BP_Ocean but it didn’t work out since the array contains actors but my inner part is a static mesh component of another BP. Any way to fix this?

[ATTACH=JSON]{“data-align”:“none”,“data-size”:“full”,“data-tempid”:“temp_173083_1568671202278_465”}[/ATTACH]

  1. I’ve read tons of forums about fog and translucent materials and I’m still not able to make the fog look fine (neither exponental fog nor atmospheric). Exponental fog kinda works but it looks ugly and non-realistic - it’s just changing color of the water but I what I want is to actually smooth the horizon or completely fade it out when the fog is really dense. Checking ‘volumetric fog’ makes no effect on this.

[ATTACH=JSON]{“data-align”:“none”,“data-size”:“large”,“data-tempid”:“temp_173183_1568759712548_282”}[/ATTACH]

  1. No matter what the horizon looks very sharp. That’s not how the water horizon should look like. Please, point me to the right direction. A little bit of fog could fic that but the fog doesn’t work.

[ATTACH=JSON]{“data-align”:“none”,“data-size”:“full”,“data-tempid”:“temp_173085_1568671262948_128”}[/ATTACH]

[ATTACH=JSON]{“data-align”:“none”,“data-size”:“large”,“data-tempid”:“temp_173184_1568759787274_63”}[/ATTACH]

  1. Finally, I’m using trueSky and ocean planar reflections are rendering weird dots along the water surface which I assume are actually stars. (To make sure it is planar reflections causing the issue I deleted the planar reflection component and the issue was gone). But the thing is that the stars only show up when it is night time but I still see them at a day time.

[ATTACH=JSON]{“data-align”:“none”,“data-size”:“full”,“data-tempid”:“temp_173087_1568671271634_103”}[/ATTACH]
[ATTACH=JSON]{“data-align”:“none”,“data-size”:“full”,“data-tempid”:“temp_173089_1568671286023_285”}[/ATTACH]

@script526 I will do my best to respond this to you in a timely manner. Since I don’t use TrueSky, I will see if I can get a trial and check your issues.

Thank you so much. You always kindly replies to users questions over the years, thank you for that.

As far as I know trueSky doesn’t provide trial version. But I could add you to private Github repository if you would like.

Anyway, there are only one question related to trueSky (about stars).

If this private repo is the one which contains your scene with issues, then you can add me, so it would be easier to check your settings and make a video showing how it was managed to be fixed (hopefully).

Send me a private message at the discord server (mine) with your repo link. My user at GitHub: NilsonFLima

@script526 Got some developments on the issues, 2 out of 3 so far. Check the video:

Thank you Nilson. That’s a shame it turned out that I was missing checkbox. The fog is really nice but the thing is that you can not actually get really strong foggy conditions where you can barely see the horizon like on these picture references:

https://www.eoas.ubc.ca/courses/atsc…e/10-fog-3.JPG
http://www.papercitylife.com/wp-cont…o2_r1_1280.jpg
https://ak7.picdn.net/shutterstock/v…77/thumb/1.jpg

And this kind of fog appears pretty often in a real life, at least I’ve seen it myself multiple times while serving on the warship back in the day. It would be great if I could achieve this effect somehow.

You mentioned at the beginning of the video that the planar reflections aren’t storong enough, that’s because I increased a little bit the roughness value that is exposed as a parameter to the Ocean_BP actor detailes panel.

Also thanks for solving the stars issue.

The only way to increase the fog to look like the 3rd picture is making a particle systems which will drive the look, density and color. You would be able to use a flipbook to drive the fog movement and you can spawn multiple particles around you to mimic that look of dense fog around you.

I made some time ago a video with a swamp fog alike which you can see it here:

Thanks, I’ll check it out.

I think I’m starting to get closer to what I wanted in terms of fog. Check this out.

Sorry guys it was night time and it seemed fine to me, but in the morning I realised that it’s way too dark.

You will probably need to drive the colors in the material with a Material Parameter Collection and update this material parameter collection with a blueprint which will check the hour or the sun position. Since you can do a Dot product from the sun light vector with a vector (0,0,1) it will give you a range of -1 to 1 value which you can use with a color curve, so at each point from the curve (-1 to 1) you can specify a color and retrieve the color for it. The same approach is found in BP_SkySphere present in the engine to determine the sky color, so you can do the same to drive the fog color with 1 curve, fog density with another curve and other things you think is dependent on the Sun position.

Yeah, I’ll give it a shot when I fix the ‘ship-related’ and lighting issues.

Hi there people,

Ive been playing around with gerstner waves for a while now and im trying to make the waves flow in towards the shoreline in different directions. The idea is i have a flow map baked in to vertex colours on the mesh and i use this colour information to drive the direction of the waves. However, even after smoothing the vertex colours out quite a bit the points where two directions blend together completely breaks apart and just becomes a bunch of displaced noise.

Anyone have experience with approaching this so that the different directions blend smoothly?

Cheers!

Hello Everyone,

The transparency of the ocean is not working in VR mode. Depending on where you look in VR, sometimes you see the ocean transparency but most of the time you do not. I am currently using Instanced Stereo mode with regular deferred shading. Just wanted to see if anyone can replicate this issue with the ocean in VR and provide some possible solutions to try out?

Thank you,

Kevin

UPDATE:

I fixed the issue. I noticed that the water blast particle effect from the Unreal Marketplace “Paragon Twinblast” assets caused the ocean transparency to work in VR when played (but after particle effect completion, the water loses transparency again). So, I narrowed down the exact effect within the water blast particle effect called “Masked”, deleted all other effects around it (e.g. water droplets, etc.), set the opacity of “Masked” to 0, and play the effect in front of my player every 0.05 seconds.

This solution somehow causes Unreal Engine to update the transparency of the ocean in VR. The effect has to be played in the view of the player. It’s a super hack but it works for now. Hope this helps someone using the ocean plugin in VR.

Finally, it seems that you also need to disabled SSR inside your BP_Ocean in order for this to work.

@XGibbousX This probably is related to translucency sorting order. At the current state Unreal does not know how to put a translucency material on top of another material in a scene if you don’t tell the order starting from the camera position. All objects, including particle effects (which mostly are made in a translucent or alpha composite material), are set with a field called Translucency Sorting Order = 0. To avoid that people using particle effects against the ocean (ocean behind particles) I have set the mesh planes for the ocean to have the sort order = -1 (at my repositoty branch at least).

You didn’t mention if you are playing the effect while underwater or outside with ocean as background, so this info and a picture or video would greatly help understand your issue.

Hey everyone,

I apologize if this has been addressed (many) times before.

I had a question regarding world composition. I’m working on a project that level streams in an island built in World Creator in a tiled, 3x3 grid pattern.

Last time I worked with OceanProject, it would only edge detect a single heightmap (if I’m not mistaken).

Can it, or are their plans to, have it react to multiple landscapes?

TIA.

@FlashFreak I have made a video for some people letting they know where the necessary changes in the code would be necessary, but I am not sure if anyone tried that yet. Since I am building another Ocean system I am having my own issues there and I don’t have the time necessary to invest in this project at least for now.

(Hey @NilsonLima, I saw this happen to you on one of your tutorial videos)

For those of you having issues compiling the man-o-war blueprint:

When you open a level in the editor, it creates a game world for the spawned actors that you see in the view port. If you modify one of those actor’s blueprint significantly, it DESTROYS the actor, and recreates it. This normally would not be an issue except for the thumbnail system:

void FClassActorThumbnailScene::ClearStaleActors()

This loops through the CURRENT actors and destroys them.

HOWEVER when you destroy the man-o-war, “Event Destroyed” fires in blueprints…
And inside of that we:
SPAWN ANOTHER man-o-war

adding it to the list that ClearStaleActors() is referencing. This causes an infinite loop of new actors being created then destroyed ect ect.

Simply remove the spawn node from the “Event Destroyed”!!! (This needs to actually be moved to gamemode or player controller)