UE4 Water Shader

For the large waves i just used a render clouds filter in photoshop and extracted the normals with nDo2 and for the smaller waves i created the shape in ZBrush the baked out the normals and height with XNormal.

As for the waves meeting the coast line you can just mask the wave displacement using a depth bias just like i did for the opacity so that way the closer it comes to an object (the shore) the smaller the waves are, OR you could use vertex masking to be more precise.

Awesome! That water shader is looking fantastic =] I need to start looking into tessellation more.

Good work!
But look what I found:
The guy released his material and scene here:

Perhaps someone could convert this from UDK to Unreal 4. :wink:

Anyway, my first attempt:

Yeap, no Specular with translucent material! Maybe this is a bug!

I hope the lack of specular and SPR on translucent surfaces is just a temporary thing, i know this build of UE4 is not supposed to e complete for about 6 weeks so hopefully this is addressed along with real-time GI

Well, someone that understand shaders well, could have a look at the shaders source and add the specular overthere. :wink:

Will translucent materials have spec highlights any time soon?
Unfortunately no. We want to implement that but it is a big task (requires Forward+ shading) and it’s a ways down our task list.

Will there be an alternative solution for real-time reflections on translucent materials for water etc. in the future?
It’s not in the plan at the moment, but I think we really need that for good water. Reflection environment cubemaps don’t provide accurate parallax and SSR is inconsistent in its coverage. We need something that renders a simplified version of the scene to a planar reflection, like GTA5.

I think I’ll update the shaders for UE4 soon :slight_smile:

Either of these would be awesome

@CharlstonS Tried to build the shader you show in the screenshot , but it looked… well funky., I guess we must not have stumbled on the node settings , any chance of providing those as well?
BTW I teach UDK at a college so we are not beginners , and have spent all weekend playing with it but with no luck, I am stumped how you got the water to look so shiny with no specular, ours look flat, and a weird offset in the object /water intersection that I am guessing is caused by the Bump offset, not being set correctly.
We have just got a reflection sphere in the scene , is that all that is required?

@ufna "I think I’ll update the shaders for UE4 soon "

That would also be awesome, had a go at it myself but could not get it to accept the custom Nodes.

Still getting to grips with the changes in UE4 and physical materials, trying to train myself to think more like in Mental Ray.

But these are both awesome examples of ocean, Keep up the great work and thankyou for sharing, its very much appreciated.

Make sure you have the material applied to a tessellated mesh (8x8 grid should be fine), even though it uses tessellation the mesh needs to be tessellated or it will not work correctly

Yeah I did, actually its a 20 x20 surface , I am sure it’s the internal settings of the nodes that has thrown it , built it exactly to the screen shot but it looks nothing like the last video you posted , Our bad Not yours Im sure , thats why I reckon it has to be the settings, they must have to be very precise.
Unless we are missing something else to do with reflection.

That water looks pretty amazing great job! If you’ve played GTA5 and go out into the ocean it’s pretty realistic like this… One thing I havn’t seen yet is a great looking effect of the ocean waves crashing on the beach…

Hey, loving this water. I remember creating one in Unreal 3. I want to play around with what you have and was wondering if you could share your textures you used. No stress if you cant :slight_smile:
Anyway keep up the good work, cant wait to see more :slight_smile:

Guys you can still use a realtime reflection on the surface, just apply it through the material as a texture cube :slight_smile:

And then there’s this ocean:
and this:

Like VaOcean, each ocean looks great and has some feature that the other does not.

I really hope one of these oceans becomes ‘fully functional’ and is available to purchase on the marketplace.
Fully functional meaning:
. Wave control(small/medium/large/huge)
. Object buoyancy
. correct depth fade (e.g. at terrain, object edge)
. reflections (sky, objects, etc)
. boat/ship wakes
. terrain border foam
. crest foam (surf)
. underwater ocean-surface view
. interactive ripples? - probably asking too much1.

I’m absolutely sure it would be popular and sell many units, especially if it could be easily included in any project like terrain or foliage. It would be nice if UE 4.x had an ocean in the pipeline but apparently it isn’t a priority.

Some of those look nice but why are they only previewed in a 2k bound? Let’s see them run in a 500k ocean surrounding an island. Anybody can make something excellent that isn’t practical…

Also OP, none of your videos show up. Just the hijackers! I couldn’t find a charlestons related to unreal on youtube. I’d like to see what you came up with.

[EDIT]Ash there is a passable ocean shader in the GDC demo project on the learning tab. That should at least get you started.

oh sorry for the double-post but this deserves its own update:
I forgot to say you can fake specular on translucent by creating a <<0,0,1>> transform tangent->view then feed that into a dot with your ripple normal maps then put that into emissive and tweak your intensities.

Can anyone tell me why my shader says 10/16 samples used even though I only have two normal maps? I assume it has to do with that mysterious cubemap that shows up. I am getting a reflection of something. Looks like a default cubemap of a blue sky with some clouds might be running in the background. How do I kill that? But that still doesn’t explain the other seven texture slots being taken.

Hey King Mango,

Check out this thread for details on the texture sample limit, it has been increased to 128 in version 4.6 (using shared samplers):

Also, feel free to try my water sample in the project link below. :slight_smile:

Well there goes MY morning… lol
That is really nice and gives me something to think about for my own shader. It looks like you’re using DX tessellation? I want to stay away from that and I think I have an idea for a sm LOD system but I’m not really ready to start testing the LOD system idea for at least another couple of weeks. I want to get other problems out of the way before I work on “luxuries” like rolling waves.
Thanks .Cam!

No problem, and yes it does use tessellation, the plane mesh I have in there currently can work pretty well without any tessellation from a short distance, but not right up close. I believe the mesh was 45,000 tri’s 8192x8192 scaled up 10x

I am trying to get the T3d method mentioned by n00854180t in that thread, but so far it has not worked out well enough to switch over to it. There is a second mesh with 3 LOD’s in the Ocean\Meshes folder as well in case you want to try it, but I was not able to get it working properly, the waves need to be generated for a large distance from the camera, cutting the wave count in half with altered params just doesn’t look right, but is something I am trying to fix. Everything is in WSC though so it is simple to match up multiple planes side by side.

And yes the actual visual part of the material is fairly basic, still learning new techniques there. :slight_smile: