Posts: 4
Threads: 1
Joined: Apr 2021
Reputation:
0
07-04-2021, 12:58 AM
(This post was last modified: 07-04-2021, 12:59 AM by pushmatrix.)
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!
Posts: 6,482
Threads: 27
Joined: Jun 2017
Reputation:
418
Obi Owner:
07-04-2021, 04:11 AM
(This post was last modified: 07-04-2021, 04:12 AM by josemendez.)
(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)
Posts: 4
Threads: 1
Joined: Apr 2021
Reputation:
0
(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
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!
Posts: 6,482
Threads: 27
Joined: Jun 2017
Reputation:
418
Obi Owner:
07-04-2021, 06:21 PM
(This post was last modified: 07-04-2021, 06:22 PM by josemendez.)
(07-04-2021, 12:37 PM)pushmatrix Wrote: That makes sense! Thanks for the speedy reply 
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.
Posts: 4
Threads: 1
Joined: Apr 2021
Reputation:
0
(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.
Posts: 6,482
Threads: 27
Joined: Jun 2017
Reputation:
418
Obi Owner:
(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.
Posts: 6,482
Threads: 27
Joined: Jun 2017
Reputation:
418
Obi Owner:
09-04-2021, 02:06 PM
(This post was last modified: 09-04-2021, 02:08 PM by josemendez.)
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
Posts: 4
Threads: 1
Joined: Apr 2021
Reputation:
0
(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  Yeesssssssss! That's perfect! Works like a charm. I'm fine with it rendering like the fluid renderer
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
Posts: 1
Threads: 0
Joined: May 2025
Reputation:
0
(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  Hi,
I saw your previous comment about working on a sample scene that implements granular particle rendering within a fluid emitter. I was wondering if you had a chance to finish it, or if it's available somewhere to check out?
I'm currently trying to implement a similar effect and would greatly appreciate any reference or insight you could share.
(For transparency, this message was written with the help of ChatGPT to ensure clear communication in English.)
Thanks again for your work and support!
Best regards
|