[Community Project] WIP Weather & Ocean Water Shader

Hello everyone,

Can anyone help?

  1. I am trying to use the Ultra_Dynamic_Sky with this project (primarily for the clouds).

I understand that when I replaced the BP_Skydome with Ultra, I lost the UpdateSun function, and my SSS light vector parameter.

For us non-C++ people, where exactly in the Ultra BP do I put that function?

And does the function need to be tailored from that found in the BP_Skydome because of other coding in the plug-in?

If someone could tell me how to migrate over only the clouds from Ultra into this project, that would be another solution.

I want to keep that nice Black Flag SSS in the top of the waves you have achieved, but with the Ultra clouds.

  1. The nice waves create a problem previously pointed out, at the shoreline. I would like to implement TK-Master’s hightmap modulation function to keep waves from intruding too far…don’t know where to integrate that function either.

I was wondering if the hightmap along with probes placed along the beach, could be used to activate a swash/backwash shoreline blueprint that could be combined with this project. The waves already look great … some braking foam waves, swash that creates wet sand, and this would be almost perfect.

Did anyone notice that Bethesda used interactive “lake” water (no waves) for the Atlantic Ocean in Fallout 4?

Thanks in advance, and a special thanks to all you Canadians, I guess Canada wins the Gold for writing water shaders.

On top of all the other things im trying to integrate and port is the cloud and shadows from ultra dynamic. I havnt gotten any further than prodding the blueprionts but will post if I find more info. Its not a plug an play no doubt about it.

Yes us canadians seem to be all about the water…

What about 4.11? 4.11’s render time improvement (intel embree) is critical for architectural visulations. I know 4.11 is preview version but maybe temporarily something can be done. So i need this beautiful ocean in my version 4.11 project.

It should compile on 4.11p5 not that I’ve tried.

****, you guys are clever.

Any update on the transition from below/above water? (That thin line where for example the water covers only half your screen.)

Does anyone have a decent underwater fog at this point? I don’t care if the transition isn’t perfect.

I’m looking at the guy whos doing the diving suit project to try to solve this some really great ideas in that thread.

I have it built in my mind where it essentially gets darker the lower you go, remind me in a week and I’ll post it if I have it done, another one of the things I have on the go for my project. Basically all you need to do though is setup a PP volume around your currently controlled pawn and if above water set bIsEnabled to false and visa versa and also set up the PP settings based on whatever variables (depth for example)

Hey guys, I have some time to spare this week so hopefully I will finish the underwater stuff and upload to github.
I’m actually kinda glad I did not share the version I talked about before because I have found a much better method to do the masking (which does not involve any crazy gerstner calculations in the post process material).

The solution is to use the stencil buffer to mask the upside and underside of the ocean plane (that does require an extra depth plane though).
How the heck did I not think about the stencil buffer before?! it’s a simple solution and was right there in front of my face this whole time :stuck_out_tongue:

It works like this:
Red = upside, green = underside

The problem with this method (because there always has to be a problem…) is that tessellation causes some cracks and pixelation to show in the stencil buffer, the solution is to use a pre-tessellated plane and sample multiple neighbor pixels from the stencil buffer to get a cleaner result.

Wait am I the only non-Canadian in this thread? :stuck_out_tongue: haha (I’m from Greece)

The light vector for the SSS is updated from BP_Sky (take a look inside the UpdateSun function, second comment box) there is no C++ involved, you should be able to copy that part into Ultra Dynamic Sky bp.
The reason it is not updated from BP_Ocean is because it won’t update in editor when you change the time of day.

The heightmap modulation function that I posted is implemented in the materials (M_Ocean_SSR, M_Ocean_Depth etc.) I believe I posted some instructions :stuck_out_tongue:

Just leave me 8 months to catch up. Masking my submarines interiors so that I didnt have to do tricks with the interiors was my first step in C++/Advanced Materials using the divnig suit game thread.

You could probably use the same method to mask the inside of a submarine by reading the stencil buffer in the ocean material and use it to set the opacity to 0.
I have not tried accessing the stencil buffer from a translucent material though.

I’ve got a long ways to go. Not muh documentation.

Got the stencil buffer index deal figured out though. Now if I can just figure out how to draw the geometry and occlude it magic not yet known to my skills, have to look at some hlsl code for reading te stencil index.
Of course I’ve thought about just turning the ocean bIsActive = false when below decks and = true when above decks or looking through the periscope. Thats what all the previous sub sim games did but I have big plans.

Being that the sceneDepth node only assigns values for opaque objects I wouldnt even know where to start.
Materials is one ting I never ended up learning. Focused on BP’s so that when C++ time came (now) I’d have a small idea of the API

I would try having 2 meshes, one for the inside wall of the sub and one for the exterior… then you will set different stencil ids to each and apply one sided opaque materials to them.

That should in theory take care of occlusion when viewed from the outside.

To access the stencil buffer in material you use the SceneTexture node and choose custom stencil from the dropdown.
Here’s a nice answerhub link

Would there be any chance to use this plugin, just as content - without the plugin, once you are done with customizations?

That looks awesome TK-Master!

Can you elaborate?
Without the plugin the infinite plane system won’t work in editor and the buoyancy component will have to be re-written in blueprints (it will be a lot slower though).

If you just want the ocean for visuals and don’t care about buoyancy then you could migrate the materials.

I can not for the life of me get this to work (i had it before i updated to 4.10 now i just get .dll missing errors)

Thank you TK, I will give it a try today.

Also, I noticed an earlier post that mentioned “caustics” were included in an update.

The underwater view of my ocean is looking good, but no caustics. Can you tell me where this function is located, and is it turned off by default?

I am working on a coastline lagoon level and strong caustics would really sell the biome.

As a note to help others, I used World Machine with the Geoglyph Archipelago macro to create the Lagoon, only it had a bug (can’t create a reef), so they sent me an earlier version that worked. Creating a single archipelago level that can be viewed from the air did not work out because I want my ocean to have waves, and waves at this time are uni-directional (looks weird to have waves moving away from the shoreline on the opposite side of a reef or island). I checked out several games, Fallout 4, Just Cause 3, and they all avoid the issue by using flat “lake” water at shorelines. This Ocean water holds up very well, I can recommend it to everyone. If a shoreline swash and backwash option with wet sand material were added, it would look even better.

Once again, great job all you Canadians, and of course TK the Greek! Hilton Athens view of the Acropolis lit up at night is fantastic. Great community project, EPIC please make the Ocean plug-in part of the next engine update. Wasn’t Bioshock built with the Unreal Engine?

Thanks for any caustics reply in advanced.

Basically, you can use ideas from here: to get a nice looking shore waves with a right direction and skewness :slight_smile:

Has anyone looked into the new (I think, I dont do materal work except basic texture plugging in) surface per-pixel translucency lighting model versus the current surface translucency? Heres a comparison taken from the same camera angle with stock ocean_ssr material with ocean set to ssr, cubemap, foam

No shadow support yet is the only downside dunno (yet) how that plays into things but I like the look overall playing with it.

Heres an in-game view parellel flat to the surface and from nearly perpendicular above

Wow that looks awesome Nsomnia, how’s the perf? Same/more costly?