Design a site like this with WordPress.com
Get started

Ahmad Fauzan

Game Engine Programmer

Game Programming Journey – March & April 2020

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.

Metalness value in the red channel and Roughness in the green channel.
Final Result

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

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: