Skip to content

Starting my first raytracing project, I learned this from The Cherno. This raytracer is written from scratch but it also is going to be made with interactivity in mind so we will also be using Vulkan.

License

Notifications You must be signed in to change notification settings

j-2k/Raytracing

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

40 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

First Raytracing Project

This is my first time trying to tackle raytracing from scratch, I will be documenting my learning journey on everything I do & learn on my website. I try to make it in a way that is simple to understand as much as possible, if you would like to check it out click the blog link above or click here.

Its important to know before hand this project is not fully written from "scratch" but it kind of is atleast the raytracing part. we are mostly using a vulkan image & assigning its pixels to "emulate" a raytracer, but anyway this project is a Walnut template originally & we just built a raytracer ontop of it. Its mostly just ImGUI for UI, GLM for math, & GLFW for window stuff.

I also show how this raytracer works in unity & show the individual rays of how they create a sphere, this is essentially the same algorithim used in my raytracer. To see visualization & images of how my raytracer works you can check either the Repository or Blog.

Building this project

I used Visual Studio 2022 so I suggest that IDE, but you also need latest version of the Vulkan SDK.

Learning Resources & Useful Links

My journey through raytracing with pictures!

Click here to go to my website where I show much more in a better fashion.

The big stages of my raytracer through stages in 1 image, below has all the steps shown in order. RaytracerShow

The Hello World Stage

first uv

The first sphere using ray intersection

first sphere

Visualizing the raytracer in Unity

Visualkization

First shaded raytraced sphere

Camera interactivity was also added. Screenshot_2

Multiple Spheres & Reflective rays added

reflective

Roughness "Material" (only applied on bottom sphere)

roughness

Skybox color added

roughsky

Visualizing Ambient Occlusion with different roughness

ao no rough AOro ao rough

Roughness + Skybox + AO

nice

Pathtracing (Accumulation of frames)

ptrt

CPU Multithreading

Performance Increase: 76% Faster Overall (50ms > 20ms > 12 ms)

60% Faster 50ms to 20ms - Utilizing all cores using for each function with a parallel execution parameter.
40% Faster 20ms to 12ms- All cores were using 1 Random Engine, Changed to use thread_local, so each thread has its own random engine.
CPU Multithreading

Emissions

Process of working towards Emissions Final Emissions
Screenshot_3 Weird Diffuse & Specular mix looked cool Screenshot_6 Disabling sky color & only showing emission
Screenshot_4 Diffuse Only Screenshot_7 Yellowish Sun
Screenshot_5 The First Emission Screenshot_8 Blue Sun
Accumulation of ~3 minutes with a yellow emission

Screenshot_9

Faster Randomness using PCGHash (3~ ms improvement, 20~ ms to 17~ ms)

These improvements might be small but improvements on already low ms are really good in my eyes, kinda think of them as exponential improvements the lower in ms we go.

About

Starting my first raytracing project, I learned this from The Cherno. This raytracer is written from scratch but it also is going to be made with interactivity in mind so we will also be using Vulkan.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages