Dynamic physical ocean

Hi is great so far! While I’m new to UE4, I’ve been a C++ games programmer for 18 years. I realize the tutorial was a quick way to get things out and working, but I never actually got the buoyancy part to work. I really struggled with understanding how to connect the ocean blueprint to talking with the Ocean Manager class and how to hook it up and instantiate it.

But I haven’t done things precisely like the tutorial. I created a lake blueprint where the goal is to completely self-contain everything. As a user, all you do is position a single 3D point in your world, and it’ll automatically calculate the lake for you – by tracing a bunch of rays outwards and colliding with terrain. Right now my test case is a very obvious crater and that works fine. I also attached a post process component to deal with underwater, and use more BP scripting to determine if the camera is below the water plane or not – currently it’s not accurate because I’m not getting the correct heights, but I’m sure that will be easily fixed.

My “lake” blueprint contains a billboard to signify something to click on to select it, a Static Mesh which is contains a Shape_Plane, and a PostProcessComponent to detail the UnderwaterFX. The contruction script sets the water material and disables the post process effect, and uses the ray trace system to determine how the plane shall be positioned and scaled. The Event Graph is responsible for testing the camera against the water plane to set whether the post process fx is enabled or not.

But now my latest attempt is to hook up the Ocean Manager to the Lake BP – and I am failing to figure how the best way to do . The approach I’m currently attempting is to add a “Child Actor” component to the components list and set the Child Actor class to “OceanManager”.

Can anyone recommend a next step for me to pursue?


Also I had to change the OceanManager header from class AOceanManager : public AActor to UOceanManager : public UActorComponent. It compiles but not sure I’m doing correctly.

that’s some great stuff here! thanks a lot for the tutorial :slight_smile:

Hello ,

i’m trying to make an implementation of the mathematical version, following your tutorials.

I’ve followed your videos all along, but i have a problem when i call the Gerstner material function in the cluster function, the editor is telling me that steepness, time and timephase are missing (but they are in the Gerstner function, like your tutorial…) :

Gerstner.png

Here is the Steepness input in Gerstner function :

It’s like those inputs are mandatory, i don’t know if it means something, but in your videos inputs are “greyed”, while mine are white…

I’m running on UE 4.5 .

Btw what is the last cluster multiplier ? (where the rotationAngle one is -0.11), or how do you calculate it ? Is it just random ?

Thanks for your help !

Answering to myself after searching, but it could help others in the same case.

The was that the “Use Preview Value as Default” wasn’t checked, i don’t really know what to put in X/Y/Z/W values on steepness so i put 0 everywhere, and my waves seems to work :slight_smile:

[=Arceuid;167201]
Answering to myself after searching, but it could help others in the same case.

The was that the “Use Preview Value as Default” wasn’t checked, i don’t really know what to put in X/Y/Z/W values on steepness so i put 0 everywhere, and my waves seems to work :slight_smile:
[/]

Steepness can be between 0 and 1, 0 gives you sin waves and 1 gives pointy waves. I personally use 0.5.

The multiplier for the cluster is all random, just keep the values from 0.5 to 2.0.

[=morness;166814]
Hi is great so far! While I’m new to UE4, I’ve been a C++ games programmer for 18 years. I realize the tutorial was a quick way to get things out and working, but I never actually got the buoyancy part to work. I really struggled with understanding how to connect the ocean blueprint to talking with the Ocean Manager class and how to hook it up and instantiate it.

But I haven’t done things precisely like the tutorial. I created a lake blueprint where the goal is to completely self-contain everything. As a user, all you do is position a single 3D point in your world, and it’ll automatically calculate the lake for you – by tracing a bunch of rays outwards and colliding with terrain. Right now my test case is a very obvious crater and that works fine. I also attached a post process component to deal with underwater, and use more BP scripting to determine if the camera is below the water plane or not – currently it’s not accurate because I’m not getting the correct heights, but I’m sure that will be easily fixed.

My “lake” blueprint contains a billboard to signify something to click on to select it, a Static Mesh which is contains a Shape_Plane, and a PostProcessComponent to detail the UnderwaterFX. The contruction script sets the water material and disables the post process effect, and uses the ray trace system to determine how the plane shall be positioned and scaled. The Event Graph is responsible for testing the camera against the water plane to set whether the post process fx is enabled or not.

But now my latest attempt is to hook up the Ocean Manager to the Lake BP – and I am failing to figure how the best way to do . The approach I’m currently attempting is to add a “Child Actor” component to the components list and set the Child Actor class to “OceanManager”.

Can anyone recommend a next step for me to pursue?


Also I had to change the OceanManager header from class AOceanManager : public AActor to UOceanManager : public UActorComponent. It compiles but not sure I’m doing correctly.
[/]

The OceanManager does not need to be attached to anything. It only provides a height lookup at a position. You can just set the scene’s Ocean Manager to a variable in the Lake BP or auto detect it with Find All Actor of Class.

Hey, can you please help me ? Regarding the shader, the gerstner cluster is very noisy, could you please tell me what i’m doing wrong ?

Edit: in your tutorial, you have those moving colors i tried to achive on each function. In the simple gerstner part, i respected the steps and my preview remains on a green glowing color. If i disconnect the " divide " from cosine and sine and plug in them the result of Lambda+DirectionDot+Time, the colors then move like in your video tutorial, but i get the noisy preview in the gerstner clusters then, resulting a very spiky ocean. If i leave the " divide " pluged in cosine and sine, the shader acts very weird, as in :

55c340a0271f217147f5a846ba2f81da5532ea04.jpeg

Hey mate, I’m having troubling following along with your video about the Blueprint setup for the buoys. I can’t seem to track everything that’s going on. Any you could post a high-res image of the entire setup so I can make sure I’m doing all the maths right?

Wow! Really believable buoyancy!

is gorgeous! :o

Sorry that I’ve been absent, I have been busy buying a house and have had very little time to dedicate to UE4.

k21n, make sure you are dividing your world coordinate by a large number. I use 10000 giving me a roughly 100m ocean tile. Not sure about the other problem.

ozzmeister00, Is there an easy way to dump a full blueprint to image or is for 4.6?

You can just copy-paste entire structure of graph. Just select all nodes, Ctrl+C. And Ctrl+V in any text editor, wiki, here :wink:
The other person needs to connect nodes with material root and pin assets, but entire node structure gonna be copy-pasted :slight_smile:

I’ve been stuck with problem for a while now. So far, can’t find a single fix.

Think you could help?

Hello! Thank you for a great tutorial!
I’m have some issues though, I’m in the process of making a boat, but its acting very bouncy. e.g. it bounces on the water up and down.
I’m using 8 test points (6 around the boat and 2 under).
Any pointers on calibrating the displacement ratio and the point thickness for each of them, or how to what to tune to get a stable buoyancy?

Thanks again for a great tutorial! :slight_smile:

Hi, i’m having some issues trying to implement buoyancy, first of all i did not manage even to make work the buoyancy for the first tutorial “render target look” in the wiki up but i’ve managed to get the gerstner wave to work as i like so now i need to add buoyancy for my actor, do i need to write the heightmapreader? or can i get the height directly from the shader itself if yes how?
Thanks :slight_smile: