Skip to content

About

No description, website, or topics provided.

Resources

Stars

2 stars

Watchers

1 watching

Forks

Latest commit

 

History

34 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

cuda-raytracer

An interactive path tracer written from scratch in CUDA and C++. It loads Blender-exported OBJ/MTL scenes through a hand-written parser, traces every pixel in a single CUDA kernel launch per sample, and presents the result in an SDL2 window that converges live while WASD moves the camera. The committed render path is diffuse surfaces under a sky-gradient light; the sources also carry commented-out experiments with reflections and normal mapping that were re-enabled temporarily to produce the demo captures in the wiki.

Chrome and gold Suzannes on a mirror floor under a sunset sky, rendered by this code

Facts

  • 512 x 288 render, upscaled into a 750 px SDL2 window, one gpuRender launch per sample
  • Up to 50 bounces per ray, 4000 samples per pixel cap, 16 x 16 thread blocks
  • Sphere intersection by quadratic, triangles by Moller-Trumbore with barycentric normal and UV interpolation
  • One axis-aligned bounding box around the mesh, then a linear scan, no BVH
  • Whole scene in CUDA managed memory, with a one-thread kernel that repairs vtable pointers so virtual calls work on the device
  • Hand-written OBJ/MTL parsing: v, vn, vt, triangulated f, usemtl, newmtl, Kd, map_Kd, map_Bump

Building requires reconstructing src/cuda-wrapper/cuda.cuh, a header from a git submodule whose upstream repository is gone. The header is small and reproduced in full in the wiki, together with the include and flag fixes current toolchains need. It is intentionally not committed here.

Documentation

Page Contents
Overview What it is, the architecture in one chart, key numbers
The render loop and progressive accumulation Kernel launch shape, per-pixel curand, accumulation, movement resetting convergence
Geometry and intersection Sphere quadratic, Moller-Trumbore, barycentric interpolation, the single AABB
Materials and textures The diffuse path, the commented-out experiments, ColorTexture and ImageTexture
OBJ and MTL loading What the parser handles, Blender export workflow
CUDA implementation notes Managed memory, the vtable repair kernel, relocatable device code
Building and running in 2026 The missing submodule story, build fixes, headless capture, RTX A2000 performance
Demo gallery Every capture and exactly what was temporarily enabled to produce it

About

No description, website, or topics provided.

Resources

Stars

2 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages