Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help  Calculating and Reproducing Volumes
#2
(14-11-2024, 05:11 PM)ZacharyP Wrote: Is there an easy way to calculate the volume of a fluid when its particles interact with a collider?

Hi!

Just multiply the amount of particles in contact with the collider by the individual volume of each one. Particles are assumed to be spheres during simulation, so you can use the usual formula for the volume of a sphere: 4/3 * PI * R^3.

(14-11-2024, 05:11 PM)ZacharyP Wrote: Can a known volume of fluid be reliably created when controlling an emitter's rate/duration/shape?

The volume of fluid emitted depends on the amount of particles emitted and the volume of each particle, so again this is just a matter of counting particles and adding up their volume.

You can query the amount of active particles in the emitter and multiply that with the volume of each one, then set the emission speed to zero once you're over the target volume. Note this will likely leave you slightly over the target volume since you're reacting to the volume of fluid already emitted. You could also calculate the amount of fluid that's about to be emitted, but that's considerably more mathy. Let me know if you need help with this.

It's worth noting that fluids in Obi -and most fluid simulators- are not perfectly incompressible. Unless a lot of time is spent on the simulation, fluids are slightly compressible, which means their actual volume might be less than its rest volume. This is specially noticeable with deep containers, as the pressure at the bottom of a fluid body increases with depth. Spending less time solving density constraints (in Obi, using less substeps/density constraint iterations) will result in more compressible fluid. Conversely, spending more time (more substeps/iterations) will result in less compressible fluid.

(14-11-2024, 05:11 PM)ZacharyP Wrote: Thank you for your time! Obi Fluid has been incredibly fun to work with, and I'm excited to learn more about its inner workings.

Glad to hear! thank you for your kind words Sonrisa

kind regards
Reply


Messages In This Thread
Calculating and Reproducing Volumes - by ZacharyP - 14-11-2024, 05:11 PM
RE: Calculating and Reproducing Volumes - by josemendez - 15-11-2024, 10:30 AM