tessarakkt / godot4-oceanfft

Tessendorf FFT based ocean waves and buoyancy in Godot 4 using compute shaders
MIT License
372 stars 18 forks source link

Planetary curve #17

Open slakibk opened 8 months ago

slakibk commented 8 months ago

If the curvature of the planetary surface is greater than 0, then when moving away from the center the ship sinks under the underlying surface.

QuinnLeavitt commented 8 months ago

Could this be a collision issue where the curvature is causing a gap in the water surface?

tessarakkt commented 8 months ago

There isn't actually a "collision" that happens with the ocean surface in regards to the physics engine. The buoyancy body doesn't collide with the surface but rather probes the depth at certain points (the buoyancy probes) and applies a upwards force based on that.

Ocean3D.get_wave_height() is what calculates this height and should be accounting for planetary curve as far as buoyancy is concerned. The visually rendered planetary curve is entirely handled by the visual shader in the vertex() function. Any discrepancies between the rendered surface and buoyancy is in one of those spots.

Also potentially at play is the fact the surface mesh decreases in resolution with distance, and depending on how the waves work out that could result in the buoyant object appearing below the rendered surface.

I haven't had a chance to look at this closely though yet.