I have already tried several YouTube tutorials on how to make interactive water using the water plugin in ue4. But these tutorials seem to not work in Unreal Engine 5 or 5.1. Is there another way to make realistic interactive water in UE5.1.
Hey there @SupremeLeader3.0! By interactive, do you mean splashes, foam, etc? Or are you thinking more in depth like fluid dynamics?
As of 5.1 the foam setup in the water material had been broken.
There is no such thing as realistic water.
It is all predicated on simulations - the best of which come from Nvidia game works.
Approximations are obviously possible, but the “best” solution is - as it is often the case - a custom implementation of whatever you need.
Simulating positions and flow is possible with vector fields.
Simulating rising/loweing tide is possible with material parameter collections and actor offsets.
Simulating waves is possible with major performance hit.
Simulating a proper shoreline is essentially impossible so-far. The best you are likely to see are from AC odissey ( You can play around with different techniques to make the shore look more realistic, but the way the waves re-enter the water will always give it away).
Only possible exception to it I can think of being Nvidia, but it isnt capable of simulating such a large surface area as a beach at runtime.
There are a thousand and 1 workarounds you need to know or learn or re-invent to get all effects and common usage things:
boats without water inside of them, a camera view that can see the wave rise as you would throguh goggles, meshes without separations/gaps when tiled… so on.
Its essentially its own 3 year study just to get something viable for a videogame if you have no idea of where to even start.
Theres many forum topics on fixing different issues or ideas of different techniques to use - including some that levarage epic’s take on water like you request.
I have seriously never even bothered with it, but it would stand to reason that interactivity is done via a scenecapture or vector fields.
And according to various posts, the screencapture2d isn’t working properly in 5.1, so that alone could be a reason for things not working…
Fluid dynamics
Such as when the character moves, the water moves with them
Not a thing. “water” isn’t actual water.
Check/Try the nvidia FleX thing. Closest you’d be able to get.
I’d be interested in a solution, too. I’ve already tried niagara-based interactable water, but that constantly eats a lot of fps even with the water(s!) in distance. Also the rendering technique of the (non-niagara) water system looks like the quality/performance tradeoff I’m searching for.
I’ll need something like a water sim that player chars carry with them, that gets computation time when that player char is about to interact with water, and that “adds wave deformations” to that water’s surface, fading with distance from the player. For example, a 256x256 texel heightmap style water dynamics sim that simulates the dynamic parts of 5 meter of water around the player, maybe as an overlay to the gerstner waves. And interaction dynamics can be held relatively simple (probably could use simple “player pos/speed” based stimuli instead of a full collision based approach).
The water material already has multiple “entry point” candidates for simulations, some of which even explicitly named like that. But I’m unsure about their respective purpose. If none of such should turn out to be appropriate, maybe a water-sim lookup near the “waves”-part of the water material could do much of the trick.
Isn’t this a topic (rough style) worked on so very frequently that it’s getting difficult to assume it is still up to gameengine users to implement?
Well, maybe it really is already that simple, relative to other engine aspects.
The relevant material “Water_Material” is found under
All->Engine->Plugins->Water Content->Materials->WaterSurface
That has a “Fluid Simulation” section, leading into a suprisingly complicated “SampleFluidSimulation” node, which (in the “Normal, Height and Foam” section) has a texture parameter called “NormalAndHeight” that can be set to some texture in a material instance created from “Water_Material”.
If I get that correctly, the tex should not only encode a height-map (that should go to blue-channel, I think) but also normal-direction data in red+green channel. And something more, probably height-related in alpha.
To make the screenshot shown below, I’ve slightly modified the plugin’s “FluidSim_WorldPosition_To_UV” function to accept SimLocation parameters instead of parameter container (or whatever MPC means), and set that to the position of my custom lake water mesh.
Now that I have a basic fluid sim in, using the apporach as described above (256x256, 10m of interaction radius fading out to gerstner waves, only, terrain-water interaction to be implemented today) I find that
- fluid sim by itself only adds a few ms of frametime on my passively cooled GPU
- heaviness of water dynamics deep down in the water in fullscreen adds a lot more frametime than I expected, frametime heavily depends on “wave”-height
- the (lumen?) “scalability setting” decides actual usablilty
- the default water plugin custom lake mesh could probably tesselate a little more (had ~30cm grid artifacts most annoying in top down view)
But overall, fluid sim integrates very well with water plugin.
Update:
Prooved that even water/terrain interaction can be done.
My fluidsim doesn’t yet handle terrain correctly, but it seems to clearly be a fluidsim-specific. Also, I somehow added an aliasing-issue when switiching fluidsim-algo to a version that better integrates with terrain (now works with 2 signed float flow values for 2 specific neighbor texels like always north and west; this was similar before, but it was kinda double speed, an axis per flow flow value).
The aliasing appears to transform wave energy to high frequency rapidly, but that’s in parts an optical illusion (as can be seen in the texture used to present the fluidsim to the water plugin material, as well some rough terrain interaction can also be noticed).