Physical Ocean Surface - Developing a Realistic Water Shader

I’ve been working on improving the buoyancy performance to support more floating objects. It was possible to improve the performance a lot with these two optimizations:

  1. Remove all unnecessary calculations from the blueprint to make it faster. For example, the normal was always calculated even if not needed.
  2. Don’t calculate the buoyancy force for all points at each frame. Calculate the force only every few frames, and use a linear extrapolation when no force is calculated.

The linear approximation of the buoyancy force from the past frames took some time to implement and debug in Blueprint, but now it is working beautifully. For every floating object, you can specify how many points you want for evaluation of the buoyancy force, and at which frequency the force should be calculated.
This video has 48 boxes, with four test points for each box. Every other frame, the buoyancy force is calculated for one of the four test points of each box. So it takes 8 frames to update the buoyancy force on all four test points (of all boxes). At times where no buoyancy force is calculated, the force is updated according to linear extrapolation of past values.
Using these optimizations, this scene with 48 boxes runs at 60 fps on my machine.

I think the buoyancy is now fast enough for practical applications. I plan to submit the shader to the marketplace soon, my goal is to get it done in December.