Back to Portfolio
C C++ WebAssembly OpenGL WebGL 1.0 Bullet Physics

Custom Data-Driven Rendering Engine

A high-performance custom 3D rendering and physics engine written in pure C/C++ and compiled to WebAssembly. Achieves 60 FPS with 2,000+ physics bodies in a microscopic 380kb payload.

The Architecture

Modern web engines often come with massive overhead. I wanted to prove that by controlling the memory layout manually and utilizing a data-driven design, you can achieve native-level performance inside the browser with zero load times.

Additionally, the rendering pipeline explicitly targets WebGL 1.0 instead of WebGL 2.0. This architectural choice guarantees maximum compatibility, ensuring the engine runs flawlessly even on older browsers and lower-end hardware devices that lack WebGL 2.0 support.

380kb
WASM Size
60
Stable FPS
2000+
Physics Bodies
Zero
Memory Gaps

Demo 1: Physics Stress Test

2,000 spheres falling with real-time Bullet Physics collision.

Launch Demo

This demo drops 2,000 distinct 3D spheres into a square container. Because standard JavaScript engines struggle with this level of continuous physics collision, the simulation is calculated entirely in C++ using Bullet Physics, compiled directly to WASM. Because the compiled size is only 380kb, it loads instantly and maintains a perfect 60 frames per second.

Demo 2: The Custom Memory Allocator

Complex shapes, rendering, and zero-fragmentation memory logging.

Launch Demo

In this iteration, I added multiple complex geometry shapes to the data-driven pipeline. But the real engineering feat is under the hood.

I wrote a custom malloc allocator specifically to handle objects in a data-driven way. Standard allocators create memory fragmentation over time. My allocator ensures objects are packed perfectly into memory.

DEBUG: The Memory Dump

While running either of the demos above, press the P key. The browser console will dump all custom allocator memory data, mathematically proving the engine maintains zero memory fragmentation/gaps even while managing thousands of dynamic objects.