Community Tutorial: Ocean Simulation

i use engine version is 5.1.1 and i found that it only work on SM6 , if I switch to SM5 it will break down like that, Is there a solution to fix it?

So, step 1. add empty emitter needs to be clarified. If you just right click and select the add empty emitter this entire tutorial will not work lol. You need to right click, select add emitter and then select the empty emitter from the window that pops up. Or you will be missing the “emitter state(system)” from the emitter update section.

I googled THREADGROUP_SIZE and set it to 256 – works fine. 64 gives huge glitches.

Updated to UE 5.3 + relative USH path (thanks to Evil_Pee):

Now use of the awesome FX is seamless.

BTW, tested on SM 5.0 – It doesn’t work.

Hi, I tried to open a project in UE 5.3 and got the message: “The following modules are missing or built with a different engine version: ShaderDirectory. Would you like to rebuild them now?”. When I click “yes”, the error appears - could not be compiled. Try to rebuild from source manually". When I open .sln file - Visual Studio can’t find project files. What should I do to open project?

I took the original .sln file from here: Community Tutorial: Ocean Simulation - #43 by Evil_Pee
Opening the .sln file I see that there are references to Intermediate\ProjectFiles\UE5.vcxproj and Intermediate\ProjectFiles\MyProject2.vcxproj. These files are not supplied with MyProject2.rar, so I can do nothing, sorry. Ask @KryogenicGames for the files; I don’t program in C#.

On the other hand, I lust deleted my copy of all the files and downloaded from Github (my UE 5.3 fork), then recompiled plugin with no problems with Visual Studio Build Tools 2022 v17.7.3

Thanks for your answer. How exactly you recompile? Just open OceanTutorial.uproject and accept rebuild? I tried a few ways and still didn’t succeed

Yep – just opened the project.

Or you may download MyProject2.rar by Evil_Pee – it’s in UE 5.2, but it converts to 5.3 with no issues, IIRC.

1 Like

Thanks, seems simple but not working for me for some reason. All ways. I suspect some modules for VS2022 have not been installed. I’ll try to figure out

In an attempt to open project in UE 5.3 appear message about “ShaderDirectory” plugin which needs to be rebuilt. Rebuilding is failing. If I remove plugin “ShaderDirectory” - projects open, but the ocean is flat. Doesn’t matter - open 5.2 version in UE 5.3, or 5.3 version from UnrealQW. Would you explain what is wrong?

upd. tried to recreate ShaderDirectory plugin following video posted here recently but for some reason, it doesn’t work. Even after reinstalling components of VS2022

upd2. I removed HoudiniEngine plugin and now successfully rebuild project, now it works.

I have received a lot of questions about making the tutorial work on 5.3.
Actually, it is pretty simple and will work out of the box, except one change.
In 5.3, ability to sample render target from Render Target 2D data interface was removed, in favor of sampling render targets through Texture Sample Data Interface.
For that, Roughness Integrator Simulation stage and its script needs to be changed as follows:



Also, you will need to edit material function MF_GrabPixelAttributes, and change sampler type of pixel attribute render targets to Linear Color, and open each render target asset in content browser and re-save it. Without it, preview material will fail to compile:

5 Likes

As you may have noticed we managed to run the Ocean Tutorial in UE 5.3 (here is the link: GitHub - unreal79/NiagaraOceanTutorial at UE-5.3). I even contributed pull request to your GitHub project. Plugin system which links USH files locally (authored by Evil_Pee) helps a lot, BTW.

Unfortunately, I could not apply changes from your last post to my fork… MF_GrabPixelAttributes does not compile with textures as Linear Color. And I don’t know hot to set T_PixelAttribA* to ‘Texture Sample’.

2 Likes

I’m also seeing the same here, any ideas?

Is there a way to have foam but smaller-sized waves? in UE units the waves are gigantic and I can’t seem to be able to scale them down. Any inputs are welcome.

Thank you for such a great effort!

Size of the waves is controlled through relation of PatchLength, Amplitude and WindSpeed.

2 Likes

Thanks buddy, tested and all changes working fine in ue5main so should also work in 5.3. Dont forget to open all 8 textures and save then material compiles fine.

I also found if you set gravity lets say to 19.6 effect seems nicer

1 Like

Thank you! However I’ve tried multiple times to get “tempest waves” (lie the ones with the default settings) but smaller sized, and I can’t seem to get anything close to the same effect when the waves are big (current settings).

Any pointers for me? I’ve tried increasing / decreasing the amplitude / patch / wind params but I can’t seem to get near.

1 Like
UATHelper: Packaging (Windows): LogInit: Display: LogAssetEditorSubsystem: Warning: Something went wrong while loading recent assets! Num Recent Assets  = 30, Num Recent Asset Editors = 27
UATHelper: Packaging (Windows): LogInit: Display: LogNiagaraShaderCompiler: Warning: GPU shader compile failed! Id: 5 Name: FX_OceanWater_AwesomeShader/WaterSim/ParticleGPUComputeScript/FNiagaraShader/4
UATHelper: Packaging (Windows): LogInit: Display: LogNiagaraShaderCompiler: Warning: GPU shader compile failed! Id: 5 Name: FX_OceanWater_AwesomeShader/WaterSim/ParticleGPUComputeScript/FNiagaraShader/3
UATHelper: Packaging (Windows): LogInit: Display: LogNiagaraShaderCompiler: Warning: C:\Plugin\FX\Niagara\Private\NiagaraEmitterInstanceShader.usf.intermediate.hlsl(59,28-35):  warning X3556: integer divides may be much slower, try using uints if possible.
UATHelper: Packaging (Windows): LogInit: Display: LogNiagaraShaderCompiler: Warning: C:\Plugin\FX\Niagara\Private\NiagaraEmitterInstanceShader.usf.intermediate.hlsl(56,17-49):  error X4026: thread sync operation must be in non-varying flow control, due to a potential race condition this sync is illegal, consider adding a sync after reading any values controlling shader execution at this point
UATHelper: Packaging (Windows): LogInit: Display: LogNiagaraShaderCompiler: Warning: C:\Plugin\FX\Niagara\Private\NiagaraEmitterInstanceShader.usf.intermediate.hlsl(101,5-61):  error X4026: this variable dependent on potentially varying data: stage_input
UATHelper: Packaging (Windows): LogInit: Display: LogNiagaraShaderCompiler: Warning: C:\Plugin\FX\Niagara\Private\NiagaraEmitterInstanceShader.usf.intermediate.hlsl(27,130-179):  error X4026: this variable dependent on potentially varying data: gl_GlobalInvocationID
UATHelper: Packaging (Windows): LogInit: Display: LogNiagaraShaderCompiler: Warning: C:\Plugin\FX\Niagara\Private\NiagaraEmitterInstanceShader.usf.intermediate.hlsl(41,9-20):  error X4026: this variable dependent on potentially varying data: _84
UATHelper: Packaging (Windows): LogInit: Display: LogNiagaraShaderCompiler: Warning: C:\Plugin\FX\Niagara\Private\NiagaraEmitterInstanceShader.usf.intermediate.hlsl(43,30-45):  error X4026: this variable dependent on potentially varying data: _100
UATHelper: Packaging (Windows): LogInit: Display: LogNiagaraShaderCompiler: Warning: C:\Plugin\FX\Niagara\Private\NiagaraEmitterInstanceShader.usf.intermediate.hlsl(54,32-39):  error X4026: this variable dependent on potentially varying data: _145
UATHelper: Packaging (Windows): LogInit: Display: LogNiagaraShaderCompiler: Warning: C:\Plugin\FX\Niagara\Private\NiagaraEmitterInstanceShader.usf.intermediate.hlsl(57,28-35):  warning X3556: integer divides may be much slower, try using uints if possible.
UATHelper: Packaging (Windows): LogInit: Display: LogNiagaraShaderCompiler: Warning: C:\Plugin\FX\Niagara\Private\NiagaraEmitterInstanceShader.usf.intermediate.hlsl(54,17-49):  error X4026: thread sync operation must be in non-varying flow control, due to a potential race condition this sync is illegal, consider adding a sync after reading any values controlling shader execution at this point
UATHelper: Packaging (Windows): LogInit: Display: LogNiagaraShaderCompiler: Warning: C:\Plugin\FX\Niagara\Private\NiagaraEmitterInstanceShader.usf.intermediate.hlsl(104,5-61):  error X4026: this variable dependent on potentially varying data: stage_input
UATHelper: Packaging (Windows): LogInit: Display: LogNiagaraShaderCompiler: Warning: C:\Plugin\FX\Niagara\Private\NiagaraEmitterInstanceShader.usf.intermediate.hlsl(25,130-179):  error X4026: this variable dependent on potentially varying data: gl_GlobalInvocationID
UATHelper: Packaging (Windows): LogInit: Display: LogNiagaraShaderCompiler: Warning: C:\Plugin\FX\Niagara\Private\NiagaraEmitterInstanceShader.usf.intermediate.hlsl(39,9-20):  error X4026: this variable dependent on potentially varying data: _77
UATHelper: Packaging (Windows): LogInit: Display: LogNiagaraShaderCompiler: Warning: C:\Plugin\FX\Niagara\Private\NiagaraEmitterInstanceShader.usf.intermediate.hlsl(41,29-43):  error X4026: this variable dependent on potentially varying data: _93
UATHelper: Packaging (Windows): LogInit: Display: LogNiagaraShaderCompiler: Warning: C:\Plugin\FX\Niagara\Private\NiagaraEmitterInstanceShader.usf.intermediate.hlsl(52,32-39):  error X4026: this variable dependent on potentially varying data: _138
UATHelper: Packaging (Windows): LogInit: Display: LogNiagaraShaderCompiler: Warning:   C:\Plugin\FX\Niagara\Private\NiagaraEmitterInstanceShader.usf.intermediate.hlsl(59,28-35):  warning X3556: integer divides may be much slower, try using uints if possible.
UATHelper: Packaging (Windows): LogInit: Display: LogNiagaraShaderCompiler: Warning:   C:\Plugin\FX\Niagara\Private\NiagaraEmitterInstanceShader.usf.intermediate.hlsl(56,17-49):  Err0r X4026: thread sync operation must be in non-varying flow control, due to a potential race condition this sync is illegal, consider adding a sync after reading any values controlling shader execution at this point
UATHelper: Packaging (Windows): LogInit: Display: LogNiagaraShaderCompiler: Warning:   C:\Plugin\FX\Niagara\Private\NiagaraEmitterInstanceShader.usf.intermediate.hlsl(101,5-61):  Err0r X4026: this variable dependent on potentially varying data: stage_input
UATHelper: Packaging (Windows): LogInit: Display: LogNiagaraShaderCompiler: Warning:   C:\Plugin\FX\Niagara\Private\NiagaraEmitterInstanceShader.usf.intermediate.hlsl(27,130-179):  Err0r X4026: this variable dependent on potentially varying data: gl_GlobalInvocationID
UATHelper: Packaging (Windows): LogInit: Display: LogNiagaraShaderCompiler: Warning:   C:\Plugin\FX\Niagara\Private\NiagaraEmitterInstanceShader.usf.intermediate.hlsl(41,9-20):  Err0r X4026: this variable dependent on potentially varying data: _84
UATHelper: Packaging (Windows): LogInit: Display: LogNiagaraShaderCompiler: Warning:   C:\Plugin\FX\Niagara\Private\NiagaraEmitterInstanceShader.usf.intermediate.hlsl(43,30-45):  Err0r X4026: this variable dependent on potentially varying data: _100
UATHelper: Packaging (Windows): LogInit: Display: LogNiagaraShaderCompiler: Warning:   C:\Plugin\FX\Niagara\Private\NiagaraEmitterInstanceShader.usf.intermediate.hlsl(54,32-39):  Err0r X4026: this variable dependent on potentially varying data: _145
UATHelper: Packaging (Windows): LogInit: Display: LogNiagaraShaderCompiler: Warning:   C:\Plugin\FX\Niagara\Private\NiagaraEmitterInstanceShader.usf.intermediate.hlsl(57,28-35):  warning X3556: integer divides may be much slower, try using uints if possible.
UATHelper: Packaging (Windows): LogInit: Display: LogNiagaraShaderCompiler: Warning:   C:\Plugin\FX\Niagara\Private\NiagaraEmitterInstanceShader.usf.intermediate.hlsl(54,17-49):  Err0r X4026: thread sync operation must be in non-varying flow control, due to a potential race condition this sync is illegal, consider adding a sync after reading any values controlling shader execution at this point
UATHelper: Packaging (Windows): LogInit: Display: LogNiagaraShaderCompiler: Warning:   C:\Plugin\FX\Niagara\Private\NiagaraEmitterInstanceShader.usf.intermediate.hlsl(104,5-61):  Err0r X4026: this variable dependent on potentially varying data: stage_input
UATHelper: Packaging (Windows): LogInit: Display: LogNiagaraShaderCompiler: Warning:   C:\Plugin\FX\Niagara\Private\NiagaraEmitterInstanceShader.usf.intermediate.hlsl(25,130-179):  Err0r X4026: this variable dependent on potentially varying data: gl_GlobalInvocationID
UATHelper: Packaging (Windows): LogInit: Display: LogNiagaraShaderCompiler: Warning:   C:\Plugin\FX\Niagara\Private\NiagaraEmitterInstanceShader.usf.intermediate.hlsl(39,9-20):  Err0r X4026: this variable dependent on potentially varying data: _77
UATHelper: Packaging (Windows): LogInit: Display: LogNiagaraShaderCompiler: Warning:   C:\Plugin\FX\Niagara\Private\NiagaraEmitterInstanceShader.usf.intermediate.hlsl(41,29-43):  Err0r X4026: this variable dependent on potentially varying data: _93
UATHelper: Packaging (Windows): LogInit: Display: LogNiagaraShaderCompiler: Warning:   C:\Plugin\FX\Niagara\Private\NiagaraEmitterInstanceShader.usf.intermediate.hlsl(52,32-39):  Err0r X4026: this variable dependent on potentially varying data: _138
1 Like

About buoyancy, has anyone managed it yet?
updating, I’m trying to apply a buoyance system based on Niagara like this video

however, I am finding it difficult to adapt this ocean system