Use this section to write an overview of the assignment. All of the text in your write-up should be in your own words. If you need to add additional HTML features to this document, you can search the http://www.w3schools.com/ website for instructions. To edit the HTML, you can just copy and paste existing chunks and fill in the text and image file names appropriately.
If you are well-versed in web development, feel free to ditch this template and make a better looking page. Just make sure that you include all the components as we've laid them out here.
This part contains generating rays from the camera and testing if the ray intersect with primitive, i.e. triangles and spheres.
First, I compute the direction of the ray in camera space. Then, the direction is transformed to world space. This direction is d of the ray.
After that, the o of the ray is set by the position of the camera in space. Finally, the max and min of t of the ray in set by the near and far clip of the camera.
To test intersection with a triangle, I implement both plane test and the Moller Trumbore Algorithm, although at the end, I decide to use Moller Trumbore
beacause it is more convinent. With the output of Moller Trumbore, I test if t is in between the range of min and max_t of the ray. If that is true, the ray hit
the plane of the triangle. Finally, I test if b1 and b2 are both in range 0 to 1 and add up less than 1. It that is true, the hit point is in the triangle.
The detail of Moller Trumbore is a simple fomula:
![]() |
![]() |
![]() |
Constructing a BVH is simple at a higher level, but it involves many detail to consider. Overall, my BVH construction algorithm is a recursive algorithm.
No matter which case it is, it first construct the bounding box with the given input primitives. Then it is the base case if the size of input is less than a constant,
max_leaf_size, otherwise it is the recursive case.
For base case, it simply set the node to be a leaf node, NULL children, and its start and end iterator is
same as the input.
The juicy part is the recursive case, first it need to identify the axis that interests the most, i.e. the longest axis. An interesting implimentation here is that I use 0, 1, and 2
to identify x, y, and z, respectively. The advantage is that I can use [] operator to select the desired axis, whereas hard-coding x, y, and z into the code.
Using simple heuristic, mid-point of the spanning range, to pick the split point, it "sorts" the input list in-place. It roughly group the primitives to the left of the split
point, putting them in the lower part of the list, and the primitives to the right in the higher part. In this way, the following recursive calls can simply take their
respective intervels of the list. And it saves a lot of memory.
![]() |
![]() |
![]() |
BVH acceleration makes rendering complex geometries faster. I wouldn't be partient enough to wait for the above image to render without BVH. Talking about a less complex geometry, cow.dae, it takes ~40 seconds to render without BVH. In live-render mode, it shows that the image is rendered in blocks. On the other hand, the cow can be rendered in a blink of eye with BVH.
There are two kinds of implementation of the direct light sampling in the program. Uniform sampling converges slowly and gives lots of noise before then, whereas importance sampling converges faster. In uniform sampling, the ray being traced will be uniformly sampled in the hemisphere. In importance sampling, the next ray will go directly to one of the light source, the final radiance will be adjusted by the probability density function.
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
Here is an example of how to include a simple formula:
a^2 + b^2 = c^2
or, alternatively, you can include an SVG image of a LaTex formula.
This time it's your job to copy-paste in the rest of the sections :)
Here are a few problems students have encountered in the past. You will probably encounter these problems at some point, so don't wait until right before the deadline to check that everything is working. Test your website on the instructional machines early!
"./images/image.jpg"Do NOT use absolute paths, such as
"/Users/student/Desktop/image.jpg"
.png != .jpeg != .jpg != .JPG