Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help  Fluid Particles interaction Script
#3
(19-11-2020, 12:50 PM)josemendez Wrote: Hi there,

I think you're mixing up concepts here.

Fluid particles interact with each other using a kernel or support function. A kernel is basically an area around each particle, where density (amount of particles per volume unit) is measured. If there are too many particles within the kernel, which means local density is too high, a repulsion force (pressure) is applied to all particles around the center particle in order to decrease density. If there are too few particles, an attractive force is applied to increase local density. That's how fluid maintains constant density, which is what makes fluid behave like fluid.

Because of this, particles do not collide with each other, because they're not solid. They interact via constraining density within each kernel.

Vorticity and temperature have nothing to do with this. Vorticity measures how "swirly" the fluid is at a point, and temperature measures well, temperature. They play no part in particle interaction whatsoever.

Since you can't access particle kernels directly, you will need a way to know if a particle has neighbors that belong to a different type of fluid. You can use the diffusion data channels for this. Each fluid blueprint has 4 channels of diffusion data that you can give any meaning to. These values will be averaged between particles inside a kernel, so if you give fluid A a diffusion value of (1,0,0,0) and fluid B a value of (0,0,0,0), at runtime you know that any particle with a value other than these (for instance, 0.5,0,0,0) it must be destroyed because it has been within the kernel of particle of the opposite type.

You can check the FluidMixing or Raclette sample scenes for some examples on how you can use the diffusion channels. In FluidMixing, the diffusion channels are used to drive a color gradient. In Raclette, they're used to drive fluid viscosity and color.

I hope this makes sense, fluid simulation is quite complex and can have a steep learning curve at the start.

Hi, first of all, do you speak spanish aswell? XD

The diffusion data channels are edited in the inspector or by code? I´ve tried using the sample scene codes to make a particle destroying script (instead of destroying it sets particles lifespan to 0) but had no success. The fluidmixing interaction is what i look for (with particles disapearing instead of changing color) but im not able to get a working script... What part of the fluid mixing script do i have to change in order to get the interaction i need?

Thanks for the quick reply!
Reply


Messages In This Thread
RE: Fluid Particles interaction Script - by JoseCarlos S - 19-11-2020, 01:57 PM