computer graphics

computer graphics

pbr shader

C++, OpenGL, QT

C++, OpenGL, QT

overview

This is an implementation of a physically-based renderer (PBR) shader created with C++ and GLSL. It computes an approximation of the Light Transport Integral to render a microfacet BSDF material model with both metallic and plastic BRDFs and pre-computed diffuse/glossy irradiance.

details

For glossy reflection, I calculated the Cook-Torrance BRDF value for each light source in the scene. For diffuse reflection, I repeated this process for Lambertian BRDF. A weighted average of these two values allows me to render microfacet BSDF materials.

This is then combined with pre-computed irradiance, both glossy and diffuse, for environment mapping. For diffuse irradiance, we take samples of an environment map via the hemisphere aligned with the input surface normal. For glossy irradiance, we take samples of an environment cube map via importance sampling based on the GGX normal distribution function.

For irregular models, normal and displacement mapping is applied.