This project served its educational purpose, teaching me mathematical and programming concepts behind rendering a 3D space. I do not plan to revisit this project, other than to review as a personal reference.
This project uses code found in Gustavo Pezzi's (highly recommended) "3D Computer Graphics Programming" course, found here: Pikuma Courses
Assets (models and textures) made by Author: Mathilde_Lea, LICENSE
This 3D renderer uses a left-handed coordinate system, with a clockwise triangle face winding order. Its development was for educational purposes, not commercial application. Understanding mathematical and programming concepts was prioritized over performance considerations. All rendering is done on CPU.
Primary functionality learned / implemented:
- Vector (Vertex) Transformations
- Orthographic vs. Isometric vs. Perspective Projection
- Coordinate System Handedness
- Game Loop Time Step / Delay Function / Constant Framerate
- Creating Triangle Meshes
- Digital Differential Analyzer vs. Bresenham's Line Algorithms
- OBJ File (3D Model) Input
- Back-face Culling
- Triangle Rasterization
- Painter's Algorithm (Face Sorting by Depth)
- Z-Buffer (Replacing Painter's Algorithm)
- 3D Matrix Transformations
- Light and Shading
- Texture Mapping
- Perspective Correct Interpolation
- Camera Implementation and (Frustum) Clipping
- Graphics Pipeline Structure
Ancillary lessons learned / skills trained:
- Command-line Git
- Include and Library Paths
- Static vs. Dynamic Libraries
- Makefile Advanced Features and Limitations
- Greater Understanding of C vs. C++
- Broad differences between graphics APIs / Graphics Pipelines
Keypress Guide
- ESC Key: close window / exit program
- W Key: rotate camera pitch down (objects rotate 'up')
- A Key: rotate camera yaw right (objects rotate 'left')
- S Key: rotate camera pitch up (objects rotate 'up')
- D Key: rotate camera yaw left (objects rotate 'right')
- Up Arrow Key: move camera forwards
- Down Arrow Key: move camera backwards
- 1 Key: render wireframes and dots at vertices
- 2 Key: render wireframes
- 3 Key: render filled triangles (solid color)
- 4 Key: render filled triangles and wireframes
- 5 Key: render textured triangles
- 6 Key: render textured triangles and wireframes
- C Key: enable backface culling
- X Key: disable backface culling
- Simple DirectMedia Layer (SDL2):
- A cross-platform development library designed to provide low level access to audio, keyboard, mouse, joystick, and graphics hardware via OpenGL and Direct3D
- Sean Middleditch's uPNG:
- Supports loading and decoding PNG images into a simple byte buffer, suitable for passing directly to OpenGL as texture data
- Vim, VS Code, Ubuntu, MacOS