NVIDIA VXGI & HBAO+ Lighting Systems

Author: 

Over the summer, I was able to work on a project in Unreal Engine 4 every day. The project required realistic features such as realistic lighting mechanics. The problem was that, although Unreal Engine is amazing and my go-to engine, it doesn't support real time dynamic global illumination like its competitors. This leaves a lot of developers wondering if they can even make their game in Unreal based on these limitations. That's where NVIDIA technology stepped in.

 

Before we go any further, I'd like to explain what different types of lighting mechanics are generally used in game engines. When we look at games, there's generally two main lighting techniques; baked lighting and dynamic lighting. Baked lighting is where all the lighting is pre-computed into the scene and onto the objects before the game is actually even played. This usually achieves the highest level of quality when it comes to lighting as the engine/renderer has multiple hours or even days to calculate how the lighting should look. Calculations mainly include where light sources are, how strong they are and with all that, how and where their rays should bounce.

 

Dynamic lighting is quite the opposite. Little to no lighting is pre-computed and all calculations are done in real time. This is what most engines refer to as dynamic global illumination. Unity and Lumberyard, the two main competitors of Unreal Engine in my opinion, both have some type of dynamic lighting. Unity uses Enlighten and Lumberyard uses voxel based systems to compute these calculations in game. Unreal bakes lighting beautifully, but as of right now, has no built in dynamic GI (global illumination) system to achieve multi-bounce lighting.

 

Voxel based lighting theory shown below:

 

If we take a normal directional light in Unreal Engine 4 and rotate it towards the scene below it, we will be left with black shadows where the rays aren't hitting. UE4 has something called a skylight to solve this problem which basically adds lighting to every object in the scene. Skylights are great if we are baking lighting (pre-computing.) However, during real time they become an issue as without being baked, they light up the entire scene. This means that the inside of houses that should be dark are actually lit up with artificial light. On the other hand, we might end up with results of it being dark inside, like we want, but too dark with shadows outside. This takes us back to why something like the sun needs NVIDIA technology, or something similar, to achieve dynamic GI in Unreal Engine 4.

 

Regular directional light with no skylight, baked lighting, or VXGI implemented:

 

Many developers want to use Unreal Engine to make their open world games. However, without a built in dynamic lighting system, they are left with having to make their own. They cannot simple bake the light since the sun doesn’t sit in one spot; it rotates around the world. NVIDIA noticed this problem and stepped up to help developers all around the world. They developed something that they call, "NVIDIA Gameworks" which are various systems built into source builds of Unreal Engine. For example, they have a system called HairWorks which allows for extremely realistic hair mechanics (see image below).

 

 

Their main systems, and the systems I used over the summer, are VXGI and HBAO+ which stand for "Voxel Based Global Illumination" and "Horizon Based Ambient Occlusion Plus." VXGI uses the same technique Lumberyard has built into their engine which uses voxel based lighting to calculate multi-bouncing light rays. HBAO+ adds realistic Ambient Occlusion shadowing and shading around objects and surfaces that occlude light, with a considerably-higher degree of precision than previous AO techniques (see examples below).

 

VXGI example of fully dynamic global illumination with voxel based lighting:

 

 

HBAO+ example with references of where shadows are being drawn by real-time calculations:

 

 

Many games, such as the most recently popular Player Unknown's Battlegrounds, were built in a source build of UE4 (Unreal Engine 4) using NVIDIA's HBAO+ system to achieve the lighting results they wanted. By using NVIDIA’s Gameworks technology (VXGI and HBAO+) we are now able to achieve that multi-bouncing lighting system with accurate shadows during run time. This then allows us to have scenes that are fully dynamic with their global illumination.

 

To be able to use these systems you must sign up to be a developer and get accepted by Epic Games on their website linking a GitHub account. Once accepted, which only takes a couple of days and nothing more than a request, you have access to all kinds of source builds on different GitHub repositories. This includes the default source build Epic Games works on every day. Once accepted, you can find a source build that includes the software you want and begin the process of compiling the engine. This takes some time to learn how to do which can tedious and confusing, but there's plenty of documentation online for it. The other tricky part is finding compatible versions to fit what systems for want with what engine version you want to use. For example, wanting to use the newest Unreal build with just VXGI and HBAO+ can be difficult to find. Since these systems are not plugins and can only be used with source builds of Unreal Engine (at this time) it becomes a searching game for developers.

 

As for my results with the systems, (I used a UE 4.14 source build with VXGI and HBAO+) I enjoyed and was amazed at their technology. However, regular gaming technology hasn't been able to catch up with these types of calculations yet. NVIDIA Gameworks is extremely powerful but hard to implement fully without killing a regular computer’s CPU. My team and I were not able to use VXGI as it was too intensive for our scenes in UE and killed any frame rate we had. Another problem we had was with the source build part of it. It’s hard to use plugins on top of the NVIDIA systems as sometimes certain plugins won't "play nice" with each other. It's also quite tedious to have to use a version of UE4 from last year to use the technology desired. Either way, it was an awesome experience to be able to learn and use this technology. I hope to revisit it someday and see what I can come up with!