[Community Project] WIP Weather & Ocean Water Shader

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?

You are supposed to use the “r.ForwardLighting 1” console command when using the per-pixel translucency mode, I’m assuming you haven’t because it’s darker in the screenshot that it would normally be.

But yeah it is a better lighting mode to use but the shader will have to be modified some to better fit that model… I have a version in the works :stuck_out_tongue: you can get better specular highlights with that lighting model that does not rely on the skylight capture but the actual sun position (which is going to come in handy for day-night cycles).

Anyways, so I have made a bit of progress today, cleaned up the post process material a bit and fixed a super annoying pixelation issue with the stencil buffer that took me all day to figure out (the order of the depth planes actually matter in the components list… who would have thought? :rolleyes:).

Its more costly while using less features so… experimental and as TK said I assume I dont have the proper cmds enabled by default.

/me goes back to prototyping rather than trying to paly with the big boys.

Edit: Excitly going to be checking github daily for commits. And excited to make my first commit to the project one day (as im working on this project full time now its a matter of time before I figure some weather/ocean/landscape etc. stuff out)

Thanks Peter,

I took a look at it, and there was a nice shoreline, but the waves looked more like ripples. Do you think it would be doable with larger waves like these?


Also, any help on how to turn caustics on, or where to find the function to adjust?

Note: An update to the Ultra_Dynamic_Sky has been released. It appears to solve my SSS issue, not sure. I followed TK’s advice, as noted below. It didn’t change much but moved the SSS in the wave tops down the shoreline for some reason. I am old (59), and took this up a few years back when my UCSF doctor declared me cured of stage 4 Ampullary cancer after a clinical trial 8 years ago. So please excuse my nube questions. They gave me 2 months to live, and now I am designing a training tool with UE4 and having so much fun it should be against the law. Thank you Epic!


Thanks. Is it possible to download the materials separately?

Well I found out how to make my entire scene one color with custom stencils… and that scene depth is always less than SceneTexture:CustomStencil

I think I need to find the time one day to follow the material courses I never spent time doing. I can blueprint anything… cant material editor my way out of a box.

You are almost there, remove the Scene Depth node and replace it with the number of the stencil channel you want to mask (0-255).

Hi everybody, does anyone tried the plugin with unreal 4.10 ?

It works fineand someone posted a link to a 4.10 copy where he coded a nice heightmap generation tool for buyoancy on simple meshes. Played with it and keep the source up to date, but sticking with my test points for submarines.

Its source code, it should compile for almost any version.

Progress… I think?

Dont know what I’m going to do with a green submarine, somehow allow the textures to show but set the oceandepth mesh to 0 opacity as I have here. Might have to start a thread on this, thought I was going to have to do some fancy coding to find the nearest vert and subdivide til it was close enough to the mesh vert in real time and occlude within the geometry.

Getting somewhere completely by accident.

This setup leaves the scene asis but the cube with a pink material with stencil index 16 gets turned red!