ObjViewer is a lightweight 3D object viewer built with modern OpenGL. It enables users to load .obj files, control lighting, and explore the scene with intuitive camera controls.
- Support for
.objfile loading, including material and texture support. - Dynamic lighting management with multiple light sources.
- First-person camera controls.
- C++20-compatible compiler
- CMake 3.27 or newer
- Dependencies: GLFW, GLAD, GLM, TinyOBJLoader, stb_image (automatically fetched via
FetchContent)
- Clone the repository:
git clone https://github.com/SoggyRihno/ObjViewer cd ObjViewer - Create a build directory and navigate into it:
mkdir build && cd build
- Run CMake to configure the project:
cmake ..
- Build the project:
cmake --build .
- Prepare a
.objfile and its associated material/texture files. The obj, mtl, png, ect must be in the same folder. The ones I used can be found here https://casual-effects.com/data/index.html. - Run the application from the command line, specifying the path to the
.objfile:
./ObjViewer path/to/model.objDebug\ObjViewer.exe path\to\model.obj- Move Forward:
W - Move Backward:
S - Strafe Left:
A - Strafe Right:
D - Sprint (Fast Movement):
Left Shift - Slow Movement:
Left Control - Adjust View: Move mouse
- Exit Application:
Escape
- Spawn a Light at Current Camera Position:
; - Delete Current Light:
' - Select Next Light:
Right Arrow - Select Previous Light:
Left Arrow - Set Current Light to Camera Position:
P - Increment Light Color (hold
Up ArroworDown Arrowwhile pressing a color key):- Red:
8+Up Arrow/Down Arrow - Green:
9+Up Arrow/Down Arrow - Blue:
0+Up Arrow/Down Arrow
- Red:
- Adjust Light Intensity:
- Increase:
Up Arrowonly (without8,9,0) - Decrease:
Down Arrowonly (without8,9,0)
- Increase: