張鈞法Chun Fa Chang莊沁傑Chin Chieh Chuang2019-08-292014-8-52019-08-292014http://etds.lib.ntnu.edu.tw/cgi-bin/gs32/gsweb.cgi?o=dstdcdr&s=id=%22GN060147022S%22.&%22.id.&http://rportal.lib.ntnu.edu.tw:80/handle/20.500.12235/92865隨著快速的圖形處理器的問世,以及GPGPU語言的誕生,我們可以在圖形處理器上做更複雜的計算。然而現階段卻少與有人願意使用圖形處理器模擬光線追蹤這種高度模擬畫面的技術。我們推究原因是因為大部分的開發者認為使用光線追蹤生成一張畫面的成本太高;此外因為Shader已經有許多強大且方便開發的引擎,所以他們認為不需要再多學新的像OpenCL和CUDA的這類GPGPU語言。 為了達到我們的目的,我們提出兩種將光線追蹤實行在Shader上的方法: One Pass Rendering Algorithm和Hybrid Rendering Algorithm,也實作了Phong Lighting效果以及Environment Mapping效果,並且針對不同類型的場景與Shader上的光柵化技術做畫面品質以及效能上的比較並且量化其結果。 我們展示兩個技術的差異以及解釋其優劣比較。雖然光柵化技術會比光線追蹤技術來的快,但我們也無須擔心這樣的結果。因為增加的效果並不會造成兩個技術的效能差距擴大。相反地,我們可以利用光線追蹤技術得到較好的畫面品質。我們藉由這次實驗我們成功地將在圖形處理器上實行光線追蹤的可行性。With faster graphics processors and GPGPU languages, we have the ability to compute more complex data. However, we found few people want to simulate ray tracing on the graphics processor which can render high quality pictures. The developers think the cost of generating one frame is expensive by tracing rays. Besides, they are not willing to learn new GPGPU languages such as OpenCL and CUDA, because of the lack of powerful and convenient engines. In order to achieve that purpose, we offer two methods: One Pass Rendering Algorithm and Hybrid Rendering Algorithm to implement ray tracing on Shader and also implement the Phong lighting effect and the environment reflection effect. We compare the image quality and performance between rasterization and our Shader based ray tracing by different kinds of scenes and we also quantify the results of this comparison. We show the difference between GPU ray tracing and rasterization and we explain the pros and cons of them. The performance of rasterization is better than ray tracing, but we do not need to be worry about it. Because we do not get the larger performance gaps between GPU ray tracing and rasterization by increasing effects. On the contrary, we can gain higher image quality by using ray tracing technology. According to this experiment, we successfully prove the possibility of ray tracing simulation technology on GPU.圖形處理器光線追蹤光柵化Phong效果環境貼圖GPURay TracingRasterizationPhong lightingEnvironment Mapping使用圖形處理器模擬光線追蹤與光柵化成像畫面差異及速度之比較Image Quality and Performance Comparison between GPU Ray Tracing and Rasterization