How ssloy/tinyrenderer works
TinyRenderer is a command-line CPU software renderer: the user supplies OBJ model paths, and the program writes a TGA framebuffer. Its runtime covers model and texture loading, camera transforms, per-vertex/per-fragment shading, triangle rasterization with depth testing, and image output. The README describes a broader teaching series, but the sampled implementation supports the core rendering path and tangent-space normal mapping; unsampled tutorial topics are not represented as implemented subsystems.
Main entry points: main.cpp Render entry point · our_gl.cpp Triangle rasterizer · model.cpp OBJ model loader · tgaimage.cpp Framebuffer
Components 13
Render pipeline
- Render entry point
main.cpp - Camera transforms
our_gl.cpp - Phong shader
main.cpp - Triangle rasterizer
our_gl.cpp - Depth buffer
our_gl.cpp - Framebuffer
tgaimage.cpp
Assets and images
- OBJ model loader
model.cpp - Mesh attributes
model.cpp - Model textures
model.cpp - TGA image I/O
tgaimage.cpp - Rendered TGA
tgaimage.cpp
Math foundation
- Vectors and matrices
geometry.h
Other components
- User
Connections 18
- User → Render entry point: supplies model paths
README.md - Render entry point → OBJ model loader: loads models
main.cpp - OBJ model loader → Mesh attributes: parses attributes
model.cpp - OBJ model loader → Model textures: loads maps
model.cpp - OBJ model loader → TGA image I/O: reads texture files
model.cpp - Render entry point → Camera transforms: sets camera
main.cpp - Render entry point → Phong shader: constructs shader
main.cpp - Phong shader → OBJ model loader: reads mesh and maps
main.cpp - Render entry point → Triangle rasterizer: rasterizes triangles
main.cpp - Triangle rasterizer → Phong shader: shades fragments
our_gl.cpp - Triangle rasterizer → Depth buffer: tests and updates depth
our_gl.cpp - Triangle rasterizer → Framebuffer: writes pixels
our_gl.cpp - Render entry point → Framebuffer: creates image
main.cpp - Render entry point → Rendered TGA: writes TGA
main.cpp - Framebuffer → TGA image I/O: uses image storage
tgaimage.cpp - Camera transforms → Vectors and matrices: uses matrix math
our_gl.cpp - Triangle rasterizer → Vectors and matrices: uses vector math
our_gl.cpp - Phong shader → Vectors and matrices: transforms attributes
main.cpp