I’ve been working on creating a realistically accurate fluid surface that involves not only Water-To-Object coupling (buoyancy and other forces) but also Object-To-Water coupling (objects creating dynamic waves on water surface on interaction). Being a physics engineer myself, the nature of waves is very understandable for me. It took a lot of research and a bit of theory-crafting (and much, MUCH more math ) but I think this is actually possible to do now! Anyway, I got very excited for achieving some kind of success with this so I couldn’t stop myself from sharing it and seeing what you think!
Before I get into more detail, here’s what I’ve got so far: (excuse the horrible looking water, it’s just a simple water shader for testing purposes)
Not only that, but these waves also have reflection capabilities - they reflect off of the walls! To illustrate :
**This is a physically accurate water model as well! ** Creating a water surface that has buoyancy (floating objects) is relatively easy with the use of Gerstner wave equations (a lot easier if you’ve worked on quantum wave equations for a few years :D). I believe Handkor was the first to implement this and he even has an amazing tutorial for it. This however gives us only roughly ~1/3 times the accuracy as compared to what is actually going on a fluid surface, since there are 3 main different forces (for simulation purposes at least) acting on an object when it is interacting with a fluid surface and we are accounting for only 1 of those. These are; buoyancy, drag and lift forces. This is what creates the motion that makes the tip of a speed boat go up and down in water (it’s mainly the lift force).
Anyway, this water model actually has all those 3 forces, meaning that it is physically accurate. I got too excited when my idea of creating realtime waves worked that I couldn’t get down to recording a video for the physical aspect of this model, I’ll have one asap
With this model, the ambient waves on an ocean surface interact with the waves created by the object and vice versa thus creating a fully realistic fluid surface look and feel. I did not yet take the time to adjust the coefficients in the equations yet so that’s why the waves you see in the videos are somewhat unrealistic right now.
The generated waves apply only a vertical deviation on the surface for now, I have not yet figured out the method to effectively add in the longitudinal deviation. That’ll really enhance the visual realism of the waves by causing them to be somewhat steep.
The waves are generated realistically and according to the surface of the used mesh. What this means is that the waves change according to the relative speed(to the surface), shape, area etc. of the faces of the mesh.
Mathematically, the waves are generated with about 10% of error and the physical accuracy of the water (both when it is just floating and when it is moving on the surface) has about 7% error to it, provided that the coefficients in the equations are within acceptable error rates themselves as compared to the faces of the used mesh. The physical accuracy can be further increased by accounting for more of the forces aside from the 3 we are using, but unless you want to use this for academic purposes I don’t think that is necessary. You can decide for yourselves when I record a video of it being propelled in a wavy surface
This is being done for a game that I’m in charge with developing; however if I can further refine it to have an optimal performance cost then I’ll probably take the time to release a very small game/project that basically simulates fluid surfaces and lets you experiment with them with all the physical aspects (kinda like what BeamNG Drive is doing). It may also end up having academical uses.
This is a very broad work to sum up so feel free to ask any questions and I’ll be happy to provide details and answers accordingly! I’m sorry for making this post so disorganized but I simply got too excited! Effective and physical fluid surfaces have been the open wound for games (:p) since actual fluid simulation methods are impossible to use for real-time purposes due to their exceedingly high performance costs. How cool would it be if UE4 would be a platform for this to be possible in!!
If this is not just me rambling and this is actually an interesting and exciting topic for others as well, I’ll take the time to refine this post into a proper form from where the development of this model can be easily tracked!
This is all based on the Wave Particle theory by Cem Yuksel : http://www.cemyuksel.com/research/waveparticles/waveparticles.pdf - that’s where all the math is coming from for my implementation!