Dynamic physical ocean

I wanted my objects to float. This water is updating object using a heightmap lookup.


Added tutorial in the wiki

Updates: You can still follow the wiki but I’ve updated my project to used a mathematical approach.


Buoyancy tutorial: https://www.youtube.com/watch?v=kkxJeyG2whw
Gerstner Waves: https://www.youtube.com/watch?v=PBWLfpm0K0o

Looks pretty good, I’d be interested to see the code/blueprints (whatever you used) on how you did this, I’ve been looking for something slightly similar but without the ocean e.g: imagine a floating object say a flying car that when flying over uneven terrain will wobble / move with the terrains height map due to the way the air pressure underneath it is working.

I will be putting up a tutorial soon.

This is really cool. I liked watching the boxes float up from resting on the floor when the wave come.

Looking forward to seeing your tutorial for this!

Looks great!

Really cool!

Really nice. Well done!

Tutorial link added to the OP.

Looks cool, I like your ocean and physics! :slight_smile:

I’m using the same approach for ships physics, but with reading from Texture2D, not RenderTarget2D.

Btw, how do you simulate buoyancy? Are you using crossed tension dots, or splitting mesh into volumes?

Nothing sophisticated, I use a very inaccurate approximation by placing points around the hull of the ship. I then apply buoyancy at each point by dividing the mass/displacement evenly across all points. Right now it give decent non-realistic results. I plan on improving the calculation in the future.

I have not heard of crossed tension dots, what is it?

I mean the same approach - dots around the object. It’s common way, but not the best results, because it doesn’t count real archimedes force influence. I’ve used volumetric approach on Unity, and I think I should find time to move the trick to UE4 :slight_smile:

THIS IS SO COOL!!! This is exactly the sort of thing I was looking for! you did some really great work on this, I would really love to use this in my game since I am planning to make a island with a ocean that looks realistic, I tried to do in Cryengine 3 SDK but the engine was a bit too complicated for me. I will do my best to follow the wiki.

This is awesome!

Looks great!!!

Amazing work Handkor!! Can’t wait to give the tutorial a shot.

Amazing work. Looking forward for tutorial :slight_smile:

Very good work, thank you for going to the trouble of creating such an in-depth tutorial.

Is there any way to make it so the height map can be affected by actors? Like moving through the water creates ripples, etc.

I did something similar to this in UDK using a material which read it’s normals from a fluid surface actor.

Great job! I’m looking forward to the tutorial.

Yes, create another render target and have your actors render concentric circles or ripples on it at their location. Blend this target over the wave generator and send that to the render target that is read by the code. That is is you want the ripples to also affect height for other actors. If their are esthetic only then blend those ripples to the bumpmap and have them shown in the displacement map only.

Made the boat drivable