In this project, I used CUDA to render a scene to an OpenGL texture, which was then then drawn as a standard frame buffer. To test the renderer, I first started with simple shapes (cubes and spheres) and then I finished the project by drawing a Menger Sponge. By applying rotation to each ray, I could twist and deform the sponge.
What went well
- My Custom C++ Engine had become quite flexible by this point, which allowed me to easily integrate this new renderer into my pipeline.
- CUDA allowed me to use standard debugging features such as breakpoints, so one I understood how CUDA structure and workings, I was able to debug smoothly and effectively.
What went wrong
- Debugging in CUDA took some adjustment initially, since it runs in giant clusters of threads. I had to learn better practices for debugging and finding cases that would bring bugs and issues to light.
What I Learned
- It was interesting to note that in debug mode, the stack was more bloated, so it overflowed significantly earlier, which limited my approach to the problem. As a result, I switched from a recursive solution to an iterative one for easier testing in debug mode.
CODE SAMPLE - CUDARENDERER.cu
Below is part of my CUDA renderer, which handles DDA raytracing and drawing.