This repository hosts an implementation of a physically-based rendering (PBR) algorithm for rendering an object in a dark room. The project has been completed as part of a lecture offered by the Visualization and MultiMedia Lab in the Department of Informatics at the University of Zurich, Switzerland.
In a dark room, the ambient light is close to zero. Therefore, four lights ensure that the object is visible from every angle. This project implements a bidirectional reflectance distribution function (BRDF). This function defines how light is reflected on an opaque surface. The implemented BRDF includes both a specular and a diffuse term. The specular term is based on microfacet theory and assumes that each microfacet acts as a perfect mirror. Concretely, the GGX/Trowbridge-Reitz distribution (as a NDF), the Smith function (for the joint masking-shadowing function), and Schlick's approximation (for modeling the Fresnel reflectance) are considered. For the diffuse term, the Lambertian BRDF is applied. Furthermore, the energy conservation rule is met.
The properties of the surface are described using the metalness and roughness parameters. Their values are stored as textures. The implementation is done in the PBR fragment shader. The application itself builds upon a framework provided by the Visualization and MultiMedia Lab.
The following images show two exemplary renderings.
This program has the following dependencies:
- OpenGL
- GLEW
- GLFW
- FreeImage
- Assimp
OpenGL should already exist on the platform. The Assimp source code is included in this repository and will be built the first time when building this project.
on Mac:
Install the remaining three dependencies using homebrew:
brew install glew
brew install glfw3
brew install freeimage
on Windows: All dependencies are included in this repository. When running CMake, choose "Visual Studio xx WIN64" or choose "Visual Studio xx" as the target platform. In the second case, make sure to definitely choose x64 in the next field.
on Linux:
Install the remaining three dependencies using apt-get:
sudo apt-get install libglew-dev
sudo apt-get install libglfw3-dev
sudo apt-get install libfreeimage3 libfreeimage-dev
After installing the dependencies, use CMake to build the project. Make sure that the build folder is inside the project folder:
[project root]
|-- build
|-- CMake
|-- doc
|-- external
|-- res
|-- shader
|-- src