Skip to content

Project to learn about Compute Shaders and Ray Tracing in Unity

Notifications You must be signed in to change notification settings

langep/unity-ray-tracing-gpu-shader

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Unity - GPU Ray Tracing in Unity

About

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.

Project Organization

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.

01-setup-raytracing-master

This is the output after setting up the RayTracingMaster.cs script to invoke Unity's default compute shader.

Unity Default Compute Shader

02-sample-from-texture

The output after creating rays and sampling from a Skybox texture:

Skybox Texture

03-trace-ground-and-sphere

The output after adding a ground plane and sphere. Nasty aliasing!

Sphere with Aliasing

04-progressive-sampling

After progressive sampling, the sphere looks much better.

Sphere with Progressive Sampling

05-mirror-reflection

After adding bouncing rays for mirror-like reflections for metalic materials, we can see relections in reflections in relections in ...

MirrorReflection

06-diffuse-reflection

After adding additional diffuse reflections, everything is made of plastic.

DiffuseReflection

07-lambert-diffuse-phong-specular

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.

LambertDiffusePhongSpecular

About

Project to learn about Compute Shaders and Ray Tracing in Unity

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published