This project is a 3D rendering of a grand piano implemented in C++ using OpenGL. The renderer loads a 3D model of a piano, applies textures, and displays it in a custom environment with proper lighting and material properties. The project showcases fundamental computer graphics concepts such as texture mapping, lighting, and shader programming.
- 3D Model Rendering: Renders a grand piano model from an
.objfile. - Texture Mapping: Applies textures to the piano using a texture atlas.
- Custom Shaders: Implements vertex and fragment shaders for proper lighting and texture sampling.
- Lighting Effects: Realistic lighting using the Phong shading model.
- Camera Movement: Allows user-controlled navigation around the model.
- Environment Mapping: Simulates the surrounding space with basic background effects.
- C++ Compiler: A modern compiler that supports C++11 or later.
- OpenGL: Version 3.3 or later.
- CMake & Make: For managing the build process.
- Libraries:
- SDL: For creating the window, managing OpenGL context and handling input events.
- tinyobjloader: For loading the .obj 3D model file and the .mtl file.
- glm: For mathematical operations like matrices and vectors.
- stb_image: For loading texture files.
-
Clone the Repository
git clone https://github.com/nicolas-bock/PGRe_Project cd PGRe_Project -
Create
buildfilemkdir build cd build -
Run CMake to generate a buildsystem
cmake ..
-
Build and run the project using the make build system
make -j8 && make run
Use your mouse to move the scene:
- Press and hold the
Right-Buttonto move the scene in the x and y axis (all around the piano). - Press and hold the
Scroll-Buttonto get closer to or further from the center of the scene. - Press and hold the
Left-Buttonto move the light source, up and down, or left and right, by moving the mouse in the same directions. - Press
Escapeto close the window. - Press
F1to add or remove the textures/colors. - Press
F2to switch the light on/off. - Press
F3to switch to phantom mode. - Press
F4to add a fresnel effect.