Direct Display Raytracing
Whenever anyone indulges in computer programming, it is a law of nature to have a raytracing phase at some point; of course, I was no exception. However, since it is not really the most unique of all hobby projects, I tried to give mine somewhat its own handwriting by going low-level, pushing the computed pixels directly to the display frame buffer and rendering them without any window manager.
The raytracer is in a fairly simple version, defining only planes and spheres along with diffuse and reflective materials. The display is accessed under Linux with the Direct Rendering Manager kernel module, allowing us to send data without detours straight to the graphics driver.
I wrote that project around 2021 (can you imagine — writing code in pre-LLM times?) and only it cleaned up a bit since then. It’s built in C with some primitive, hand-crafted vtables and uses libdrm to handle the ioctl gymnastics. The program looks for /dev/dri/card0 by default but you can choose the node via parameter.
I always wanted to add OpenCL functionality to compute the raytracing with a shader to drastically improve performance, but I never got around diving into it to figure out its intricacies. Would be cool though to have 30 fps raytracing with some camera movement and DRM support.