Ray tracer loosely based on raytracing in one weekend series, adapted for real time rendering on GPU.
Overall project structure comes from my project template with some changes to enable compute functionality.
Compute shader renders the ray traced scene into a texture that gets displayed onto a screen quad with a fragment shader.
ComputeMaterial holds the target texture, data buffers, pipeline and descriptor sets.
The scene consists of a an array of materials and an array of triangles. Each triangle holds a reference to the material. Reference is just material's index in the array for ease of use on GPU.
BVH used to accelarate triangle search is a flat array too, since GPU doesn't support recursion.
- Fix synchronization issues 😠
- Glass materials.
- Fog.
- PBR materials.
- Light sampling.
- Render spheres.
- Include spheres in bhv.
- Try "roped" bvh to see how it improves performance.
This is an instruction for mac os, but it should work for other systems too, since all the dependencies come from git submodules and build with cmake.
- Download and install [Vulkan SDK] (https://vulkan.lunarg.com). Add $VULKAN_SDK environmental variable.
- Pull glfw, glm, stb and obj loader:
git submodule init
git submodule update
- Create a buld folder and step into it.
mkdir build
cd build
- Run cmake. It will create
makefile
in build folder.
cmake -S ../ -B ./
- Create an executable with makefile.
make
- Compile shaders. You might want to run this with sudo if you dont have permissions for write.
mkdir ../resources/shaders/generated
sh ../compile.sh
- Run the executable.
./vulkan