Ana içeriğe atla

Assignment 1: First Blood


For the first assignment, I was building the core features of the ray tracer.

This expected to have the required primitives, such as rays, camera model, and the image plane.

The external libraries used were: GLM, where vector operations were needed. I used vec3 as a container. Besides, functions such as normalize and distance were in use as well.

Although it might seem trivial, I had a tough time parsing the scene file, which is in XML format. There, the library called tinyxml2 came to the rescue.

Although I intended to get PNG outputs with LodePNG, currently I only settled for a .ppm output. Later on, full SDL integration would display the images in a window on the fly.

Cornell Box v0.1
My first output had three major flaws:
1) The reflection on Phong material is wrong. Later, the vector direction was fixed.
2) The intensity of the light was somewhat arbitrary, as I failed to clamp the color values.
3) The mirror reflection is missing.
Cornell Box v0.2
This version has included the mirror reflections to some extent. However, it has some surface acne on the mirror. Also, notice that the recursion fails to go through the all-depth: Therefore, we can not see the shading of the yellow sphere on the mirror. There is also a slight glitch where grey and blue surface meets the ceiling; which is most likely due to incorrect epsilon values.


The bunny looks somewhat better compared to the other. Here, the colors are also a bit darker from the reference image.

While simultaneously proceeding to the further assignments, I will also look for remedies for the problems that were listed above.

Yorumlar

Bu blogdaki popüler yayınlar

Assignment 2

For this assignment, I have could only come up with an MSAA routine that uses box filter. Also, at the current scope, the ray tracer is embarrassingly parallel. Therefore, I have used OpenMP to parallelize it. A few caveats came up there such as: #pragma omp parallel for private(k) schedule(dynamic) for (j = 0; j < static_cast<int>(cameras[i].image_resolution.x * samples_sqrt); j++) { for (k = 0; k < static_cast<int>(cameras[i].image_resolution.y * samples_sqrt); k++) { In the code example above, enabling dynamic scheduling had a considerable impact on the performance and CPU utilization. Also, by declaring `private (k)`, I assigned the scanline over the y-axis.  The `samples_sqrt` is simply the square root of the samples, that was required by MSAA. Even though standard library of C++ provides uniform random distribution with `uniform_real_distribution` and a `default_random_engine`, it might be interesting to check whether the unifor...