Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Why does setting InverseMass to zero on a single particle freeze all particles?
#1
Hi there,

I'm trying to completely freeze some particles while making others still simulate. I adapted the script from (http://obi.virtualmethodstudio.com/tutor...icles.html) to target certain particles and stop them completely by setting their inverse mass to zero.

But what I'm finding is that any particles that come into contact with ones with inverse mass to zero come to a complete stop as well.

This even happens if I only set the invMass to zero on a single particle:

Code:
actor.solver.invMasses[0] = 0;

I'm guessing if a particle touches a particle with infinite mass, something bugs out and causes everything to stop?

Here's a gif of one emitter shooting a stream onto currently frozen particles. As soon as the stream touches those frozen ones, they all freeze. Hmm. I would have expected the red stream to just collide ontop.
https://gfycat.com/tarttartcockatoo

Thanks for any insight!
Reply
#2
(07-04-2021, 12:58 AM)pushmatrix Wrote: Hi there,

I'm trying to completely freeze some particles while making others still simulate. I adapted the script from (http://obi.virtualmethodstudio.com/tutor...icles.html) to target certain particles and stop them completely by setting their inverse mass to zero.

But what I'm finding is that any particles that come into contact with ones with inverse mass to zero come to a complete stop as well.

This even happens if I only set the invMass to zero on a single particle:

Code:
actor.solver.invMasses[0] = 0;

I'm guessing if a particle touches a particle with infinite mass, something bugs out and causes everything to stop?

Here's a gif of one emitter shooting a stream onto currently frozen particles. As soon as the stream touches those frozen ones, they all freeze. Hmm. I would have expected the red stream to just collide ontop.
https://gfycat.com/tarttartcockatoo

Thanks for any insight!

This is the expected result for a fluid particle: density constraints try to keep constant mass per volume unit. Once a particle with infinite mass gets in the neighborhood of another particle, the only way to ensure no changes in density is to either set infinite velocity (due to the infinite pressure) or stop all relative movement (which is more reasonable behavior imho)
Reply
#3
(07-04-2021, 04:11 AM)josemendez Wrote: This is the expected result for a fluid particle: density constraints try to keep constant mass per volume unit. Once a particle with infinite mass gets in the neighborhood of another particle, the only way to ensure no changes in density is to either set infinite velocity (due to the infinite pressure) or stop all relative movement (which is more reasonable behavior imho)
That makes sense! Thanks for the speedy reply Sonrisa

The effect I’m going for is like hardening lava. First it flows onto a surfaces, then it hardens and comes to a stop. Any other lava that pours over hardened lava just flows on top and around it (until it hardens itself)

any thoughts on how to achieve such an effect? Thanks!
Reply
#4
(07-04-2021, 12:37 PM)pushmatrix Wrote: That makes sense! Thanks for the speedy reply Sonrisa

The effect I’m going for is like hardening lava. First it flows onto a surfaces, then it hardens and comes to a stop. Any other lava that pours over hardened lava just flows on top and around it (until it hardens itself)

any thoughts on how to achieve such an effect? Thanks!

You might be able to switch from fluid particles to granular particles at runtime (that behave like solids), and then set inverse mass to zero on the granulars. But to be honest I haven't tested this. Never had this use case in mind while designing the asset.

Will do some tests and get back to you.
Reply
#5
(07-04-2021, 06:21 PM)josemendez Wrote: You might be able to switch from fluid particles to granular particles at runtime (that behave like solids), and then set inverse mass to zero on the granulars. But to be honest I haven't tested this. Never had this use case in mind while designing the asset.

Will do some tests and get back to you.
Thanks Jose!

I just tested this morning and it seems like granular particles can have invMass = 0 and the fluid particles will flow around them. Woo! I just am not sure how to convert from fluid to granular at runtime.
Reply
#6
(08-04-2021, 02:48 PM)pushmatrix Wrote: Thanks Jose!

I just tested this morning and it seems like granular particles can have invMass = 0 and the fluid particles will flow around them. Woo! I just am not sure how to convert from fluid to granular at runtime.

Have an idea for this, right now I'm trying to make a sample scene to test the concept out. Will report back.
Reply
#7
Removing the fluid flag from the particle phase at runtime works well:

Code:
solver.phases[particleIndex] &= (int)(~Oni.ParticleFlags.Fluid);

This turns the particle into a granular. However, it will still be part of the fluid emitter and rendered as such by the fluid renderer (as rendering is done emitter-wise, not particle-wise), so depending on how you want to approach rendering the solidified ones this might be inconvenient.

I'm working on a sample scene that implements this, so that I can feel any potential issues/hardships of this use case in my own flesh Sonrisa
Reply
#8
(09-04-2021, 02:06 PM)josemendez Wrote: Removing the fluid flag from the particle phase at runtime works well:

Code:
solver.phases[particleIndex] &= (int)(~Oni.ParticleFlags.Fluid);

This turns the particle into a granular. However, it will still be part of the fluid emitter and rendered as such by the fluid renderer (as rendering is done emitter-wise, not particle-wise), so depending on how you want to approach rendering the solidified ones this might be inconvenient.

I'm working on a sample scene that implements this, so that I can feel any potential issues/hardships of this use case in my own flesh Sonrisa
Yeesssssssss! That's perfect! Works like a charm. I'm fine with it rendering like the fluid renderer Sonrisa

You can see it working here: https://gfycat.com/sentimentalwhimsicaldegus
(The white part has solidified, and the beige part is still fluid).

Thanks again for your help with this! I'll hopefully be sharing the end result in a couple of weeks Sonrisa
Reply