diff --git a/src/content/parallellines.md b/src/content/parallellines.md new file mode 100644 index 0000000..17afadb --- /dev/null +++ b/src/content/parallellines.md @@ -0,0 +1,46 @@ +--- +name: parallellines +cover: /images/parallellines/head.png +highlight: true +summary: GPU software rasterizer implemented from scratch to replicate OpenGL's basic functionality. +order: 1 +year: 2024 +tags: + - Graphics + - C++ + - CUDA + - Personal project +sidebar: + - /images/parallellines/head.png + - /images/parallellines/boggie_body.png + - /images/parallellines/head_wireframe.png +--- + +[You can find the project on GitHub at github.com/franciscunha/parallellines.](https://github.com/franciscunha/parallellines) + +GPU software rasterizer made by following [ssloy’s *tinyrenderer* course](https://github.com/ssloy/tinyrenderer) and then porting the CPU-only rasterizer code to the GPU with CUDA. The rasterizer can handle rendering a single model with a diffuse and specular texture and a normal map, through user-defined vertex and fragment shaders. + +I still find it incredible how just a collection of numbers – after having a whole lot of math done to them – can create all the beautiful visuals we see in video games and animation! + +# What I learned + +My goal was to improve on my knowledge of graphics programming by understanding some of the details of how it works at a low level. + +Although I already had [partly implemented the rendering pipeline for an Intro to CG course at UFPB](https://github.com/franciscunha/introduction_to_computer_graphics), that was done using Three.js, so I felt the details were still abstracted away, specially with regards to how such a program runs on the GPU. + +## Results + +The project furthered my skills in C++, teaching me about advanced techniques such using pointers to create compact and manageable data structures; as well as specific language features such as class templates, pure virtual functions, or inline functions. + +Applying in practice concepts I’d learned only in theory reinforced my knowledge of them. I now have a stronger understanding of concepts like the rendering pipeline, matrix operations and transformations, rendering lines and triangles and the implementation of basic shaders. + +Prior to this project I had no experience with CUDA. It taught me the basics of how it works and its API, and how tricky it can be to manage host and device memory, specially when dealing with complex data structures like the ones needed for CG applications. I now feel equipped to leverage the GPU for any system that might make use of its parallellization capabilities. + +## Resources used + +- [https://github.com/ssloy/tinyrenderer](https://github.com/ssloy/tinyrenderer) +- [https://jtsorlinis.github.io/rendering-tutorial/](https://jtsorlinis.github.io/rendering-tutorial/) +- [https://www.songho.ca/opengl/gl_camera.html](https://www.songho.ca/opengl/gl_camera.html) +- [https://developer.nvidia.com/blog/even-easier-introduction-cuda/](https://developer.nvidia.com/blog/even-easier-introduction-cuda/) +- \+ many posts in Stack Overflow and Nvidia developer forums + diff --git a/static/images/parallellines/boggie_body.png b/static/images/parallellines/boggie_body.png new file mode 100644 index 0000000..82a9ebf Binary files /dev/null and b/static/images/parallellines/boggie_body.png differ diff --git a/static/images/parallellines/head.png b/static/images/parallellines/head.png new file mode 100644 index 0000000..9e09651 Binary files /dev/null and b/static/images/parallellines/head.png differ diff --git a/static/images/parallellines/head_wireframe.png b/static/images/parallellines/head_wireframe.png new file mode 100644 index 0000000..5de5dfa Binary files /dev/null and b/static/images/parallellines/head_wireframe.png differ