u/Usual-Wall5405

I wanted to understand how Cycles works, so I coded my own GPU Path Tracer from scratch in C#. Here is my final render!
▲ 176 r/GraphicsProgramming+2 crossposts

I wanted to understand how Cycles works, so I coded my own GPU Path Tracer from scratch in C#. Here is my final render!

https://reddit.com/link/1tflvbe/video/ajy6qm93do1h1/player

https://preview.redd.it/0pcbp4wbdo1h1.png?width=2560&format=png&auto=webp&s=71fe1904133ba0c0790feebeb02a0709e8266cb8

Hey r/blender,

I've spent countless hours watching Cycles do its magic, so I decided to learn the math under the hood and write my own GPU Path Tracer from scratch in C#!

It runs directly on my Nvidia GTX 1050 using ILGPU to compile C# into CUDA. Here is a 3-second camera flyby I just rendered!

Tech Stack & Features:

  • GPU-Accelerated: No game engine, just a pure C# console app running on CUDA via ILGPU.
  • PBR Materials: Rough metals, glass with refraction (including hollow glass), and shiny plastic (using Schlick's approximation for clearcoat Fresnel).
  • Physical Camera: Real Depth of Field (adjustable aperture/focus distance) and lens bokeh.
  • Lighting: Physical sphere sun casting soft shadows, combined with global illumination.
  • Post-Processing: ACES Tonemapping, Gamma 2.2, and a custom GPU Bilateral Denoise Filter to clean up fireflies while keeping edges crisp.

I literally started with a flat, solid red circle on a blue screen. Seeing it evolve into normal mapping, moving it to the GPU, and finally watching ACES and the denoiser work together has been an incredible coding journey.

Since I am only 15 and still learning, I'd love to hear your feedback! How close does this look to Cycles in your opinion? What features should I code next?

Code is fully version-controlled on Git, and I'll keep optimizing it!

https://github.com/noackjona-hash/GPU-Path-Tracer-from-scratch-in-C-

reddit.com
u/Usual-Wall5405 — 3 days ago