-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
671b1ab
commit 0f87d1b
Showing
11 changed files
with
583 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# specify the version of cmake (intentionally using old version for those who cannot update CMake) | ||
cmake_minimum_required(VERSION 3.10) | ||
|
||
############################# | ||
# set C++ detail | ||
enable_language(CXX) # we are using C++ | ||
set(CMAKE_CXX_STANDARD 17) # we are using C++ 17 | ||
set(CMAKE_CXX_STANDARD_REQUIRED TRUE) # we are using STL library | ||
|
||
############################# | ||
# set project name | ||
|
||
project(task07) | ||
|
||
############################# | ||
# define macro | ||
add_definitions(-DPROJECT_SOURCE_DIR="${PROJECT_SOURCE_DIR}") | ||
|
||
############################# | ||
# specifying libraries to use | ||
|
||
######################## | ||
# include, build, and link | ||
|
||
include_directories( | ||
${PROJECT_SOURCE_DIR}/../external | ||
${PROJECT_SOURCE_DIR}/../external/eigen | ||
) | ||
|
||
add_executable(${PROJECT_NAME} | ||
main.cpp | ||
) | ||
|
||
target_link_libraries(${PROJECT_NAME} | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
# Task06: Ambient Occlusion and BVH (Monte Carlo Integration, Importance Sampling) | ||
|
||
 | ||
|
||
**Deadline: May 30th (Thu) at 15:00pm** | ||
|
||
---- | ||
|
||
## Before Doing Assignment | ||
|
||
If you have not done the [task01](../task01), [task02](../task02) do it first to set up the C++ development environment. | ||
|
||
Follow [this document](../doc/submit.md) to submit the assignment, In a nutshell, before doing the assignment, | ||
- make sure you synchronized the `main ` branch of your local repository to that of remote repository. | ||
- make sure you created branch `task06` from `main` branch. | ||
- make sure you are currently in the `task06` branch (use `git branch -a` command). | ||
|
||
Now you are ready to go! | ||
|
||
--- | ||
|
||
## Problem 1 (compilation practice) | ||
|
||
1. Build the code using cmake | ||
2. Run the code **with release mode** | ||
|
||
The program will output `normal_map.png` that update the image below | ||
|
||
 | ||
|
||
## Problem 2 (efficient search using BVH) | ||
|
||
The code in Problem 1 is very slow. It is because the computation of intersection betweeen a ray and a triangle mesh is **brute force**. | ||
|
||
Comment out the brute force intersection computation (from `line#146` to `line#158`) and implement code to evaluate BVH to accelerate the computation around `line #120`. | ||
|
||
The program output the computation time. Fill the table below to compare the timing before/after the acceleraion. Please make sure that you build the code **with release mode** | ||
|
||
|
||
|
||
| brute force | BVH | | ||
| ----------- | ------ | | ||
| ??? ms | ??? ms | | ||
|
||
|
||
|
||
|
||
## Problem 3 (ambient occlusion) | ||
|
||
Now you have the code for fast ray-mesh intersection. Using that code, let's compute the ambient occlusion. | ||
|
||
- First, Comment out the `continue;` in the `main()` at `line #21` in the original code . This will enable the ambient occlusion computation. The problem will output `ao.png`. | ||
|
||
- Then fix the bug in `line #223`in the original code to correctly compute the ambient occlusion. The result should looks like `preview.png` at the begining of this document. | ||
|
||
- Finally, modify the name of the outut image as `ao_uniform.png` | ||
|
||
|
||
|
||
## Problem 4 (importance sampling) | ||
|
||
The computation of ambient occlusion is a bit noisy (i.e., the variance is high). Let's implement the importance sampling to reduce the variance. Write some code to compute the direction and PDF of **cosine-weighted sampling of hemisphere **around `line #53`. Modify the name of the output image `ao.png` as `ao_cosweight.png`. | ||
|
||
| Uniform sample | Cosine weighted sample | | ||
| --------------------------- | ----------------------------- | | ||
|  |  | | ||
|
||
|
||
|
||
Observe that the variance (noise) is reduced using the importance sampling | ||
|
||
|
||
|
||
|
||
## After Doing the Assignment | ||
|
||
After modify the code, push the code and submit a pull request. Make sure your pull request only contains the files you edited. Good luck! |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.