A program that emulates the 3d rendering process writed from scratch in the CPU with C++ for fun
It uses assimp to import some 3d objects files with materials
Check some results
- Perspective projection (world, camera and screen space ...)
- Naive triangle clipping
- Camera implementation with translation (with front, right and up vectors) and rotation (based on pitch and yaw)
- Basic triangle scan line using triangle bounding box
- Triangle interpolation for vertex attributes with z correction
- Per pixel light, uv mapping with textures, wireframe, depth testing and more
- Everything is writed in an array of pixels (Pixel buffer) and sended to GPU to draw as a simple texture
- GPU is not used at all (only to show the result)
- Face culling based on camera front vector (recent)
You can build by downloading the project and compiling it or by downloading the results that also come with models for test
- On the topbar click on File -> Open then select the model 3d to open
To move use the wasd or the arrows
To look around drag the mouse with right click
The menu has the following options
- Change the render resolution
- Change draw mode/shader (wireframe, light, normals, positions, uvs, patterns, depth)
- Change camera movement and rotation speed
- Fov, Aspect Ratio
- FPS view
- Pattern scalar option (for pattern draw mode)
- ZFar and ZNear planes
- Back-culling
- Perfect clipping
- Light direction and ambient light strength
- A better triangle drawing algorithm, to get more peformance
- Triangle clipping is done perfectly only on Z axis, maybe if done in all axis will increase performance
- Here is some print of the results with the best angle