This week was a busy one! Both graphics and gameplay saw some new features implemented, and many bugs were squashed in the process! Visually, the most prominent of the updates are the lens flares and star glow fixes. In the past, stars would glow whether they were occluded by and object or not. Now, stars will glow and produce lens flares if you look towards the light source. Any object (planets, spacecraft, etc) can occlude the light in real time. This produces some very neat scenes where the star flickers as objects pass in front, or when you get hit with the morning sunrays.
The lens flare effect was accomplished using a nifty OpenGL feature called occlusion queries. It works like this: A quad is rendered at the star location at the end of a frame. The depth mask is activated so that the depth buffer is not written to. Depth test is left enabled and the query is sent to the GPU. At this point, we would have to wait for the occlusion result. However, for lens flares and star glow, a single frame delay is not very noticeable except at low frame rates. So, we simply use the previous frame occlusion query result. This prevents stalling the GPU to transfer data to the CPU and produces very nice results! The occlusion query provides information about how many framebuffer samples passed through the shaders. This let’s us know if the star is occluded, and therefore whether we should render a glow and flares. Once this is determined, a simple screen-space rendering algorithm is used to create the lens flare effect. Look at the screenshots for the very cool end product!
Gameplay also had some updates. As you can see in the above screenshot, there is a new HUD object available, Orbit HUD. This HUD computes your current Keplerian orbital elements and displays them in real time on a 3D globe. This is a very useful display for calculating orbits and trajectories. And now that you can easily determine your current trajectory, it is much easier to fly the spacecraft into an actual orbit. The making of this HUD exposed some issues with the PI-PR (Planet Inertial and Planet Rotating) reference frame equations that have now been patched. With the addition of a prograde indicator, it should be much easier to perform burns and control your orbit.
With these two updates, the game continues to feel more like, well, like a game everyday! It has a long way to go, but each update encourages me to add further features. As gameplay elements are implemented, I hope to start defining what kind of game this will be. The objectives, the challenges, and the general experience are all beginning to unfold. I’m excited to see where the game takes me next. Hopefully, I can come up with a fitting name!