10000 GitHub - Fahad704/Renderer: Software renderer in C++
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Fahad704/Renderer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Renderer

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.

Features

Rendering Modes

  • 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.

Supported File Formats

  • OBJ: 3D models (Material/MTL support planned for future updates).

Visual Features

  • 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.

Controls

  • 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.

Installation

Prerequisites

  • Operating System: Windows (other platforms not yet supported).
  • Dependencies:
    • g++ compiler.
    • Optional: iconv and windres for specific builds.

Build Instructions

Clone the repository:

git clone https://github.com/Fahad704/Renderer.git
cd Renderer

Using Cmake

Generating build files
mkdir build
cd build
cmake ..
Building and running
cmake --build . --config Release
Release\Renderer.exe

Using GCC and Iconv

cd src
Build.bat

Without Iconv

cd src
build-no-icon.bat

Using Visual Studio

  • Open the .vcxproj file in Visual Studio.
  • Build the project from the IDE.

Running the Application

After building, run the executable from the bin directory:

cd bin
Renderer.exe

Sample Outputs

Ray Tracing

  • White King: A ray-traced render of a chess piece. WhiteKing

  • Spheres: Reflection on spheres rendered using ray tracing. RayTracerReflection

Rasterization

  • Surface Normal Coloring: Visualization of surface normals.

  • DemonSkullDepth

  • Wireframe Mode: A triangle-based wireframe view.

  • DemonSkullTris

  • Single Colour: Same model rendered in single colour with multiple light soources.

  • DemonSkullLightBr

Planned Features

  • 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.

Contributing

Contributions are welcome! To get started:

  1. Fork the repository.
  2. Create a new branch (git checkout -b feature-name).
  3. Commit changes (git commit -m "Description").
  4. Push to the branch (git push origin feature-name).
  5. Open a pull request.

Acknowledgments

  • Gabriel Gambetta: For inspiration through Computer Graphics From Scratch.

About

Software renderer in C++

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

0