This is a project to learn about Compute Shaders and Ray Tracing in Unity. I am following the great article by David Kuri on the topic.
Each stage of the project will be available as individual tag.
Tag | Description |
---|---|
01-setup-raytracing-master | Create the controller script which invokes the compute shader. |
02-sample-from-texture | Create rays and sample from Skybox texture. |
03-trace-ground-and-sphere | Trace rays and intersect with ground plane and sphere. |
04-progressive-sampling | Progressive sampling to remove aliasing when camera doesn't move. |
05-mirror-reflection | Mirror-like reflection for metallic objects by bouncing rays. |
06-diffuse-reflection | Add diffuse reflection for non-metallic objects. |
07-lambert-diffuse-phong-specular | Use Lambert Diffuse and Phong Specular via importance sampling. |
This is the output after setting up the RayTracingMaster.cs
script to invoke Unity's default compute shader.
The output after creating rays and sampling from a Skybox texture:
The output after adding a ground plane and sphere. Nasty aliasing!
After progressive sampling, the sphere looks much better.
After adding bouncing rays for mirror-like reflections for metalic materials, we can see relections in reflections in relections in ...
After adding additional diffuse reflections, everything is made of plastic.
After adding Lambert Diffuse and Phong Specular reflections and combining them based on importance sampling, we start to look a lot nicer. We also added randomized spheres and a slider for global illumination.