GSnap Improvements

While preparing to introduce GSnap to the world, I have refined several of the features. The code has also become more modular and the source documentation is now more detailed. Here’s a brief overview of what has been done:

In addition to that, many of the code formatting rules are now automatically enforced using AStyle and the coding guide now discourages the use of exceptions and RTTI (as do Google, the LLVM project, and others). Several GCC-specific features have been exploited in order to improve the performance of the code when it is compiled with g++. Overall, the final binary file is smaller by about 30% and the volume rendering code runs about 10% faster just because of the GCC-specific pragmas and function attributes combined with the set of compiler flags that are now used. The performance of the velocity dispersion statistics functionality improved negligibly. The hot and cold function attributes were particularly helpful.

Here are a few sample renderings…

First, a demonstration of the improved color mapping and depth of field features. The gas in the foreground galaxy is in focus while the gas in the background galaxy is blurred. This draws attention to the foreground object without the need to remove the background object from the scene. Also, note: dark red = cold gas, white = warm gas.

Without the depth of field effect, your attention is not as focussed on the foreground object, since the background object is equally in focus.

Of course, foreground objects are also blurred. This is the same system as above, but rotated so that the background object is now in the front:

The effect works equally well with visual renderings:

and

Now, here’s a demonstration of the new --view stars option without including any gas in the rendering:

That’s pretty basic. Including gas (and dust) in the rendering process makes this looks more like a galaxy:

But in a real galaxy, you generally can’t see the individual stars like this. In fact, the particles in the simulation don’t really represent stars; they are more like tracer particles which represent the density field in a statistical sense. For a more realistic representation, we use the full volume renderer, which smooths the particles into a continuum:

For a bit more fun, we can look at the gas distribution, and then do some post-processing. Here’s the gas by itself:

If we add the gas image to the star image using photo editing software like ImageMagick, GIMP, or Photoshop, we get:

The distribution of stars relative to the gas is interesting. Finally, if we add the dust-attenuated star image to the gas image, we get this: