Obi Official Forum
How to squirt liquid out, drop by drop? - Printable Version

+- Obi Official Forum (https://obi.virtualmethodstudio.com/forum)
+-- Forum: Obi Users Category (https://obi.virtualmethodstudio.com/forum/forum-1.html)
+--- Forum: Obi Fluid (https://obi.virtualmethodstudio.com/forum/forum-3.html)
+--- Thread: How to squirt liquid out, drop by drop? (/thread-2249.html)



How to squirt liquid out, drop by drop? - emz06 - 19-05-2020

Hi,

I'm trying to generate liquid by the drop, like shampoo squirting out of a bottle.

I tried to quickly decrease emitter's speed to zero, but that's not a reliable way of doing it.


I suppose I have to use Burst instead of Stream for that.

-How can I control the maximum amount of particles that are generated for every burst of particles?

-Also, is there a function to burst out a certain number of new particles, or do I have to make it myself?


Thanks in advance


RE: How to squirt liquid out, drop by drop? - josemendez - 19-05-2020

Hi,

"Burst" mode works by emitting as many particles as distribution (spawn) points in your emitter shape, just once.

The number of particles emitter can't be directly controlled, because allowing it would be a terrible idea. Fluid emitters are not like regular particle systems, in which you can emit as many particles per frame as you wish, with no consequences. The property that makes fluid "fluid" is constant density, and each particle represents a fixed amount of mass, so it's better to think in units of volume/time (https://en.wikipedia.org/wiki/Volumetric_flow_rate).

To picture why: suppose you have a fluid with a density 1000 kg/m3 (that of water), and a resolution of 1 (1000 particles/m3). Each particle would have a mass of 1kg. If you decided to spawn 10 particles at once in the same location, that would yield a density ten times higher that the fluid has at rest (10000 kg/m3), causing a huge pressure spike and a fluid "explosion". Particles would be flying everywhere.

To prevent unphysical behavior (explosions, flying fluid, etc), the emitter only allows you to indirectly control the flow rate, by exposing the speed at which fluid is emitted (because if I directly exposed flow rate or flux instead, there'd be a crowd with pitchforks and torches on my door right now). Particle amount, placement, and spawn rate are automatically calculated (from emitter area, fluid resolution and rest density) to eliminate pressure spikes.

If you need to emit progressively less fluid, the only way to do so safely is to decrease the emitter speed I'm afraid. This does not give you fine control over particle count, but when working with fluid you can never have it anyway.