HaloRay - GPU-accelerated ice crystal halo simulator
I have always been extremely fascinated by atmospheric optics like ice crystal halos. Halos form when sunlight, moonlight or artificial light refracts inside small ice crystals in the atmosphere. When these ice crystal populations cover a large enough area in the sky, you can see various light formations like spots, arcs and circles. They are relatively simple to simulate by tracing rays through simple hexagonal ice crystal shapes.
Many simulators have been built in the past, but they are all relatively slow and/or clunky. I knew the simulations could be accelerated a lot by using beefy graphics processing units (GPUs), which are pretty common place in computers, especially high-end gaming PCs. Every ray of light passing through an ice crystals is independent of other rays of light, so light rays can be simulated in parallel. GPUs contain hundreds or thousands of small processing units which are slower than your average central processing unit (CPU), but they vastly outnumber the CPU cores. So instead of simulating 4-32 rays of light in parallel on a CPU, hundreds or thousands of rays could be simulated on a GPU.
Raytracing with GPUs is pretty commonplace these days in games and the movie industry, but it hadn’t yet been explored in ice crystal halo simulations.
In 2019 I started writing HaloRay, a halo simulator where all the computation happens on the GPU. HaloRay 1.0.0 was released in the summer of 2019. At the time of writing we are on version 2.4.0. HaloRay is open source, and the source code is available on GitHub. Ready-made binaries are available for Windows. HaloRay works on Linux too, but at the moment requires you to build it yourself. You also need a GPU that supports at least OpenGL 4.4.
HaloRay has been designed from the start to be very interactive. Nearly every parameter can be tweaked in real time when the simulation is running, which makes it very intuitive to understand how different parameters affect the outcome.
The actual simulation code is built with OpenGL Compute Shaders, which work well with both NVIDIA and AMD GPUs. I contemplated on learning CUDA, but that would limit users only to NVIDIA. The UI is built with Qt 5 and C++. Right now UI parts of the codebase are pretty messy, and I am rebuilding most of it in a separate Git branch, but that has not reached an official release yet. I don’t especially love C++, but it seems to have the most mature cross-platform UI facilities available at the moment.
I have been pretty busy with my day job and building The Other Computer website, and doing various other projects, but I can promise you HaloRay has not been forgotten!