Home

Awesome

Overview

This project collects multiple compute shader based ray tracing samples for Unity. Because the samples use compute shader for ray tracing, they are not as fast as hardware ray tracing. The main purpose of this project is demonstrating how the ray tracing works. It is very helpful for the people who want to know the knowledge behind hardware ray tracing. This project contains following samples:

Acknowledge

The voxel model in this project is created by MagicaVoxel.

Samples

Ray Tracing in One Weekend

<img src="./Screenshot.gif" height="333px" width="640px" > This sample demonstrates how to implement a basic ray tracer using compue shader. The implementation is based on

Ray Tracing in One Weekend article.

Image Quality Compare

Samples per pixel : 64

Maximum tracing depth : 64

Samples per pixel : 16

Maximum tracing depth : 6

Ray Query

<img src="./RayQuery_Screenshot.gif" height="333px" width="640px" >

This sample demonstrates how to implement ray query using compue shader. This sample uses simple ray tracing for shading and ray query for shadow.

Hybrid Rendering

<img src="./HybridRendering_Screenshot.gif" height="333px" width="640px" >

This sample demonstrates how to use ray query in fragment shader to render shadow. This sample uses traditional rasterizing for shading and ray query for shadow. That is why it is called hybrid rendering.

Voxel Ray Tracer

This sample demonstrates how to build a simple BVH tree and use it in compute shader to speed up scene traversal. This sample uses voxel scene to simplify the BVH building procedure.

With BVH

Without BVH