Homework of GAMES101: Introduction to Computer Graphics, instructed by Professor Linqi Yan.
Build up C++ Environment (OpenCV & Eigen)
Rasterization of a triangle with rotation and translation.
Implement MSAA by using supersampling to achieve anti-aliasing, and optimize the boundary, but there is a black edge at the intersection of triangles
Remove the black edge at the intersection of triangles
Implemented Blinn-Phong Reflection model.
Add Texture Mapping to the Blinn-Phong Shader.
Add Bump Mapping to the Blinn-Phong Shader.
Add Displacement Mapping to the Blinn-Phong Shader.
Bernstein Form of Bezier Curve:
In order to achieve anti-aliasing, we use super sampling to sample the curve at a higher resolution.
Muller Trumbore Algorithm:
When t > 0.0 && u > 0.0 && v > 0.0 && (1 - u - v) > 0.0
, we have a solution for
Slabs perpendicular method:
$$ \begin{aligned} \textbf{t}{max} &= \frac{P{max} - \textbf{O}}{\textbf{D}} \ \textbf{t}{min} &= \frac{P{min} - \textbf{O}}{\textbf{D}} \ \textbf{t}{enter} &= max(\textbf{t}{min}) \ \textbf{t}{exit} &= min(\textbf{t}{max}) \end{aligned} $$
When
- Find bounding box
- Recursively split set of objects in two subsets
- Recompute the bounding box of the subsets
- Stop when necessary
- Store objects in each leaf node
- SPP = 16
- Render Time = 48min
- Multiple Thread (OpenMP)
#pragma omp parallel for
-
Add SPP
Set SPP = 1024. -
Anti-Aliasing
Sample randomly over a range of pixels. -
Modify
get_random_float()
Due to the feature ofrandom_device
on Linux/Unix, the function uses the entropy pool provided by Operating System. When the entropy pool is exhausted,random_device
blocks the call until there is enough entropy available, which therefore makes the function a time-consuming operation.
In the given framework,random_device
function was called frequently, resulting in an overall performance degradation.
In order to optimize this function, we made the first three lines into static variables. -
Remove White Noise Point
Since the PDF is sampled randomly, when the value of pdf closes to 0, the computed indirect light will be biased towards the limit value. Therefore, we only consider on computing the indirect light when$pdf > \epsilon$ .
- SPP = 1024
- Render Time = 14min