Zenith

About

This was the seventh project at The Game Assembly. In this project, we were tasked with making a third-person 3D game in our own game engine, Firefly.

My Contribution

My contribution to this project was a entirely new rendering and material system. From what I learned from the previous project “Spite: Journey to the Top” I realized that my previous system for handling custom shaders and custom materials was incredibly naive. So for this project we ran on a graphics pipeline object concept in our custom game engine Firefly. This made it easy for the technical artist to make custom vertex and pixel shaders. This also included having control over different types of pipeline states, such as rasterization state, depth stencil state and blend state.

I also added an array of different post-processing passes to Firefly. I added the Unreal engine dynamic atmospheric sky. In our mockup there was a lot of different types of visual effects that needed to be added in order to achieve the visual quality of our game. So I also added Frostbite’s volumetric fog with an array of settings to ensure that our artist could have full control over the visual quality of our game. This also involved revisiting our color correction that was added in the previous project for achieving more accurate results. Because of the setting of our game, the shadows needed to be revisited again. Because our game is outside with a lot of open area, we needed cascading shadow maps.

In this project we wanted to have a more physics-driven system. Because of this we needed a physics engine in Firefly engine. So I made the initialization and the initial work on PhysX implementation.

New Material System

The new material system in our engine offers many advantages over the old one. For example, it allows us to create a more flexible and robust shader system. We now use modern graphics API concept “Graphics Pipeline” to handle shaders and customize them for different stages of the rendering pipeline. This gives our technical artists more control over the vertex, geometry and pixel shaders. Another feature of the new material system is the pipeline states. Each material has its own rasterization state, depth stencil state and blend state. This enables us to fine-tune the appearance and performance of our materials.

Demonstration of firefly’s new material system

PhysX Implemention

Another challenge during this project was to integrate Nvidia PhysX as our physics engine. PhysX is a powerful and widely used physics library that can simulate complex physical phenomena such as collisions, gravity, friction, fluids and cloth. I was in charge of setting up the foundation of PhysX in our engine, and then handing it over to my colleagues who continued to work on it. The foundation included:

  • Mesh collider baking.

  • Rigidbodies and raycasts.

  • Multiple colliders on single rigidbody.

  • Collider work with parenting.

  • Physics materials.

  • Basic character controller.

Showcase of physics in the nvidia PhysX debugger.

UE Atmospheric Sky

I was really excited to implement a Dynamic Skybox for this project. I discovered an amazing implementation of Unreal engine’s dynamic skybox that had everything I needed. I just had to tweak some shaders and integrate it with our engine. The best part is that it allows us to have a realistic day and night cycle in our game, which adds so much immersion and atmosphere.

Unreal engine’s dynamic skybox in Firefly.

Frostbite’s Volumetric fog

I was so excited to try out volumetric fog in Firefly, a feature that I always wanted to add. I learned how to do it from a paper by EA in 2015, which showed how they used volumetric rendering in Frostbite. I followed their approach and created two voxel grids aligned with the camera frustum. The first grid stores the physical properties of each voxel, such as whether it is in shadow or not. The second grid raymarches through the first grid and calculates the fog density for each voxel based on its depth. Then when i do the PBR calculations, i just look up the corresponding voxel and multiply its color by the fog density. The result is amazing!

Volumetric Fog in Firefly.

Rendering Optimizations

To improve the GPU performance of firefly, I implemented several optimizations for the rendering process. First, I used Indirect drawing to reduce the number of draw calls and CPU overhead. Second, I added frustrum culling back from our previous game to the Indirect drawing by using an offset in the global buffer. Third, I optimized the shaders by minimizing the vertex attribute fetching, which was the main bottleneck according to Nvidia Nsight. These steps allowed firefly to run our game at 144 fps on a rtx 3060 with high-quality graphics.

Next
Next

Project 6: Spite: Journey to the Top