/3d-engine

M1 Computer Science course about rendering 3D objects

Primary LanguageC++

3D engine

This is a 3D engine that I am developing in C++ using only standard libraries. The engine is based on the Github repository of Dmitry V. Sokolov.

This project takes place in the context of the course "How a 3D rendering engine works" of the University of Lorraine for the Master 1 in Computer Science.

How to use

To compile and execute the project, you can use the following command:

cmake -B build
make -C build
./build/engine [degree]

Evolution of the project

To render this image, I had to implement the following features:

  • Bresenham's line algorithm
  • World Matrix
  • Camera Matrix
  • Projection Matrix
  • Perspective Projection

African head with no backface culling

Then I implemented the backface culling algorithm to render only the visible faces of the object.

African head with backface culling

I implemented the filling triangle algorithm to render the faces of the object. After that, I implemented the z-buffer algorithm to render the faces of the object with the correct depth and also the Gouraud shading algorithm to render the faces with the correct color.

African head with Gouraud shading

I added the texture mapping algorithm to render the faces of the object with a texture. You can see the result below.

African head with texture mapping

And now with the Gouraud shading algorithm and the texture mapping algorithm.

African head with Gouraud shading and texture mapping

The final addition to the project was the implementation of the normal mapping and specular mapping algorithms to render the faces of the object with a normal map and a specular map.

African head with normal mapping and specular mapping