Community Tutorial: Ocean Simulation

@Deathrey Thanks for this amazing walkthrough.

A mechanics to seamlessly change wind speed and direction can be added. Logic to implement it is quite simple. To transition from initial state to target state, you would slowly fade a small group of wave signals in the spectrum, once they are faded out completely, prepare new initial amplitudes for them, and start fading them back in, while also fading out next set of amplitudes. Selecting wave signals to fade out and in can be done using Bayer matrix, blue noise or any other pattern. Worth experimenting.

Does anyone have an example implementation for this type of control?

Hi. Currently working my way through this tutorial. However, it seems I might be screwed - 5.4 separates the Data Interface emitter link from the rest of the rest of the GPU dispatch settings - a apparently crucial separation from the tutorial:


Any ideas?

Hey!

Just to ask a side-question, as someone following this thread and working to implement the solution. What’s the major difference(s) between this and the water-as-a-solution in the engine? What does this do that the out of the box one doesn’t?

Number of waves and consequently, realism.

1 Like

Hi I’m having trouble setting up a virtual path for the .ush files that you have set up in your guide. Would you be able to help me with that? I’ve got the system working fully but I need to have my school course mates be able to see the water as well
thank you!

Virtual paths mapping can be added for project or plugin, by editing uprojoect/uplugin file, adding or editting AdditionalShaderDirectories.

Sorry would this be via the source code or is there a way to do it from within closed unreal? I might need a screenshot or two i’m sorry

Hi Thank you so much for the great Tutorial, I have set it all up and all good. Apart from one problem I am having which I am hoping you might have some ideas on - I am having real trouble stopping the ocean from rendering inside a boat hull. I have tried Custom Depth Buffer masking, i’ve tried Distance Field Occlusion, I’ve tried Proxy Hull (invisible mask geometry). But no luck so far, no matter what I do the niagara system based texture driven shader continues to render inside the boat. I have also double checked the proxy hull in Blender and the hull is a solid mesh geometry with no holes. Any help or ideas would be immensely appreciated?

I am getting this error : The Vector VM compile failed. Errors:
/Engine/Generated/NiagaraEmitterInstance.ush(216): error: Integer modulo/remainder is not an allowed operation on ES 2
/Engine/Generated/NiagaraEmitterInstance.ush(217): error: Integer modulo/remainder is not an allowed operation on ES 2

in the FX_OceanWater_ExportData everything seems to still be working and compiling but am unable to find a way to fix this. Any ideas?

I have been involved into ocean water of a game studio.
From EPIC’s WaterPlugin to legacy FFT based solutions where the WPO is having Steepness ie WPO.xy aka lateral displacement I keep facing the issue of mistmatch waterline which arises from the fact that during waterline the method uses WPO.z. The standard steepness used here DO not alter WPO.z with relation of WPO.xy. This causes mismatch of the final waveshape and WPO.z.
What is your opinion on this matter?

For some reason I can not get the Ocean Tutorial working.

I downloaded the sample files.
Opened the Unreal Engine version 5.1.
Added the missing define for THREADGROUP_SIZE in OceanWater.ush.
Followed the last steps of the tutorial to fix file paths in steps 7,8,9.
Opened each module and recompiled them.

I got everything working from beginning to Timestep, but there is something wrong in iFFT_ROWPASS and iFFT_COLPASS.
When I activate those I get following error in Niagara Log:
/Engine/Generated/NiagaraEmitterInstance.ush(749,20-38): Err0r X3663: this variable dependent on potentially varying data: Casc WaterSim, Particle GPU Compute Script,

I also copied the OceanTutorial.zip from the Dropbox link above Sept 2024 discussion. And tried to get that working with
Unreal Engine version 5.4.4. But after same steps I got similar compile error at same point when activating iFFT_ROWPASS and iFFT_COLPASS:
/Plugin/FX/Niagara/Private/NiagaraEmitterInstanceShader.intermediate.usf(123,5-61): Err0r X4026: this variable dependent on potentially varying data: stage_input WaterSim, Particle GPU Compute Script,

Any idea how to fix this ?

To get the simulation to work in 5.5 I changed this in the FFTOceanwater.ush file.

/////////////////
groupshared float3 pingPongArray[4][THREADGROUP_SIZE];
To
/////////////////
groupshared float3 pingPongArray[4][LENGTH];

(post deleted by author)

any idea about control ocean waves in sequencer?

update, try to use user parm replace emitter animationtime, but still get random wave when reset ns