16-04-2019, 07:26 PM
(16-04-2019, 12:52 PM)mimarilker Wrote: I have resolved the problem by calling "alive = ps.GetParticles(particles);" in the "Solver_OnStepEnd" (see the attachment). However, I couldn't colourize unity native particles according to the other parameters like viscosity and vorticity. I am trying to colourize particles according to pressure. I thought that in this version it is possible. Btw, I can do colourize Obi particles according to pressure with ObiParticleRenderer like that;
void E_Solver_OnFrameEnd (object sender, EventArgs e)
{
if (!isActiveAndEnabled)
return;
for (int i = 0; i < emitter.particleIndices.Length; ++i)
{
int k = emitter.particleIndices[i];
float density = emitter.Solver.fluidData[k][0];
float restDensity = emitter.Solver.restDensities[k];
//calculate pressure
float Pressure = (density - restDensity) ;
//colorize Obi Particles according to pressure with considering user defined min and max values.
emitter.colors[i] = grad.Evaluate((Pressure - min) / (max - min));
}
}
Sorry for posting too much, but the script that I attached seemed to work to me, however, I have noticed that it's very problematic with respect to performance. So please don't consider it as a solution.
Hi,
I believe we answered all your questions via email. Please check it out!