Skip to content

khshmt/3dRenderer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

66 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🧩 3D Software Renderer

A simple and lightweight software renderer written in C++, capable of loading and rendering 3D models in Wavefront .obj format — without using GPU APIs such as OpenGL or DirectX.

This project was built as a learning exercise in computer graphics, rasterization, and 3D mathematics — understanding how pixels, triangles, and transformations come together to form a rendered scene.


🖼️ Preview

3D Renderer Preview 1 3D Renderer Preview 2 3D Renderer Preview 3 3D Renderer Preview 4


🚀 Features

  • CPU-based 3D rendering pipeline (no GPU acceleration)
  • Support for .obj mesh loading
  • Basic Rasterization and Lighting
  • Basic Texturing (if textures available with the same model name)
  • Real-time display using SDL2
  • Control camera position and camera yaw angle with Arrow Keys and camera pitch angle with W/S keys
  • Optional integration with Tracy (profiling) and Google Benchmark

🧱 Dependencies

Library Purpose Install via vcpkg
SDL2 Window creation & rendering vcpkg install sdl2
SDL2_image Texture loading vcpkg install sdl2-image
SDL2_ttf Font rendering vcpkg install sdl2-ttf
Tracy (optional) Performance profiling vcpkg install tracy
Google Benchmark (optional) Benchmarking vcpkg install benchmark

💡 The project uses vcpkg with CMakePresets.json for dependency management and build configuration.


⚙️ Building

  1. Clone the repository:
    git clone https://github.com/khshmt/3dRenderer.git
    cd 3dRenderer
    cmake --preset=default
    cmake --build --preset=default

🚀 Running the Project

After building the project, you can run the executable directly from the build directory.

▶️ Run from the command line

./3dRenderer <path_to_obj_model>

🕹️ Controls

Key Action
1 Wireframe Mode
2 Wireframe with vertices
3 Rasterization with lighting Mode
4 Rasterization with lighting and Wireframe Mode
5 Texture Mode
6 Texture with Wireframe Mode
/ Move camera forward / backward
/ Rotate camera yaw (turn left/right)
W / S Adjust camera pitch (look up/down)
C Enable keyframe culling
X Disable keyframe culling
R Disable or Enable model rotation the default no rotation
Enter Switch model (in case the argument is in a directory has other models)
Space stop model rotation if it is rotating
Esc Exit the renderer

💡 Use these controls to navigate the 3D scene and toggle rendering modes dynamically.


📚 Credits

This project was developed while following the 3D Graphics Programming from Scratch course by Gustavo Pezzi, founder of Pikuma.
Both the learning process and the included 3D assets are based on this course, and are used here purely for educational and non-commercial purposes.

About

3D Software Renderer

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages