CS562, Fall 2019
October 30th, 2019
In this project, I changed the framework to the game engine made for my GAM550 course. Since I am the only graphics developer in my team and the game engine uses same graphics framework(based on Vulkan) as the previous one, I have no problem in implementing these features.
The diffuse irradiance shading part of this project is simple. In a deferred shading pipeline, I sampled the view-space normal, doing a normalize, then directly do a sphere sampling on irradiance map using that normal. Lastly, the result color should be divided by PI, if it is not done during calculation of map. In this project, the irradiance map given by professor seems to work well without divide by PI. For the tone mapping, I choose variable e as 2.
According to the handout paper, the specular PBR needs a pre-generated mipmap chain of skybox texture. Since Vulkan does not natively support mipmap generation ( it supports mipmap image memory allocation however), I have to generate mipmap manually, with the help of Vulkan Tutorial (https://vulkan-tutorial.com/Generating_Mipmaps). Generating mipmap in Vulkan can be done by following steps:
1: Allocate a mipmap image object.
2: Read-in pixel data and copy it to the first mipmap level of the image.
3: Switch layout of current level to VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL and the layout of next level to VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, doing VkCmdBlitImage, which performs scaled-size data transfer from current level to next level. After that, switch layout of current level to VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL and next level to VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL. Repeating these steps recursively till last level of mipmap chain.
Choose of BRDF model:
Same as the Ray-tracing class, I choose GGX model for BRDF instead of Phong model. I followed instructions to generate Hammersley random numbers on CPU and pass those numbers to shader using uniform buffer. In the fragment shader, I performed importance sampling according to the Unreal Engine paper
(https://cdn2.unrealengine.com/Resources/files/2013SiggraphPresentationsNotes-26915738.pdf) and choose mipmap level according to the equation given by handout paper(with a little adjustment, I changed D into D NdotH / (4 VdotH), which is the pdf of GGX BRDF).
Roughness = 0.1
Roughness = 0.3
Roughness = 0.6
Roughness = 0.9
Calculating Diffuse Irradiance Map:
In this part, I implemented both traditional “ray-traced” irradiance map and spherical harmonic irradiance map in order to compare their differences. The traditional irradiance map is computed on GPU using a graphics render pipeline and the random seed is passed in through uniform buffer object. For the spherical harmonic irradiance map, since it only contains 9 values, I do the calculation on CPU according to the algorithm given by handout paper.
_NewPort_Loft_
Traditional
Spherical Harmonic
TropicalBeach
Traditional
Spherical Harmonic
_Barce_Rooftop_
Traditional
Spherical Harmonic
In general, both methods have similar results. The very difference is that the traditional method takes tens of seconds to converge even with GPU acceleration while Spherical Harmonic method achieves similar results in less than a second on CPU.