I wrote this Real Time RayTracer from Scratch in 1 Week. Hybrid Rasterization + Raytracing Demo @ProjectPhysX
I wrote this Real Time RayTracer from Scratch in 1 Week. Hybrid Rasterization + Raytracing Demo  @ProjectPhysX
Uploaded July 2021 | Updated September 2026, 1 week ago
I wrote this real time OpenCL raytracer in one week from scratch and without any external libraries.

Timestamps
0:00 Intro
0:02 1 Sphere
0:29 64 Spheres
1:34 Triangles - reflection
2:23 Triangles - reflection+refraction
4:10 How it works
4:39 Outro

This project was first inspired by this awesome video from the YouTuber NamePointer: youtu.be/lKIytgt3KXM

It is surprisingly easy: From the camera, shoot a ray through every pixel. Reflect the ray off the first surfaces in its way, reflect the reflection 2 more times. Finaly when the reflected ray hits the skybox, mix all the colors to paint the original pixel with.
The GPU does this for all 2 Million pixels on the screen in parallel.

I implemented:
- ray-sphere intersection
- ray-triangle intersection (Möller-Trumbore algorithm)
- reflection as well as refraction with Snell's law
- hybrid rasterize-raytrace approach: First rasterize triangles and instead of the pixel color save their IDs in the bitmap. Then the raytrace kernel looks up the ID to immediately get the first intersecting triangle. This way the first intersection and reflection are basically free, so the shiny Stanford bunny with 70k triangles runs at 200+fps.

Because I wrote the raytracer in OpenCL, it runs on any OpenCL capable device (GPUs, CPUs, even my Samsung phone). No proprietary RTX hardware required.

Music: Unfound - Promenade
I wrote this Real Time RayTracer from Scratch in 1 Week. Hybrid Rasterization + Raytracing DemoFluidX3D on GigaIO SuperNODE - Concorde 40 Billion Cell CFD Simulation - 33h on 32x MI210 64GB GPUsPhysX3D [GRAVITY SIMULATION] SonnensystemPlasma-SpeakerRaytracing 871000 Triangles in Real Time... on Intel Integrated GraphicsReal Time Video Playback in cmd.exeLiquid metal on a speaker (Slow Mo Guys), but as simulationReal Time Ray Tracing... in the Command Prompt in 16 ColorsReal Time Ray Tracing... in the Command Prompt in 616 dithered ColorsPhysX3D [GRAVITY SIMULATION] 5k body galaxy simulated in real timePhysX3D [GRAVITY SIMULATION] Euler vs. RK4 / Sonnensystem im Jahr 3016SoundFFT [AUDIO SPECTRUM ANALYZER] Music Demo
Dr. Moritz Lehmann |

I wrote this Real Time RayTracer from Scratch in 1 Week. Hybrid Rasterization + Raytracing Demo

SHARE TO X SHARE TO REDDIT SHARE TO FACEBOOK WALLPAPER