Sign in to follow this  
Prune

Vortex particles + SPH?

Recommended Posts

A well known paper, "A Vortex Particle Method for Smoke, Water and Explosions", improves the look (if not in a physically correct way) of a grid-based fluid simulation by replacing dissipated turbulence by injecting vortex particles. What I'm wondering is whether the same can be done with an SPH-based simulation (and especially PhysX fluids) to increase the appearance of turbulence without increasing the number of particles significantly. In PhysX, I was thinking of perhaps have a number of force fields track the locations of some randomly selected particles, but this only results in the vortices affecting the overall fluid flow and is missing the influence in the other direction. Other papers I looked that are either purely procedural ("Curl Noise for Procedural Fluid Flow") or procedural-driven-by-large-scale-simulation ("Evolving Sub-Grid Turbulence for Smoke Animation") are also grid-based and I'm not sure if the ideas can be adapted to SPH. Anyone have any suggestions?

Share this post


Link to post
Share on other sites
Without bothering with vortex particles, you can make a fairly nice general swirly turbulence by taking the gradient of a Perlin noise and rotating that gradient (45-90 degrees) around whatever axis you want your vortices to swirl around. This has low divergence and looks a lot more natural than using Perlin noise as turbulence directly.

I know nothing about PhysX - what particle properties it maintains, what you can extract, what you can feed back in - but you'd only want a synthetic turbulence effect to appear where particles have been disturbed. See if you can extract pressure change, temperature change, or the total magnitude of the interparticle forces exerted on each particle, to get a 'disturbance' value that you can use to scale your synthetic turbulence. You don't need to buffer it - the turbulence you feed back into the system will 'disturb' the next frame and it will fade out gradually.

It's not ideal, but it's cheap, and it has the added benefit that you can use that curly turbulence to advect non-fluid particles, too, like airborne snow, leaves, & dust, which is great if you need eddies & dust-devils.

Share this post


Link to post
Share on other sites
Your idea is similar to the curl noise paper, which creates a Perlin Noise field and takes the curl of it to create divergence-free turbulent velocities. The octaves of noise then gives the usual appearance of scaling of large to small eddies one sees in real turbulence. The noise can be scaled to be high near solid objects the fluid goes around, etc. As an extension, the noise can be evolved as in flow noise: http://evasion.inrialpes.fr/Membres/Fabrice.Neyret/flownoise/index.gb.html

But once I have a velocity field from a method like yours or the curl of noise, I still need to use it to affect the appearance of the particle fluid. That's why I was thinking of applying a forcefield to the particles. Alternatively, I could advect a procedural noise texture which would give finer detail, but it's a really heavy shader http://www-evasion.imag.fr/Publications/2006/AN06/other/flownoise.cg for the 2D case alone. To apply to the surface of a 3D fluid I could take the density from a 3D texture that I already have to compute if I'm doing marching cubes to render the fluid, but if I switch to say screen-space meshes then it would be an extra step and might be cheaper to just use several times more particles...

Share this post


Link to post
Share on other sites
I'm not an expert on the subject, but I've played with fluids -- almost all SPH, very little grid-based stuff -- a little bit. IIRC, it was Jos Stam's thesis that I was working with mostly, but when I go back to his page I don't find quite what I remember, so that might be wrong.

In any event, I tried implementing various "real" Navier-Stokes-based SPH simulations, and also various ad-hoc schemes involving reasonable interparticle forces I'd dream up, and frankly the ad-hoc stuff tended to look just as good if not better to me; plus I understood it better, and it was easier for me to informally sketch proofs to myself about it for things like stability (in a Lyapunov style).

I understand that vortex particles arise naturally from the Navier-Stokes equations themselves, so AFAIK it's entirely possible to do SPH with them in a principled way. However, if I instead start thinking in this "let's invent some reasonable ad-hoc forces and see what happens" style, then vortex particles are still something that makes sense to me, in the following way:

One could simply give each particle 'i' a state that includes an angular momentum vector 'omega_i,' and then include a rotational viscosity force that exerts a force Fij on a neighboring particle j in the direction ((r_ij [cross] omega_ij) - v_j), scaled by distance (e.g. using the poly6 kernel). This would explicitly model curl.

-- EDIT ---
Actually that's not quite enough by itself because you need a notion of "where" a force is being applied to a particle and how to compute a torque on it (to impart the angular momentum in the first place). The obvious answer would be to impart the force at the midpoint between the two particles on each of them (or at some point a distance between them scaled by the particles' weights). If you wanted to make this kind of thing principled I bet you could cause something like this to pop out of an integral over space weighted by a smoothing kernel, but honestly I'd probably just screw around with it. Then again, you may be aiming for a deeper level of mastery of the subject than I was at the time; I wasn't interested so much in physically-accurate simulation as (1) aesthetically pleasing results, and (2) inspiration for designing multiagent control laws (flocking behavior and SPH fluids are so close mathematically that it seems a natural place to get some ideas from...).

Anyway, those are my thoughts.

[Edited by - Emergent on March 19, 2010 1:02:14 PM]

Share this post


Link to post
Share on other sites
Quote:

But once I have a velocity field from a method like yours or the curl of noise, I still need to use it to affect the appearance of the particle fluid.


Yeah, I was assuming you'd be applying a force directly to each particle, without storing a velocity field at all. That way you're only sampling the Perlin gradient (and swizzling it) once per particle per step. Does PhysX let you push individual particles around?


Also, if you wanted to be able to advect your velocity field without even storing one, you could just store an additional vector per particle: very_old_position - and use that as the input for your turbulence function. The very_old_position would be updated on each step to something like: lerp(very_old_position, current_position, dt * catchupspeed).

What for, you ask? For having eddies that appear to travel with the fluid flow. Sampling the turbulence where particles used to be has the same effect as advecting the turbulence field itself.

The simpler you keep it, the more CPU/GPU time you have left for more particles. Everything looks better with more particles - it's a fundamental law of physics.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this