A (timid) real-time 3D renderer written in C++ with GPU acceleration via Metal.
Detailed File Breakdown
├── build/
│ └── renderer # Compiled binary
├── include/
│ ├── AppDelegate.hpp
│ ├── Math.hpp # Utility functions for vector and matrix math
│ ├── Mesh.hpp # Represents 3D models and geometry data
│ ├── MyMTKViewDelegate.hpp
│ └── Renderer.hpp
├── src/
│ ├── AppDelegate.cpp # Manages the application
│ ├── Main.cpp
│ ├── MyMTKViewDelegate.cpp # Custom delegate for the MetalKit view
│ ├── Renderer.cpp # Main rendering logic
│ └── shader.metal # Metal shading code
├── third-party/
│ ├── metal-cpp/ # Metal C++ bindings
│ └── metal-cpp-extensions/
- Real-Time 3D Rendering using Metal
- Custom Vertex & Fragment Shaders for lighting and materials
- Dynamic Point Lights with attenuation and time-based pulsing
- Modular Codebase for easy extension and reuse
The Metal shader (shader.metal) includes:
- Vertex Shader
- Transforms vertices into clip space
- Calculates per-vertex world positions, normals, and colors
- Fragment Shader
- Computes lighting using:
- Ambient, diffuse, and specular components
- Distance-based attenuation
- Time-based pulsing effects
- Computes lighting using:
- macOS with Xcode and Metal support
make,clanginstalled
Run the following from the root directory:
make -j8The output binary will be located at ./build/renderer.
./build/rendererThis project is licensed under the terms outlined in the LICENSE file.
- Apple Metal for the GPU framework
- metal-cpp for enabling C++ bindings to Metal
