External libraries used:
- tinyxml2 (tinyxml2.h, tinyxml2.cpp are provided in the homework files.)
- lodepng (lodepng.h, lodepng.cpp are provided in the homework files.)
- Eigen (Can be obtained from http://eigen.tuxfamily.org/)
- jpeglib
Command to compile:
g++ -I /usr/include/eigen3/ -std=c++11 -O3 main.cpp RayTracer.cpp ray.cpp shape.cpp light.cpp tinyxml2.cpp lodepng.cpp BVH.cpp texture.cpp -o RayTracer -ljpeg
Computer specs:
Intel Core i7-2630QM CPU @ 2.00 GHz, 6 GB RAM
Running the ray tracer:
./RayTracer command should be fed by the relative path of the input file, e. g.,
./RayTracer demo.xml
Related articles:
1. http://ieeexplore.ieee.org/stamp/stamp.jsp?arnumber=4634627
2. https://cseweb.ucsd.edu/~ravir/papers/singlescat/scattering.pdf
Term project's topic was to choose a model to simulate participating media (e. g., fog, haze, smoke) and implement it in ray tracer.
A very simple input file and executable for it is given in the ling below:
https://drive.google.com/drive/folders/0ByiItrg43ou-OVNmcHdVN08xLWs?usp=sharing
Far-away objects should be seen less clear than near objects due to participating media.
There is one point light in the scene.
Anti-Aliasing: MSAA w/ 25 samples
Render Time: 92m 14s
In previous assignments, it was not possible to render a point light even it directly sees the camera (Because a point light has no volume). In the image left, a point light seen as if it had a volume thanks to the participating media's aerial glow effect.
There is one point light in the scene.
Anti-Aliasing: MSAA w/ 16 samples
Render Time: 113m 56s
Spot lights forms a light cone due to the participating media.
There is one spot light in the scene.
Render Time: 13m 4s
Note:
sigma_a = (0.1, 0.1, 0.1)
sigma_s = (0.3, 0.3, 0.3)
Spot light radiates only white light, also the surface absorbs and reflects all the spectrum equally. The color is due to fact that in this scene participating media scatters each color channel differently.
There is one spot light in the scene.
Render Time: 11m 27s
Note:
sigma_a = (0.07, 0.07, 0.07)
sigma_s = (0.1471, 0.2930, 0.3000)
Volumetric shadows with basic geometry.
There is one spot light in the scene.
Anti-Aliasing: MSAA w/ 36 samples
Render Time: 497m 58s
Volumetric shadows with complex geometry.
There is one spot light in the scene.
Anti-Aliasing: MSAA w/ 36 samples
Render Time: 650m 42s
CENG 795 Advanced Ray Tracing
12 Haziran 2017 Pazartesi
15 Mayıs 2017 Pazartesi
Homework 8
External libraries used:
- tinyxml2 (tinyxml2.h, tinyxml2.cpp are provided in the homework files.)
- lodepng (lodepng.h, lodepng.cpp are provided in the homework files.)
- Eigen (Can be obtained from http://eigen.tuxfamily.org/)
- jpeglib
Command to compile:
g++ -I /usr/include/eigen3/ -std=c++11 -O3 main.cpp RayTracer.cpp ray.cpp shape.cpp light.cpp tinyxml2.cpp lodepng.cpp BVH.cpp texture.cpp -o RayTracer -ljpeg
Computer specs:
Intel Core i7-2630QM CPU @ 2.00 GHz, 6 GB RAM
Running the ray tracer:
./RayTracer command should be fed by the relative path of the input file, e. g.,
./RayTracer 795_input_set_06/skybox.xml
This week's task was to implement more realistic BRDFs (Bi-Directional Reflectance Distribution Function), specifically, Blinn-Phong, Phong, and Torrance-Sparrow BRDFs.
File Name: brdf_blinnphong_modified.xml
BRDF: Modified Blinn-Phong (Unnormalized)
File Name: brdf_blinnphong_modified_normalized.xml
BRDF: Modified Blinn-Phong (Normalized)
File Name: brdf_blinnphong_original.xml
BRDF: Original Blinn-Phong
File Name: brdf_phong_modified.xml
BRDF: Modified Phong (Unnormalized)
File Name: brdf_phong_modified_normalized.xml
BRDF: Modified Phong (Normalized)
File Name: brdf_phong_original.xml
BRDF: Original Phong
File Name: brdf_torrancesparrow.xml
BRDF: Torrance-Sparrow
File Name: killeroo_blinnphong_modified_normalized.xml
BRDF: Modified Blinn-Phong (Normalized)
Image just below is the close-up version.
File Name: killeroo_torrancesparrow.xml
BRDF: Torrance-Sparrow
Image just below is the close-up version.
Comments: At the left-bottom part of the close-up image, some green artifacts can be seen. I could not figure out which bug caused these artifacts yet.
- tinyxml2 (tinyxml2.h, tinyxml2.cpp are provided in the homework files.)
- lodepng (lodepng.h, lodepng.cpp are provided in the homework files.)
- Eigen (Can be obtained from http://eigen.tuxfamily.org/)
- jpeglib
Command to compile:
g++ -I /usr/include/eigen3/ -std=c++11 -O3 main.cpp RayTracer.cpp ray.cpp shape.cpp light.cpp tinyxml2.cpp lodepng.cpp BVH.cpp texture.cpp -o RayTracer -ljpeg
Computer specs:
Intel Core i7-2630QM CPU @ 2.00 GHz, 6 GB RAM
Running the ray tracer:
./RayTracer command should be fed by the relative path of the input file, e. g.,
./RayTracer 795_input_set_06/skybox.xml
This week's task was to implement more realistic BRDFs (Bi-Directional Reflectance Distribution Function), specifically, Blinn-Phong, Phong, and Torrance-Sparrow BRDFs.
File Name: brdf_blinnphong_modified.xml
BRDF: Modified Blinn-Phong (Unnormalized)
File Name: brdf_blinnphong_modified_normalized.xml
BRDF: Modified Blinn-Phong (Normalized)
File Name: brdf_blinnphong_original.xml
BRDF: Original Blinn-Phong
File Name: brdf_phong_modified.xml
BRDF: Modified Phong (Unnormalized)
File Name: brdf_phong_modified_normalized.xml
BRDF: Modified Phong (Normalized)
File Name: brdf_phong_original.xml
BRDF: Original Phong
File Name: brdf_torrancesparrow.xml
BRDF: Torrance-Sparrow
File Name: killeroo_blinnphong_modified_normalized.xml
BRDF: Modified Blinn-Phong (Normalized)
Image just below is the close-up version.
File Name: killeroo_torrancesparrow.xml
BRDF: Torrance-Sparrow
Image just below is the close-up version.
2 Mayıs 2017 Salı
Homework 7
External libraries used:
- tinyxml2 (tinyxml2.h, tinyxml2.cpp are provided in the homework files.)
- lodepng (lodepng.h, lodepng.cpp are provided in the homework files.)
- Eigen (Can be obtained from http://eigen.tuxfamily.org/)
- jpeglib
Command to compile:
g++ -I /usr/include/eigen3/ -std=c++11 -O3 main.cpp RayTracer.cpp ray.cpp shape.cpp light.cpp tinyxml2.cpp lodepng.cpp BVH.cpp texture.cpp -o RayTracer -ljpeg
Computer specs:
Intel Core i7-2630QM CPU @ 2.00 GHz, 6 GB RAM
Running the ray tracer:
./RayTracer command should be fed by the relative path of the input file, e. g.,
./RayTracer 795_input_set_06/skybox.xml
This week's task was to implement bump mapping which creates a sense of depth in texture mapping.
File Name: bump_mapping_basic.xml
Anti-Aliasing: MSAA with 36 sample per pixel
File Name: sphere_bump_nobump.xml
Anti-Aliasing: MSAA with 36 sample per pixel
File Name: killeroo_bump_walls.xml
Anti-Aliasing: MSAA with 16 sample per pixel
Render Time: 1 minute 51.583 seconds
File Name: bump_mapping_transformed.xml
Anti-Aliasing: MSAA with 36 sample per pixel
Comments: Scaling problem in spheres seems to be solved. However, cobblestone texture does not seems to rotated exactly in the outputs provided probably due to a small bug.
- tinyxml2 (tinyxml2.h, tinyxml2.cpp are provided in the homework files.)
- lodepng (lodepng.h, lodepng.cpp are provided in the homework files.)
- Eigen (Can be obtained from http://eigen.tuxfamily.org/)
- jpeglib
Command to compile:
g++ -I /usr/include/eigen3/ -std=c++11 -O3 main.cpp RayTracer.cpp ray.cpp shape.cpp light.cpp tinyxml2.cpp lodepng.cpp BVH.cpp texture.cpp -o RayTracer -ljpeg
Computer specs:
Intel Core i7-2630QM CPU @ 2.00 GHz, 6 GB RAM
Running the ray tracer:
./RayTracer command should be fed by the relative path of the input file, e. g.,
./RayTracer 795_input_set_06/skybox.xml
This week's task was to implement bump mapping which creates a sense of depth in texture mapping.
File Name: bump_mapping_basic.xml
Anti-Aliasing: MSAA with 36 sample per pixel
File Name: sphere_bump_nobump.xml
Anti-Aliasing: MSAA with 36 sample per pixel
Anti-Aliasing: MSAA with 16 sample per pixel
Render Time: 1 minute 51.583 seconds
Anti-Aliasing: MSAA with 36 sample per pixel
Comments: Scaling problem in spheres seems to be solved. However, cobblestone texture does not seems to rotated exactly in the outputs provided probably due to a small bug.
23 Nisan 2017 Pazar
Homework 6
External libraries used:
- tinyxml2 (tinyxml2.h, tinyxml2.cpp are provided in the homework files.)
- lodepng (lodepng.h, lodepng.cpp are provided in the homework files.)
- Eigen (Can be obtained from http://eigen.tuxfamily.org/)
- jpeglib
Command to compile:
g++ -I /usr/include/eigen3/ -std=c++11 -O3 main.cpp RayTracer.cpp ray.cpp shape.cpp light.cpp tinyxml2.cpp lodepng.cpp BVH.cpp texture.cpp -o RayTracer -ljpeg
Computer specs:
Intel Core i7-2630QM CPU @ 2.00 GHz, 6 GB RAM
Running the ray tracer:
./RayTracer command should be fed by the relative path of the input file, e. g.,
./RayTracer 795_input_set_06/skybox.xml
This week's task was to implement texture mapping.
File Name: sphere_texture_replace_nearest.xml
Interpolation Method: Nearest
Decal Mode: Replace kd
File Name: sphere_texture_replace_bilinear.xml
Interpolation Method: Bilinear
Decal Mode: Replace kd
File Name: sphere_texture_blend_bilinear.xml
Interpolation Method: Bilinear
Decal Mode: Blend kd
File Name: killeroo_diffuse_specular_texture.xml
Interpolation Method: Bilinear
Decal Mode: Blend kd
Appearance: Repeat
File Name: perlin_types.xml
Comments:
- Perlin noise examples. Smooth textures were generated in patch mode, textures with veins were generated in vein mode.
- There is also a directional light in the scene.
File Name: simple_texture.xml
Comments:
- Texture on the sphere in top-left was generated with nearest interpolation and replace kd modes.
- Texture on the sphere in bottom-left was generated with patch and replace kd modes.
- Texture on the sphere in bottom-right was generated with vein and replace kd modes.
- Textures on the square and the triangle were generated in nearest and replace kd modes.
File Name: skybox.xml
- tinyxml2 (tinyxml2.h, tinyxml2.cpp are provided in the homework files.)
- lodepng (lodepng.h, lodepng.cpp are provided in the homework files.)
- Eigen (Can be obtained from http://eigen.tuxfamily.org/)
- jpeglib
Command to compile:
g++ -I /usr/include/eigen3/ -std=c++11 -O3 main.cpp RayTracer.cpp ray.cpp shape.cpp light.cpp tinyxml2.cpp lodepng.cpp BVH.cpp texture.cpp -o RayTracer -ljpeg
Computer specs:
Intel Core i7-2630QM CPU @ 2.00 GHz, 6 GB RAM
Running the ray tracer:
./RayTracer command should be fed by the relative path of the input file, e. g.,
./RayTracer 795_input_set_06/skybox.xml
This week's task was to implement texture mapping.
File Name: sphere_texture_replace_nearest.xml
Interpolation Method: Nearest
Decal Mode: Replace kd
File Name: sphere_texture_replace_bilinear.xml
Interpolation Method: Bilinear
Decal Mode: Replace kd
File Name: sphere_texture_blend_bilinear.xml
Interpolation Method: Bilinear
Decal Mode: Blend kd
File Name: killeroo_diffuse_specular_texture.xml
Interpolation Method: Bilinear
Decal Mode: Blend kd
Appearance: Repeat
File Name: perlin_types.xml
Comments:
- Perlin noise examples. Smooth textures were generated in patch mode, textures with veins were generated in vein mode.
- There is also a directional light in the scene.
File Name: simple_texture.xml
Comments:
- Texture on the sphere in top-left was generated with nearest interpolation and replace kd modes.
- Texture on the sphere in bottom-left was generated with patch and replace kd modes.
- Texture on the sphere in bottom-right was generated with vein and replace kd modes.
- Textures on the square and the triangle were generated in nearest and replace kd modes.
File Name: skybox.xml
Anti-Aliasing: MSAA with 100 sample per pixel
Render time: 2 minutes 52.054 seconds
- Texture of the sky was generated in bilinear and replace all modes.
- Texture of the floor was generated in bilinear and replace kd modes with repeated appearance.
Other Comments and Highlights:
- elliosoids_texture.xml could not be rendered because of the bug in scaling the spheres (i.e., ellipsoid shape cannot be obtained).
- All in all, texture mapping seems to be working fine.
- There seems to be bugs related with the tasks of the previous weeks (such as transformations).
18 Nisan 2017 Salı
Homework 5
External libraries used:
- tinyxml2 (tinyxml2.h, tinyxml2.cpp are provided in the homework files.)
- lodepng (lodepng.h, lodepng.cpp are provided in the homework files.)
- Eigen (Can be obtained from http://eigen.tuxfamily.org/)
Command to compile:
g++ -I /usr/include/eigen3/ -std=c++11 -O3 main.cpp RayTracer.cpp Ray.cpp shape.cpp light.cpp tinyxml2.cpp lodepng.cpp BVH.cpp -o RayTracer
Computer specs:
Intel Core i7-2630QM CPU @ 2.00 GHz, 6 GB RAM
Running the ray tracer:
./RayTracer command should be fed by the relative path of the input file, e. g.,
./RayTracer 795_input_set_05/spheres_dof.xml
This week's task was to implement multi sampling anti aliasing (MSAA), spot light, area light, glossy reflection and depth of field.

File Name: dragon_spot_light.xml
Render Time: 16.789 seconds
Comments: No MSAA only spot light.
File Name: dragon_spot_light_msaa.xml
Number of Samples: 100
Render Time: 27 minutes 21.153 seconds
Comments: MSAA and spot light.

File Name: glass_plates_point.xml
Number of Samples: 36
Render Time: 4 minutes 33.520 seconds
Comments: MSAA and point light.
File Name: glass_plates_area.xml
Number of Samples: 36
Render Time: 3 minutes 45.235 seconds
Comments: MSAA and area light.
File Name: metal_plates_area.xml
Number of Samples: 36
Render Time: 3 minutes 39.345 seconds
Comments: MSAA and area light.
File Name: spheres_dof.xml
Number of Samples: 100
Render Time: 36.618 seconds
Comments: MSAA and point light plus finite aperture size which simulates a realistic camera lens.
- tinyxml2 (tinyxml2.h, tinyxml2.cpp are provided in the homework files.)
- lodepng (lodepng.h, lodepng.cpp are provided in the homework files.)
- Eigen (Can be obtained from http://eigen.tuxfamily.org/)
Command to compile:
g++ -I /usr/include/eigen3/ -std=c++11 -O3 main.cpp RayTracer.cpp Ray.cpp shape.cpp light.cpp tinyxml2.cpp lodepng.cpp BVH.cpp -o RayTracer
Computer specs:
Intel Core i7-2630QM CPU @ 2.00 GHz, 6 GB RAM
Running the ray tracer:
./RayTracer command should be fed by the relative path of the input file, e. g.,
./RayTracer 795_input_set_05/spheres_dof.xml
This week's task was to implement multi sampling anti aliasing (MSAA), spot light, area light, glossy reflection and depth of field.

File Name: dragon_spot_light.xml
Render Time: 16.789 seconds
Comments: No MSAA only spot light.

Number of Samples: 100
Render Time: 27 minutes 21.153 seconds
Comments: MSAA and spot light.

File Name: glass_plates_point.xml
Number of Samples: 36
Render Time: 4 minutes 33.520 seconds
Comments: MSAA and point light.
File Name: glass_plates_area.xml
Number of Samples: 36
Render Time: 3 minutes 45.235 seconds
Comments: MSAA and area light.
File Name: metal_plates_area.xml
Number of Samples: 36
Render Time: 3 minutes 39.345 seconds
Comments: MSAA and area light.
Number of Samples: 100
Render Time: 36.618 seconds
Comments: MSAA and point light plus finite aperture size which simulates a realistic camera lens.
11 Nisan 2017 Salı
Homework 4
External libraries used:
- tinyxml2 (tinyxml2.h, tinyxml2.cpp are provided in the homework files.)
- lodepng (lodepng.h, lodepng.cpp are provided in the homework files.)
- Eigen (Can be obtained from http://eigen.tuxfamily.org/)
Command to compile:
g++ -I /usr/include/eigen3/ -std=c++11 -O3 main.cpp RayTracer.cpp Vec3d.cpp Ray.cpp shape.cpp tinyxml2.cpp lodepng.cpp BVH.cpp -o RayTracer
Computer specs:
Intel Core i7-2630QM CPU @ 2.00 GHz, 6 GB RAM
Running the ray tracer:
./RayTracer command should be fed by the relative path of the input file, e. g.,
795_input_set_02/horse.xml
This week's task was to implement reflection and refraction, more specifically, implementation of Snell's Law, Schlick's approximation to Fresnel equations and Beer's Law.
File Name: cornellbox_glass.xml
Render Time: 9.088 seconds
File Name: glass_plates.xml
Render Time: 12.981 seconds
Comments: Although refraction and transmission phenomena looks to be implemented correctly, the image looks as if we are looking at the scene at a slightly different angle than the original output. The problem seems to be related with the camera model implementation.
File Name: horse_and_glass_mug.xml
Render Time: ~1 minute 28 seconds
File Name: killeroo_glass.xml
Render Time: 44.333 seconds
Comments: When I run the .xml file provided as it is, the image looks like we are looking at the scene from just outside of the green wall (was discussed in the class.). To better understand the problem, I took all the box meshes out except the one under the dino (with mesh id's 3, 4, 5, 6, 7), and added the walls one by one.
File Name: killeroo_glass.xml
Render Time: ~45 seconds
Comments: Green wall added (mesh id 3).
File Name: killeroo_glass.xml
Render Time: ~45 seconds
File Name: killeroo_half_mirror.xml
Render Time: 30.315 seconds
Comments: As in killeroo_glass.xml, meshes with id's 5, 6, and 7 are excluded.
File Name: killeroo_mirror.xml
Render Time: 28.262 seconds
Comments: As in killeroo_glass.xml, meshes with id's 5, 6, and 7 are excluded.
- tinyxml2 (tinyxml2.h, tinyxml2.cpp are provided in the homework files.)
- lodepng (lodepng.h, lodepng.cpp are provided in the homework files.)
- Eigen (Can be obtained from http://eigen.tuxfamily.org/)
Command to compile:
g++ -I /usr/include/eigen3/ -std=c++11 -O3 main.cpp RayTracer.cpp Vec3d.cpp Ray.cpp shape.cpp tinyxml2.cpp lodepng.cpp BVH.cpp -o RayTracer
Computer specs:
Intel Core i7-2630QM CPU @ 2.00 GHz, 6 GB RAM
Running the ray tracer:
./RayTracer command should be fed by the relative path of the input file, e. g.,
795_input_set_02/horse.xml
This week's task was to implement reflection and refraction, more specifically, implementation of Snell's Law, Schlick's approximation to Fresnel equations and Beer's Law.
File Name: cornellbox_glass.xml
Render Time: 9.088 seconds
File Name: glass_plates.xml
Render Time: 12.981 seconds
Comments: Although refraction and transmission phenomena looks to be implemented correctly, the image looks as if we are looking at the scene at a slightly different angle than the original output. The problem seems to be related with the camera model implementation.
File Name: horse_and_glass_mug.xml
Render Time: ~1 minute 28 seconds
File Name: killeroo_glass.xml
Render Time: 44.333 seconds
Comments: When I run the .xml file provided as it is, the image looks like we are looking at the scene from just outside of the green wall (was discussed in the class.). To better understand the problem, I took all the box meshes out except the one under the dino (with mesh id's 3, 4, 5, 6, 7), and added the walls one by one.
File Name: killeroo_glass.xml
Render Time: ~45 seconds
Comments: Green wall added (mesh id 3).
File Name: killeroo_glass.xml
Render Time: ~45 seconds
Comments: Blue wall added (mesh id 4).
When the other walls are added, the image is created as if the camera outside the box. The problem seems to be related with triangle intersection routine (Especially when the triangle is at the back of the camera.) but I have not solved it yet.
Render Time: 30.315 seconds
Comments: As in killeroo_glass.xml, meshes with id's 5, 6, and 7 are excluded.
File Name: killeroo_mirror.xml
Render Time: 28.262 seconds
Comments: As in killeroo_glass.xml, meshes with id's 5, 6, and 7 are excluded.
26 Mart 2017 Pazar
Homework 3
The images below were generated by using the supplied input files bunny.xml, horse.xml, killeroo.xml, dragon.xml,
External libraries used:
- tinyxml2 (tinyxml2.h, tinyxml2.cpp are provided in the homework files.)
- lodepng (lodepng.h, lodepng.cpp are provided in the homework files.)
- Eigen (Can be obtained from http://eigen.tuxfamily.org/)
Command to compile:
g++ -I /usr/include/eigen3/ -std=c++11 -O3 main.cpp RayTracer.cpp Vec3d.cpp Ray.cpp shape.cpp tinyxml2.cpp lodepng.cpp BVH.cpp -o RayTracer
Computer specs:
Intel Core i7-2630QM CPU @ 2.00 GHz, 6 GB RAM
Running the ray tracer:
./RayTracer command should be fed by the relative path of the input file, e. g.,
795_input_set_02/horse.xml
This week's task was to accelerate render time by implementing Bounding Volume Hierarchy (BVH).
File name: bunny.xml
Triangle count: 4967
Render time w/o BVH and flat shading mode:
~53 seconds
Render time w/o BVH and smooth shading mode: ~56 seconds
Render time w/ BVH and flat shading mode: 0.586 seconds
Render time w/ BVH and smooth shading mode: 0.604 seconds
File name: horse.xml
Triangle count: 11216
Render time w/o BVH and flat shading mode:
~32 minutes
Render time w/o BVH and smooth shading mode: ~40 minutes
Render time w/ BVH and flat shading mode: 7.643 seconds
Render time w/ BVH and smooth shading mode: 7.834 seconds
File name: killeroo.xml
Triangle count: 92092
Render time w/o BVH and flat shading mode:
Infeasable to wait
Render time w/o BVH and smooth shading mode: Infeasable to wait
Render time w/ BVH and flat shading mode: 1.822 seconds
Render time w/ BVH and smooth shading mode: 1.951 seconds
File name: dragon.xml
Triangle count: 871414
Render time w/o BVH and flat shading mode:
Infeasable to wait
Render time w/o BVH and smooth shading mode: Infeasable to wait
Render time w/ BVH and flat shading mode: 6.047 seconds
Render time w/ BVH and smooth shading mode: 10.928 seconds
Comments and Notes:
1. Interestingly, rendering horse.xml takes more time than killeroo.xml despite its triangle count. One possibility of this is the BVH tree may be constructed in an unbalanced way for horse.xml. The other possibility is there is a floor under the horse which makes box at the root of the BVH tree so big that almost every ray intersects with this box which makes intersection query times greater.
2. Although BVH accelerates rendering time tremendously there are few optimization techniques that can be applied:
- Advanced ray-box intersection methods can be used instead of naive methods.
- Advanced ray-triangle intersection methods can be used instead of naive methods.
- Code level optimizations.
These acceleration methods will be implemented in the following weeks.
External libraries used:
- tinyxml2 (tinyxml2.h, tinyxml2.cpp are provided in the homework files.)
- lodepng (lodepng.h, lodepng.cpp are provided in the homework files.)
- Eigen (Can be obtained from http://eigen.tuxfamily.org/)
Command to compile:
g++ -I /usr/include/eigen3/ -std=c++11 -O3 main.cpp RayTracer.cpp Vec3d.cpp Ray.cpp shape.cpp tinyxml2.cpp lodepng.cpp BVH.cpp -o RayTracer
Computer specs:
Intel Core i7-2630QM CPU @ 2.00 GHz, 6 GB RAM
Running the ray tracer:
./RayTracer command should be fed by the relative path of the input file, e. g.,
795_input_set_02/horse.xml
This week's task was to accelerate render time by implementing Bounding Volume Hierarchy (BVH).
File name: bunny.xml
Triangle count: 4967
Render time w/o BVH and flat shading mode:
~53 seconds
Render time w/o BVH and smooth shading mode: ~56 seconds
Render time w/ BVH and flat shading mode: 0.586 seconds
Render time w/ BVH and smooth shading mode: 0.604 seconds
File name: horse.xml
Triangle count: 11216
Render time w/o BVH and flat shading mode:
~32 minutes
Render time w/o BVH and smooth shading mode: ~40 minutes
Render time w/ BVH and flat shading mode: 7.643 seconds
Render time w/ BVH and smooth shading mode: 7.834 seconds
File name: killeroo.xml
Triangle count: 92092
Render time w/o BVH and flat shading mode:
Infeasable to wait
Render time w/o BVH and smooth shading mode: Infeasable to wait
Render time w/ BVH and flat shading mode: 1.822 seconds
Render time w/ BVH and smooth shading mode: 1.951 seconds
File name: dragon.xml
Triangle count: 871414
Render time w/o BVH and flat shading mode:
Infeasable to wait
Render time w/o BVH and smooth shading mode: Infeasable to wait
Render time w/ BVH and flat shading mode: 6.047 seconds
Render time w/ BVH and smooth shading mode: 10.928 seconds
Comments and Notes:
1. Interestingly, rendering horse.xml takes more time than killeroo.xml despite its triangle count. One possibility of this is the BVH tree may be constructed in an unbalanced way for horse.xml. The other possibility is there is a floor under the horse which makes box at the root of the BVH tree so big that almost every ray intersects with this box which makes intersection query times greater.
2. Although BVH accelerates rendering time tremendously there are few optimization techniques that can be applied:
- Advanced ray-box intersection methods can be used instead of naive methods.
- Advanced ray-triangle intersection methods can be used instead of naive methods.
- Code level optimizations.
These acceleration methods will be implemented in the following weeks.
Kaydol:
Kayıtlar (Atom)