Rendering

image

Optimization

image

Lighting

image

Dynamic Lighting

Static Lighting

image

Data Model

In this 3D engine, all geometry is fundamentally composed of triangles, the simplest polygon in 3D space. Each triangle is defined by three vertices, represented as 3D vectors. Complex meshes are formed by aggregating multiple triangles, enabling the representation of arbitrarily detailed surfaces. Models are imported using the standard Wavefront .obj and .mtl formats, which describe vertex positions, face indices, and material properties.

The camera is defined by a position vector in world space, along with yaw and pitch angles controlling its orientation. Rendering involves a series of linear transformations applied via 4×4 matrices. Vertices are first transformed from model space to world space, then into view space using the camera's view matrix. Finally, the projection matrix maps coordinates into clip space, which is subsequently normalized and rasterized to screen space. This transformation pipeline allows consistent and efficient mapping of 3D geometry onto a 2D viewport.

For example, this is a mesh for a single triangle:

v 0.0 0.0 0.0  
v 1.0 0.0 0.0  
v 0.0 1.0 0.0  
f 1 2 3