A performance-oriented software renderer built from the ground up in modern C++. This project deliberately avoids high-level graphics APIs (like OpenGL or Vulcan) to achieve a deep understanding of the underlying mathematics and hardware-level interaction.
The project is under active development. The current focus lies on the mathematical foundation and direct display interfacing under Linux.
- Custom Linear Algebra Library: Self-implemented
Vec3andMat4classes, including mathematical operations such as dot product, cross product, normalization, and matrix transformations. - Native X11 Integration: Direct communication with the X-Server via
Xlib.h. Mapping a custom framebuffer to anXImagefor real-time visualization. - Memory Management: Manual management of the framebuffer as a contiguous memory block (
std::vector<Color>).
- Goal: Establish mathematical primitives and initial pixel output.
- Result: Successful rendering of a wireframe cube via the X11 interface.
- Challenge: Projecting 3D poits onto a 2D screen coordinate system.
- Solution: Implementing Model-View-Projection (MVP) matrices and a LookAt function for camera control.
- Problem: Displaying filled surfaces instead of wireframes.
- Solution: Implementing Barycentric Coordinates to determine fragment inclusion within primitives.
- Problem: Handling "Z-fighting" and incorrect object overlapping.
- Solution: Implementing a Depth Buffer (Z-buffer) for correct geometry occlusion.
- Language: Modern C++
- OS Interface: X11 (Linux Native)
- Build System: CMake
- Mathematics: Custom-built (no external libraries like GLM for now)
Prerequisite: libx11-dev must be installed on your system.
mkdir build && cd build
cmake ..
./rasterizer