Skip to content

ForgeCreations/gluttony

 
 

Repository files navigation

Gluttony - Ray Tracer

BVH_demo

A simple ray tracer with BVH acceleration, built with C++ and OpenGL (OpenGL only for quick iteration, switching to Vulkan later). This project starts as a real-time renderer, BVH visualization tools, and shader tester. But after the renderer is matured this will become a Game Engine.

Current Features

  • BVH Acceleration: Spatial acceleration structure for fast ray-scene intersection
  • Real-time Rendering: Interactive rendering with camera controls
  • Debug Visualization: Multiple BVH visualization modes:
    • Bounding box hierarchy
    • Bounding Box intersection test counts
    • Triangle intersection test counts
  • Shader Hot-Reloading: Edit shaders and see changes in real-time
  • Mesh Import: Supports most common mesh formats with automatic optimization
  • Performance Metrics: Detailed BVH statistics and rendering timings

Future plans

  • GPU ray tracing via compute shaders
  • Physically-based materials

Getting Started

Prerequisites

  • CMake 3.20+
  • C++20 compatible compiler
  • OpenGL 4.6
  • GLFW
  • GLEW
  • Assimp
  • MeshOptimizer

Building

git clone git@github.com:Mich-Dich/gluttony.git
cd gluttony
vendor/premake/premake5 gmake2 && make -j

Running

replace <your_arcetecture> with the arcetecture you want to use, typicly only one available. eg: Debug-linux-x86_64

bin/<your_arcetecture>/gluttony_editor/gluttony_editor

Controls

  • Mouse Right Button + WASD/space/left Control: Move camera
  • Mouse Right Button + Mouse: Look around
  • Mouse Right Button + Mouse wheel: Move faster/slower

BVH Visualization Modes

Toggle in the debug UI:

  1. Bounding Boxes: Visualize BVH hierarchy
  2. Box Tests: Show intersection test counts
  3. Triangle Tests: Visualize triangle traversal

Key Components

BVH Implementation

  • Compact BVH node structure (32 bytes per node)
  • SAH (Surface Area Heuristic) for optimal splits
  • Binned SAH evaluation for performance
  • Multi-threaded BVH construction

Rendering Pipeline

  • SSBOs for geometry data transfer
  • Optimized triangle intersection

Performance

Typical performance on my NVIDIA GeForce RTX 3060 Laptop:

  • BVH build time: 15-40ms for complex meshes
  • 2-5ms BVH traversal for primary rays

Contributing

Contributions are welcome! Please open an issue or pull request for any:

  • Bug fixes
  • Performance improvements
  • New features
  • Documentation updates

License

MIT License - see LICENSE for details.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++ 94.6%
  • GLSL 2.8%
  • Lua 1.5%
  • C 1.1%