CUDA Ray Tracing 2x Faster Than RTX: My CUDA Ray Tracing Journey

https://news.ycombinator.com/rss Hits: 4
Summary

Welcome! This article is a deep dive into how I made a CUDA-based ray tracer that outperforms a Vulkan/RTX implementation—sometimes by more than 3x—on the same hardware. If you're interested in GPU programming, performance optimization, or just want to see how far you can push a path tracer, you're in the right place. The comparison is with RayTracingInVulkan by GPSnoopy, a well-known Vulkan/RTX renderer. My goal wasn't just to port Ray Tracing in One Weekend to CUDA, but to squeeze every last millisecond out of it—profiling, analyzing, and optimizing until the numbers surprised even me. And this is actually how I learned CUDA. In this write-up, I'll walk you through the journey: what worked, what didn't, and the key tricks that made the biggest difference. Whether you're a graphics programmer, a CUDA enthusiast, or just curious about real-world GPU optimization, I hope you'll find something useful here. The original title claimed a 3.6x speedup, which was true at the time of writing — but after realizing I forgot to add Russian Roulette to RayTracingInVulkan, the performance difference shrunk to 2x. Still very significant, and it's more fair now. Renderer Graphics API Hardware Acceleration Geometry Types Performance (FPS) GPU Time Notes RayTracingInVulkan (GPSnoopy) Vulkan RTX acceleration Procedural sphere tracing + triangle modes ~30 ms ~20 ms ~30 FPS ~50 FPS Added russian roulette for a fair comparison No acceleration structure compaction Using procedural AABBs per sphere Using ray tracing pipeline (no inline ray tracing) CUDA-Ray-Tracing-In-One-Weekend(Mine) CUDA No hardware RT cores Procedural spheres only ~8 ms 105 FPS Same resolution and settings Different sphere locations and materials Implements what we call "inline ray tracing" (without hardware RT pipeline, though) Why is the Vulkan/RTX version slower? While there are many contributing factors, one likely explanation—pointed out by Tanguy Fautré (GPSnoopy)—the author of RayTracingInVulkan, shared his ins...

First seen: 2025-06-26 00:20

Last seen: 2025-06-26 03:21