Non-experimental water solution?

Hello! I have been researching how to do water in UE5 and everything I’ve come up with so far points to the experimental water system, which is not recommended for production.

I am hoping that someone can point me toward a non-experimental solution. How did people set up water before the new water system? I know the general answer is probably “the hard way” but I’d like to get some idea of what the hard way entailed.

Thank you!

You might have to make your own.

Use a camera-pointing up underneath your player-char, tied to render-target which is tied to a material applied to a flat-mesh you are using as your water-surface.

Use WPO and materials-maths to make it move in response to the displacement you are capturing into the RT. This is a good start: Creating Interactive Grass in Unreal Engine 4 | Kodeco

FluidNinja is also a good professional-grade tool. I have a copy, worth the monies.

1 Like

Without might.

The ue4 version is pitiful at best.
As usual, they pack it up with worthless things that drag on performance and make it unusable and unstable for everyone.

The single layer water material however seems to work fine and provide for the vast majority of rendering needs without you having to jump through hoops to fix up a custom material that works with the very peculiar engine’s rendering.

If simulating pysics you need to create a c++ manager that returns the wave height z at the given point (x/y) for game time.
And the functions you usually use are grstner wave clusters (but you can use whatever sine you like).

From 0, without even knowing what a normal map is, it would probably take you a mont to two months to make it all.
With pre-existing knowledge a couple days work tops.

Take care of using something better than a regular plane to make the water.
You need a mesh specifically created to reduce complexity at a distance without removing veritics at the edges (or you create gaps with the displacement).

2 Likes

Agreed. It was garbage, back then I wrote a post about some things encountered:

Is Post Processing broken on the 4.26 "WaterBodyCustom" of the water plugin?

@coyohti If you are going to make your own implementation some form of grid to register buoy heights on could look like something I wrote here, a map of 2D coordinates to a Z height for the water surface. A grid resolution can be defined by amount of units per XY key.

Projectile trajectory and ground level - #21 by Roy_Wierer.Seda145

Of course if there is no need to store data (no simulation etc) then you might just get away with a looping noise generator and skip such storage entirely.

Would be good to know what exactly you need. There are plugins which add spline based rivers, currents, underwater post processing, fluid sims, terrain generator and so on?

If you need an entire algorithm to produce terrain + lake environments in one go you can grab my diamond square algo here:

Anyone familiar with the Diamond - Square algorithm?

There are a few old old ways. at some point water used to be nothing but a textured plane at a constant height in the world. Anything lower was considered “water”. Somewhat more advanced is using a collision shape to act as a water volume. This way you can use any place in 3D space as water. On collision you would initiate a post processing effect to show “underwater visuals” and you would alter the physics and movement settings of things entering the water until they leave the volume. This still results in some nasty transitions. Various developments have been made since such as partial underwater visuals (you get a nice wavy edge at the correct position), editor tools such as river automation (currents, texture variants, particle effects whatnot).

1 Like

When I set this up I used a 5x5 sheet mesh that I arrayed like a grid (using a BP to set dimensions, etc). I didn’t notice seams but they were all using the same material instance and deformation was texture/noise driven so it was ‘global’ across the instances.

Any reason why that wouldn’t still work?

I’ve not tried, but can we use the new water-primitive from the water-system at least?

It might not have worked originally. It depends.

Say you have a 3x3 set of planes, that it is your main mesh setup but because your performance is low you inteoduce LODs.
To do so, you join the meshes by making just a 1x1 block that covers the same area.
Now, as your distance increases your LOD0 has 3x3 blocks, and your LOD1 has a 1x1 block.

When you animate the vertex using any type of algorhytm you will have that transition zone between the 2LODs animating the vertex height quite differently and generating a possibly huge gap (if two edge vertrx are at the cusp of the wave hieght and the middle is at the lowest point).

That is because within that grid like reduction you deleted the 2 edge veritices that make up the 3 blocks.

So to do it properly, first you need to reason in tris, because that’s the “normalcy” in any engine.

To reduce a grid that’s 3x3 squares, you would then just delete all the inside verticis, leaving you with 12 tris total (Insead of 2x9).
As you can see, that aint much of a reduction.

The reason for it is the base 3, if you work in base 2, then the simplification process is nearly halved.

Say 4x4 blocks,
You have 16cubes, so 32 tris.
When you reduce it proper you only have a max of 16 left.
So on…

1 Like

Thank you to everyone who replied to my post! All the information has been very insightful and I’ve been able to look into various options.

Unfortunately, today I talked to the person for whom I am working on this project and it seems what he is focused on is simply an object representing a boat, moving over an object representing water. His main concern is with have a first person character entering, controlling, and exiting the “boat”.

I can do the interaction but am feeling pretty clueless on how to enable movement/control. I guess just put a third person controller on it? It feels kind of hacky to me considering that, down the line, it will be a boat on the ocean so why not just do that from the start but I’m not in a position to debate on it.

Again, thank you all for your input!

I’d say build your own controller.

But hey, considering what you are asked (the way you just put it) you can even just use the vehicle stuff, or a pawn to posses.

For rendering inside/outside of water you have to look into double shell and post process stencil filtering - otherwise, normally with displacement, a low boat sits with visible water in it (Ofc, I don’t think your employer necessarily cares)

Thank you! I ended up creating my own controller for it which was easier than I’d thought it would be and got the interaction they wanted to see up and running just fine after that. I don’t know if it’s the best way but now I know what some of my options are and can experiment on my own.

For the record, I’m not actually employed doing this - I have very little experience with UE - I’m just trying to help out a friend and learn along the way. Part of the learning is always “dealing with the client”, it seems. :sweat_smile: