In these two months, I’ve been working on implementing the PBR rendering in my home engine (Zooid Engine). It’s still missing a couple of rendering features, but the basic PBR and the light equation is finally done. But I only make PBR works for the deferred rendering, and not the forward rendering pipe (at least, not yet).
Progress
Zooid Engine
Initial PBR work implemented using the Cook-Torrance BRDF function. The equation/function depends on a set of functions: Normal Distribution Function, Geometry Function, and Fresnel equation. There are varieties for all these three functions (see here). The functions I implemented is the same as what Unreal Engine uses: Trowbridge-Reitz GGX for Distribution function, the Fresnel-Schlick for Fresnel approximation function, and the Smith’s Schlick-GGX for the Geometry function.
Moving to PBR rendering, I need to add some additional textures and values to the material definition: Metalness, Roughness, and Ambient Occlusion. Since the PBR works done in the deferred rendering pipeline (refer to update June 2019 to see how the deferred rendering works), I need to make some changes to the GBuffer to generate a new buffer containing Metalness and Roughness value. And remove the specular buffer, since no longer needed. While the Ambient Occlusion per object will be included in the Ambient buffer.


Besides of the basic lighting of PBR, I also implemented Image Based Lighting (IBL) in the engine. There are two terms in IBL: Diffuse Irradiance and Specular. What I did is Diffuse term or called the irradiance map. The implementation of it based on the LearnOpenGL tutorial. The Diffuse Irradiance affects the ambient calculation and it’s hard to see in without the implementation of the specular term. I’m going to implement the Specular term of IBL in the next update.
The current implementation is using a Skybox to calculate the Irradiance map. It’s not ideal right now as it’s not capturing the actual irradiance map of the surrounding environment. I need to implement a probe capture that captures the scene in the runtime or pre-rendered and uses it as the irradiance map, but this will be in the next update (maybe next “next”).
Learning
- (Book) Real-Time Rendering: Halfway in Chapter 10 – Image-Based Effects, that contains Skyboxes, Billboarding, Impostors, Lens Flare, and Bloom.
- (Article) Unmasking the Arkham Knight. The rendering breakdown for Batman Arkham Knight, 2015.
- (Article) An Idiot’s Guide to Animation Compression. The article provides a good explanation of animation compression per frame/track and data basis.
- (Article) Two Performance Aesthetics: Never Miss a Frame and Do Almost Nothing. The article points out two different performance types: Do everything quick, or Do nothing. When to use one and when we can mix them up in one project appropriately.