r/UnityAssets • • Nov 22 '21

(75.00 USD) Tools/Physics Advanced Buoyancy: Realistic and efficient floating physics simulation. WebGL demo/toy in comments.

37 Upvotes

15 comments sorted by

2

u/zibas Nov 22 '21

Hi!

This asset simulates buoyancy, drafting and lift (underwater wing-like forces) with no per-object setup. Just create an area and throw your rigidbodies with collider in.

I made it in 2015 and gave a talk about the math behind it at Unite:

https://www.youtube.com/watch?v=OOeA0pJ8Y2s

This year I completely rewrote the internals to multi-thread way faster.

Even if you have no interest in the asset, playing with the webgl demo for a few minutes is a good time, I promise:

http://popcannibal.com/watervolume/webgl/

1

u/Gooren Nov 22 '21

Thanks for sharing the asset. What does it do better than Dynamic Water Physics 2?

I'm asking since I already own DWP2. And your asset being more expensive suggests there could be something in switching over?

2

u/zibas Nov 22 '21

Excellent question! I'd be happy to send you a free copy if you want to do your own comparison and report back.

From looking at the DWP2 store page and demo, I don't think it's simulating as many forces or targeting as many objects. So I believe Water Volume will be significantly faster and more realistic.

On the pro side for DWP2, it advertises ready integration with several water assets. Water Volume can be extended to work with various assets but the only example included is for Playway Water.

1

u/Gooren Nov 23 '21

I'm always down for extra realism, specially since we're working on an immersive sim game. So I would love to try push your asset to the limits.

I also like the fact your asset doesn't seem to require simplified convex colliders for each and every single object to work at all. Advanced Buoyancy seems to just use Raycasts?

One downside is the missing Crest ocean system integration, yes. I can do that, probably, but Crest doesn't use water volume colliders, it uses some queryable height API instead. So I would have to see about that.

2

u/zibas Nov 24 '21

Ahhh! Now I'm too curious. I'm taking a pass at it myself tomorrow. I'll shoot you a copy regardless of how my quick attempt pans out.

1

u/Gooren Nov 24 '21

Can't wait to try it out 👍

2

u/zibas Nov 25 '21

Made a really quick pass at it this evening. It's a hack job for sure, but a great proof of concept. Here's a video of over 1,000 objects floating on a Crest ocean at around 60fps (in editor) on a 5900x.

http://popcannibal.com/share/CrestProofOfConcept.mp4

It doesn't do any horizontal displacement, but I don't believe that would be too hard to add. And it can be made way more efficient.

I'll message you a package voucher and a link to my hack.

1

u/anythingMuchShorter Nov 23 '21

Just think how terrifying an underwater survival game with huge debris fields, large submerged structures and realistic buoyancy could be.

1

u/zibas Nov 23 '21

That would be awesome. A little different, but I originally created this asset for a boat building game: https://www.youtube.com/watch?v=pERCMX8wM3s

1

u/kapalselam Nov 23 '21

Looks awesome.. Does it integrate well with other water assets? For example Lux Water?
I've been using Dynamic Water Physics 2 and it has been top-notch so far between these two. Just curious how your buoyancy solution could be better as an alternative than what I have now.

2

u/zibas Nov 23 '21

Thanks! For flat surfaces, there's no need to integrate, just align the shapes. But as far as reading the wave heights out of a water asset, only (the sadly depricated) playway water is included. So other waters would take some work to copy that example. Seems like doing those integrations should be next on my todo list.

1

u/kapalselam Nov 23 '21

Awesome :) Looking forward to seeing your plugin evolve. The more option in this space is the better.

1

u/lidiamartinez Nov 23 '21

Hi , congrats for your assets! I just released Buoyancy with WaveMaker, so seems like we share some stuff in common. I'm interested in the forces you apply. I'm applying them on the grid positions and calculate volume occupancy, using Jobs everywhere. If you do this, were you able to remove aliasing? Doesn't seem like there is any. I fixed it in the last version.

By the way, I do have a component you add to make objects interact with the water surfaces. That's because people asked for it, to have objects that weren't affected.

Also It works with overlapped colliders in the same RB. It took a while to fix that...

Thanks for the talk!

1

u/zibas Nov 23 '21

Cool! We should form a club (or a support group).

If I understand your question about aliasing right, my solution is to sample the object volume and velocities using a grid that's in local space relative to the object being sampled. So the sample points remain stable as the object moves.

I also have an optional component which allows you to mark objects not to be affected! (or to mark them as wing shaped objects which should receive lift forces).

2

u/lidiamartinez Nov 23 '21

Oh, intresting. Haha. The club will have 4 people, I guess... not too many fighting the good fight.

Well, I calculate a lot of data inside each of those "interactors" on demand from the surface. So I need the components to keep it modular.

That's another solution for the aliasing, yes!... I neverthought about it. Maybe voxelizing objects before starting, too, that'd make the projection into the surface easier. Since Raycasts were not working well (RaycastCommand has problems with multihits, it is documented but doesn't work), I ended up creating my own multihit solution, and finally I removed all and started creating my own native colliders, raycasts... then moved all to raymarching . It took several months of suffering but now it's fast and really smooth... phew. (check it out here, in case you're curious: https://www.youtube.com/watch?v=MSm3bNOtnh4)
Now I'm calculating forces inside jobs, too. I just reduced 30% of the frame FixedUpdate() , moving all that to a job instead of calling Complete() to run "ApplyFroceAtPosition". I'd have to store all those forces in a huge nativearray...

Well. Slowly I keep making it better. But it's really cool now playing with all the params.