Website powered by

3D Renderer (C99 SDL)

A complete 3D software renderer built entirely in C99 with no graphics API dependencies. Pure CPU-based rendering demonstrating fundamental computer graphics principles from the ground up.

🖥️ Graphics Systems Developed
Rendering Pipeline

Software Rasterization – Complete triangle rasterization with scanline filling, built without GPU acceleration
Z-Buffer Depth Testing – Per-pixel depth buffer implementation for correct occlusion and overlapping geometry
Backface Culling – Normal-based face rejection optimizing render performance by discarding non-visible triangles
View Frustum Clipping – Geometry clipping against view boundaries preventing artifacts from off-screen polygons

3D Mathematics & Transformations

Custom Vector Library – vec2, vec3, vec4 implementations with full arithmetic operations
Matrix Operations – 4x4 matrix math for transformations including multiplication and inversion
Model Transform – Scale, rotation, and translation matrices for object positioning in world space
View Transform – Camera/look-at matrix construction for scene navigation
Projection Transform – Perspective projection matrix with configurable FOV, aspect ratio, and near/far planes
Coordinate Space Pipeline – Full vertex transformation chain: Local → World → View → Clip → Screen space

Lighting & Shading

Flat Shading – Per-face lighting calculations using surface normals and light direction
Light Source System – Directional lighting with configurable intensity affecting surface brightness
Normal Calculation – Cross-product based face normal computation for lighting evaluation

Texture Mapping

UV Coordinate System – Texture coordinate interpolation across triangle surfaces
Texture Sampling – Texel fetching from loaded texture data mapped onto 3D geometry
Perspective-Correct Interpolation – Proper texture mapping accounting for depth (1/w correction)

Mesh & Asset Loading

OBJ File Parser – Wavefront .obj loader supporting vertices, texture coordinates, normals, and face definitions
Dynamic Mesh Storage – Runtime mesh data structures handling variable vertex and face counts
PNG Texture Loading – External texture file support via upng integration

Display & Color Buffer

Framebuffer Management – Manual color buffer allocation and pixel manipulation
Color Representation – 32-bit ARGB color handling with channel packing/unpacking
SDL2 Integration – Window creation and buffer presentation for displaying rendered frames

Camera System

Free Camera Controller – Position and rotation controls for navigating the 3D scene
Look-At Targeting – Camera orientation computed from position, target, and up vectors

🔗 Source Code
Full project available on Gitea:
gitea.com/b4ndicoot/c99-3d-renderer

Built with: C99 | SDL2
Type: Software Renderer / Graphics Engine
Platform: Cross-Platform (Windows/Linux/macOS)
#computergraphics #3drenderer #softwarerenderer #c99 #cprogramming #graphicsprogramming #gamedev #lowlevel #rasterization #portfolio