An interactive 3D graphics showcase demonstrating real-time Frustum Culling mathematics, built from scratch with C++ and Raylib.
This project visualizes the "invisible" mathematics of 3D rendering. Instead of sending every object in a scene to the GPU, this engine mathematically extracts the 6 planes of the camera's View-Projection matrix and performs real-time intersection tests against Axis-Aligned Bounding Boxes (AABBs).
Objects outside the camera's vision are culled, optimizing rendering performance.
- Real-Time Frustum Culling: Implements the positive/negative vertex trick for optimized AABB-to-Plane intersection testing.
- Frustum Locking: Freeze the camera's projection matrix in world space to visually inspect the 3D culling pyramid.
- Picture-in-Picture Minimap: A secondary top-down orthographic camera renders the scene layout and vision cone to an independent texture.
- State Visualization: Color-coded rendering (Green = Inside, Yellow = Intersecting, Red = Culled).
- Perspective Math Correction: Accurately visualizes clip-space bounds in world space using inverse matrices and the perspective divide (
W).
| Key/Input | Action |
|---|---|
W A S D |
Move Camera |
Mouse |
Look Around |
SPACE |
Lock/Unlock Frustum Wireframe |
You will need Xmake installed on your system to build the project. Xmake will automatically fetch Raylib for you.
-
Clone the repository:
git clone git@github.com:PauloRuan30/Frustum-Culling.git cd Frustum-Culling -
Curl the XMake, build it and run: (here the xmake quick start link if you need)
curl -fsSL https://xmake.io/shget.text | bash xmake build xmake run