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.


Hiç yorum yok:

Yorum Gönder