So I have spent the last several days trying to do a proper 3D version of my fake fluid flow stuff.
Having some problems.
1. Cannot seem to get a divergence free velocity field on the surface of a sphere like I can for a 2D plane. Not totally sure why. Might have to do with error deciding if the noise gradient is "uphill" or "downhill". Adding a fudge factor to correct (somewhat) for one error in that area helped (reduced divergence) but what i thought should be a perfect correction was worse than the fudge factor. So... yuck. Not sure what's going on there.
2. Still have issues with discontinuities at cubemap face boundaries. Drat. The whole point of doing the sim in real 3D was to get rid of those. Haven't really tried to debug that, might turn out to be something simple, but... not happy to see those discontinuities.
3. libpng sucks.
The initial particle colors are taking from an starting image. Right now that image must be 1024x1024 or it won't work. That's due to me not being able to figure out wtf is going on with libpng. Seems like it should be simple, but... it is the exact opposite of simple. Or I'm suffering some kind of brain lock on the issue, I don't know. Spent entirely too much time on it before just manually scaling the input image to the same size as the output images and giving up on that aspect for the time being. (if 1 and 2 can't be solved, 3 doesn't matter.)
Oh, btw, if you want to play with this mess, I checked it into master of space-nerds-in-space repo on github. The program is gaseous-giganticus. You will need a 1024x1024 png image as a starting point in the current directory that is named "gas.png" (you have to make this yourself. I suggest some cropped image of sedimentary rock formations from arizona found by google image search. Antelope canyon is also a good gis term. but anything will do, so long as it is cropped/scaled to 1024x1024 and name gas.png.) Then it will dump out (and overwrite, many times) files called tmpg-0.png (and 1,2,3,4,5 as well as 0). You can view those with, e.g. gqview or other image viewing program, and also mapped onto a sphere with mesh_viewer (part of space nerds in space code) by "mesh_viewer -p tmpg-" command.
A pic of one cube map face output. The gray areas, and esp. gray areas bordered by black with particles leaving the area are the divergences.
And on a sphere:
Those are with, iirc, 1M particles. 8M particles looks a bit better (divergences are somewhat hidden by the mass of particles.)
-- steve