How to make a volumetric gradient / fog / haze

Hello!

I am trying to come up with a way to visualize the gravitational forces in an n-body simulation.
Basically, I want the player to be able to see where there are stronger gravitational forces.

I was thinking of doing something like a volumetric haze that gets stronger where the gravity is strongest, sort of like colored fog. Something like this image: http://www2.sjs.org/raulston/mvc.10/Topic.2.Lab.2_files/image139.gif
except instead of arrows, a smooth fog with gradient coloring nebula effect, eg something like the effect in these two assets: Unity Asset Store - The Best Assets for Game Making and Unity Asset Store - The Best Assets for Game Making

I would give those assets a try, but I actually want a gradient and not a solid color, and the “shape” of the fog is not going to really fit a primitive like a cube or sphere very well.

One idea I’m considering is a particle effect where I programmatically place all the particles in a 3d grid and adjust each particle’s color individually. I think that will work, but it’ll probably be a lot of particles, which is why these fog-like shaders seem like an interesting way to go.

Thanks in advance for any tips or ideas!
Alex

I was able to come up with something that demonstrates what I’m going for:

I did this by creating a 3D grid of particles, and setting their alpha to a value reflecting the local gravity at each point in the grid. While this sort of works, it doesn’t really look “quite right” because I’m sort of cheating the volumetric-fog effect with particles instead of using some kind of shader that actually does volumetric fog. So I’d still be interested in any ideas on how to make this sort of ‘volumetric’ fog effect in an arbitrary shape (ideally based on a grid of intensity values).