Dynamic physical ocean

[=jmietola;116538]
It seems that the OceanManager class is not included in tutorial? So basically I have to modify HeghtMapReader, I mean add those new functions?
[/]

GetRenderTargetValue was simply changed to GetWaveHeightAtPoint. The HeightMap reader is a Render Target value fetch. The ocean manager is the same class but I added MaxWaveHeight and I transform the returned value from a color to an actual vector in code instead of doing it in the blueprint.

Whatever method is used, you need to get a height value at a location to be able to apply buoyancy physics. I am thinking of making a new tutorial to replace the render target one for mathematically based ocean.

Sounds good! Thanks and great work!

Added a video of how I switch to gerstner waves instead of relying on render targets for my wave height values.

https://.com/watch?v=PBWLfpm0K0o

So with the switch over to a purely mathematical version of the code it is now possible to do all of in Blueprint only. The ocean manager noes not need to exist anymore as the material function can be replicated in a blueprint function to return height at any point on the water.

Very cool! :slight_smile: the mathematical approach seems way better :wink:

Thanks for going through all that math btw… it’s much clearer to me now.
I like how in C++ it’s like 20 lines of code while in blueprint it’s utter chaos :D… the material ends up looking way more complicated than what it is.

I wonder if you can make custom C++ nodes for materials? (is that a thing?)

[=;118294]
Very cool! :slight_smile: the mathematical approach seems way better :wink:

Thanks for going through all that math btw… it’s much clearer to me now.
I like how in C++ it’s like 20 lines of code while in blueprint it’s utter chaos :D… the material ends up looking way more complicated than what it is.

I wonder if you can make custom C++ nodes for materials? (is that a thing?)
[/]

You can write HLSL snippets for your materials, so yes it could be brought down to a small box of code.

I have created shoreline transitions 2 ways, one is realtime using nodes multiplied by PixelDepth, the other is to use vertex painting and having the nodes multiplied by the RGBA of Vertex values so you can manually paint the shoreline, yields better results but is not effected in realtime in my method.

I think project would fit perfectly at the marketplace. Marketplace Now Open For Early Submissions - Unreal Engine

When says “The ocean manager is the same class but I added MaxWaveHeight and I transform the returned value from a color to an actual vector in code instead of doing it in the blueprint.”
Is he adding that MaxWaveHeight inside his header for ocean manager or does he do it .cpp? Also I’m wondering how much he added to the header which he doesn’t show in the video?

I have the ocean working and it looks marvelous, thanks ! Now I’m doing the code section and since I haven’t coded before so I’m trying to figure out if I need to make the functions that I’m writing in the code inside of UE4 first or if the code itself will create those functions.

I have no programming knowledge so I’m doing in conjunction with the intro to programming guide so please take it easy on the jargon.

I suggest you skip the wiki and use the last video where I switch to a mathematical gerstner wave. You don’t need MaxWaveHeight or any conversions.

I’m working on the math model and I wrote out all the code which gives me a bunch of undeclared identifiers for “Texture” and “CalculateGerstnerWave” identifier not found. If I follow the buoyancy video will I set up those identifiers there? Or did I just mess up writing the code? Which I doubt because I reviewed my code to yours a thousand times. Or is there something in the header I missed?

[=Joe1029;143603]
I’m working on the math model and I wrote out all the code which gives me a bunch of undeclared identifiers for “Texture” and “CalculateGerstnerWave” identifier not found. If I follow the buoyancy video will I set up those identifiers there? Or did I just mess up writing the code? Which I doubt because I reviewed my code to yours a thousand times. Or is there something in the header I missed?
[/]

Sounds like you are missing your declarations in your header file.

Just awesome . Can you please make a plugin/kit for Marketplace, when Epic open that up? I would pay for your effort in putting all together into something I can drop into a project. Again, seriously excellent stuff here dude!

I do think is awesome - but I’m still wondering if you’d ever go to the less performance intensive route of doing the waves in code, generating a render target from there and using that in the material shader? As mentioned before, It’d remove the need to read from the heightmap entirely, and as a cheeky bonus, objects could influence the water shader too, instead of it being only one-way interaction :wink:

[=;144147]
I do think is awesome - but I’m still wondering if you’d ever go to the less performance intensive route of doing the waves in code, generating a render target from there and using that in the material shader? As mentioned before, It’d remove the need to read from the heightmap entirely, and as a cheeky bonus, objects could influence the water shader too, instead of it being only one-way interaction :wink:
[/]

In my last video, I’ve abandoned the render target approach.

awesome work :slight_smile:

[]
So with the switch over to a purely mathematical version of the code it is now possible to do all of in Blueprint only. The ocean manager noes not need to exist anymore as the material function can be replicated in a blueprint function to return height at any point on the water.
[/]

Is anyone able to get into more details about , i’m still learning UE4 and coding is not my department, i get the idea but is too vague for me, my whole project depends on buoyancy it would be a shame to just abandon it at point

Much appreciated and big big thanks to for amazing tutorial

Animated gif

Your scene looks nice.

To do a blueprint version of the ocean manager you need to recreate Getting Height at a point into blueprints. The material is already showing a lot of the math that needs to be recreated in blueprint. Start small by just doing one wave. Then build the cluster.

Everything hinges on the ability of knowing at any point on the surface how high the water is.

Amazing work!

Thanks for the Tutorial!
Bookmarked for later use.

Here is what i got so far

I added 4 clusters to my material, i also added speed and steepness variations to the clusters, smaller waves are steeper and faster, the result looks great

Thanks again