ufna / VaOcean

[DEPRECATED] Ocean Surface Simulation Plugin for Unreal Engine 4
MIT License
304 stars 135 forks source link

Querying Ocean Properties at a Point #47

Open FrogBottom opened 6 years ago

FrogBottom commented 6 years ago

Hey there - I know development on this plugin has slowed and that the direction has changed somewhat, but I've been working off of the pull request #46 for 4.19 compatibility, and as I understand it, ocean surface queries for collision, buoyancy, spawning spray, etc. were originally planned for VaOcean but largely unimplemented. I wanted to ask your thoughts on what method such an extension was originally going to use, and if it has not been added simply for lack of development time or if there was a roadblock that makes it infeasible.

It might just save me some time to know if it's impractical before I go too far down that rabbit hole myself!

As it stands, my first attempt was a simple read operation from the displacement Render Target. UE4's Render Target implementation doesn't make this a very viable option - such a lookup costs ~5.5ms of frame time on high end hardware, and ~9ms on low end hardware (although position lookups are very cheap after the flat cost of the read operation).

This can't really be pawned off onto the render thread in a non-blocking way either, as the write operation still has to happen every frame, and so must wait for a read to finish. Lowering the patch size to 256 and decreasing the Render Target color depth to 8 bit both help, but not nearly enough to justify the quality loss.

My only other idea is to try running a second FFT simulation on CPU (likely with a smaller patch size of 128) which is used only for position lookup, and not written to texture memory. The lower resolution is probably fine, as buoyancy simulation or particle spawning don't need full precision. I'll have to find a C++ FFT library, as I don't quite have the chops to implement such a thing myself.

My questions then are these:

Thanks in advance!