GSnap, Polished

While preparing a paper introducing 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:
  • Divided the source into five components: Core, IO (input/output), CLI, GUI, and Viz (visualization).
  • Used the Qt Framework’s QtScript functionality to add a nice scripting interface. The base scripting language is ECMAScript (JavaScript). This is augmented with custom functions which manipulate GSnap’s internal objects.
  • Re-implemented the depth of field effect as a separate class rather than a large, complicated member function of the volume rendering class. The new depth of field  effect uses a faster Gaussian blur algorithm and produces much better results because larger blur radii are now practical.
  • Improved the performance and memory usage of the volume renderer for a given quality level by using a std::priority_queue to accelerate the neighbor search. This allows higher-quality volume rendering in a reasonable amount of time.
  • Finished the gas temperature computation and color mapping feature.
  • Redesigned the snapshot I/O to make it easier to add other snapshot format readers.
  • Added a new visualization option, “–view stars,” which is intermediate between “–view particles” and “–view flux.” Star particles are rendered as points, but they are rendered in the context of the volume renderer. This means that interstellar dust is able to obscure and redden the starlight. The results are somewhat similar to Sunrise output. This option is better than the “–view flux” option for simulations containing hundreds of millions of billions of star particles

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:


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 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 nifty looking rendering:


30 Responses to “GSnap, Polished”

  1. best wr?ter serv?ces Says:

    Our education is makes us emerge from whatever remains of the world. Individuals give more significance to the informed persons. It acts as a scaffold in the middle of us and the objectives and goals of our life.

  2. Cala Galdana Says:

    Hi there I am called Cala Galdana and I would just like to say that I enjoyed checking out your splendid blog and to wish you good luck with it in the future – Cala Galdana-Menorca

  3. Lily Says:

    It's amazing! I'm going to do my assignment and this article is really useful.

  4. Amish Says:

    All the health related fields of education are very important in our life because the health of all living beings depend on this field owing to the wide spread diseases and health problems. Our good research paper title will emphasize on the importance of medical education.

  5. instagram online Says:

    Thank you for updating! Hope to see more posts from you.

  6. luckj Says:


  7. luckj Says:

    Thanks for sharing this article and we appreciate for this it is amazing
    vape wholesale distributor UK

  8. jon Says:

    great work

  9. mirka Says:

    It acts as a scaffold in the middle of us and the objectives and goals of our life. thanks for post

    free download adobe photoshop 7.0 full version setup for windows 7

  10. ibrar judur Says:

    o wow good information thanks for sharing

  11. wiki Says:

    i needed this thanks

  12. epson T60 driver Says:

    nice post

  13. Rauji Lala Says:

    LOlz ! Check My Webs Birthday Images
    Good Morning Quotes for her

  14. sity Says:

    very nice information same like you can go to FilesAIO

  15. youtube downloader Says:

    Thank you for sharing with us,

  16. 6ixWebSoft Says:

    Good article. Regardless of the ultimate reality, it would seem prudent to have the types of matrices presented here as tools for discussions…just in case.

  17. Lenovo Driver Assis Says:


  18. fotos de bichos Says:

    que imagens lindas, e sensacionais! imagina como deve ser ver um espetáculo desses de perto!

  19. iOS Apps Development Says:

    Just two years ago, virtual reality (VR) was the chosen one of the VR/AR tech pairing, and Pokémon Go was nothing but whispers and safely-guarded intellectual property. Back then, it seemed as if only futurists were bullish on augmented reality (AR), the offshoot of VR that places virtualized objects into real environments.…

  20. Bracket TV Bandung Says:

    very good

  21. Regency Says:

    Thank you

  22. Bracket Tv Says:

    nice pict

  23. tubemate Says:

    good work

  24. Veterans Day Says:

    virtual reality (VR) was the chosen one of the VR/AR tech pairing
    happy veterans day

  25. David Says:

    You shared something very interesting. It seems how courageous you are so we are enjoying such things. Keep it up for the future as well 🙂

  26. softonic Says:

    You described it very well with examples i appreciate it. and I will be happy if you continue this effort in the future.

  27. NycJacket Says:

    Good post. Thank you for sharing with us
    Apex Legends Season 2 Jacket

  28. Happy veterans Says:

    Thanks for giving this information

  29. Williams ????? ??? ?????? Says:

    I really like your writing style, fantastic information, regards for posting :D. “In every affair consider what precedes and what follows, and then undertake it.” by Epictetus.

  30. login Says:

    If you ever heard about Hotmail, one of the first email service on the internet? All you need about this email service are on hotmail login

Leave a Reply