Renderer is a C++ application for rendering 3D models using either a ray tracer or a rasterizer, designed to learn the graphics pipeline and Windows API. It supports rendering OBJ files with basic lighting and includes features for visualization and debugging.
This project is inspired by Gabriel Gambetta's Computer Graphics From Scratch and includes custom implementations.
- Ray Tracing: Provides high-quality rendering but is slow for high-poly models.
- Rasterization: Optimized for real-time rendering with support for various visual debugging features.
- OBJ: 3D models (Material/MTL support planned for future updates).
- Lighting: Simple light rendering.
- Wireframe Mode: Toggle for edge-based rendering.
- Anti-Aliasing: FXAA for smoother edges.
- Bounding Boxes: Visualize object bounds.
- Backface Culling: Toggle to improve performance by discarding non-visible polygons.
- W, A, S, D: Move the camera.
- Space/CTRL: Move the camera up/down.
- SHIFT: Increase moving speed.
- Mouse: Rotate the camera.
- Key Bindings:
R
: Toggle ray tracing/rasterization.G
: Lock/unlock the mouse.V
: Toggle wireframe mode.B
: Show/hide bounding boxes.C
: Toggle backface culling.P
: Export the current frame to a PPM file.Q
: Reset camera position and rotation.L
: Display model details.F
: Toggle FXAA anti-aliasing.ESC
: Exit the application.
- Operating System: Windows (other platforms not yet supported).
- Dependencies:
g++
compiler.- Optional:
iconv
andwindres
for specific builds.
Clone the repository:
git clone https://github.com/Fahad704/Renderer.git
cd Renderer
mkdir build
cd build
cmake ..
cmake --build . --config Release
Release\Renderer.exe
cd src
Build.bat
cd src
build-no-icon.bat
- Open the
.vcxproj
file in Visual Studio. - Build the project from the IDE.
After building, run the executable from the bin
directory:
cd bin
Renderer.exe
-
Surface Normal Coloring: Visualization of surface normals.
-
Wireframe Mode: A triangle-based wireframe view.
-
Single Colour: Same model rendered in single colour with multiple light soources.
- Porting to OpenGL: Rewrite the renderer in OpenGL.
- Material and Texture Support: Import and render MTL files.
- Performance Optimizations: Acceleration structures (e.g., BVH) for ray tracing.
- Cross-Platform Support: Expand compatibility to Linux and macOS.
Contributions are welcome! To get started:
- Fork the repository.
- Create a new branch (
git checkout -b feature-name
). - Commit changes (
git commit -m "Description"
). - Push to the branch (
git push origin feature-name
). - Open a pull request.
- Gabriel Gambetta: For inspiration through Computer Graphics From Scratch.