3D Visualizer on primitives
The 3D renderer is a software-based rasterizer written using very basic primitives such as vectors and matrix calculations for learning purposes.
This is a successful experiment of converting C++ SDL functionality to TypeScript for renderring using Web GPU and CPU (as a fallback). Essentially, this project supports Web GPU Visualizer component for React web applications.
CI health
Technology
This repo contains 3 different implementations of the same 3D renderer:
All versions support:
- Loading
.obj mesh files (bundled or uploaded)
- Texture mapping (PNG/JPEG)
- Camera navigation (mouse gestures, WASD + Arrow keys)
- Multiple render modes (wireframe, filled, textured)
Production demo in Web
You can see result of this project by one click demo on TacTicA.
C++
The test suite uses Google Test framework for comprehensive unit and integration testing. Read more about C++ version
TypeScript
A TypeScript port of a C++ software rasterizer, featuring both CPU-based and WebGPU-accelerated implementations.
Both web renderers include the complete runway scene with the F-22, Eurofighter, and F-117, each using its own transform and texture.
Quick Start
C++ Version
Prerequisites
- Windows: Visual Studio 2019 or later (with C++20 support)
- SDL2: Already included in
dependencies/SDL2/SDL2-2.0.18/
- 3D Models: OBJ files in the
../meshes/ directory
Building and Runnning the Application (Windows/Visual Studio)
You can build within Visual Studio 2026 directly, or using MSBuild from Command Line
# Open Visual Studio Developer Command Prompt or PowerShell with VS tools
# Clean everything
Remove-Item -Recurse -Force x64, Debug, Release, tests\build
# Build Debug x64
msbuild visualizerdl.vcxproj /p:Configuration=Debug /p:Platform=x64
# Build Release x64
msbuild visualizerdl.vcxproj /p:Configuration=Release /p:Platform=x64
# Run the application
.\x64\Debug\visualizerdl.exe # Debug build
.\x64\Release\visualizerdl.exe # Release build
# Run the tests
cd tests
mkdir build
cd build
cmake ..
cmake --build . --config Release
ctest -C Release --output-on-failure
Note: SDL2.dll is automatically copied to the output directory by the post-build event.

Web CPU Version
cd web-cpu
npm install
npm run dev
# Open http://localhost:5173
# Run tests
npm run test
You can see result of this project by one click demo on TacTicA.



Web GPU Version
cd web-gpu
npm install
npm run dev
# Open http://localhost:5175
You can see result of this project by one click demo on TacTicA.



Project Structure
├──.github/
│ └──workflows/
│ ├──cpp-ci.yml # Main pipeline
│ ├──cpp-tests.yml # Tests workflow
│ └──cpp-build.yml # Build workflow
├── c++/ # Original reference implementation in C++
│ ├── visualizerdl.vcxproj # Visual Studio project file
│ ├── Main.cpp # Application entry point
│ ├── Display.cpp/h # Framebuffer and window management
│ ├── Triangle.cpp/h # Rasterization algorithms
│ ├── Vector.cpp/h # Vector math (2D, 3D, 4D)
│ ├── Matrix.cpp/h # Matrix operations and transforms
│ ├── Camera.cpp/h # Camera positioning and movement
│ ├── Mesh.cpp/h # OBJ file loading
│ ├── Texture.cpp/h # Texture/image loading
│ ├── Clipping.cpp/h # Frustum culling
│ ├── Light.cpp/h # Lighting calculations
│ ├── lodepng.cpp/h # PNG decoder
│ ├── dependencies/ # Third-party libraries
│ │ └── SDL2/ # SDL2 2.0.18
│ └── meshes/ # 3D model files (.obj, .png)
├── web-cpu/ # CPU-based TypeScript port
│ ├── src/
│ │ ├── Main.ts # Application entry point
│ │ ├── Display.ts # Framebuffer management
│ │ ├── Triangle.ts # Rasterization algorithms
│ │ ├── Clipping.ts # View frustum clipping
│ │ ├── Camera.ts # Camera controls
│ │ ├── Mesh.ts # OBJ parser
│ │ ├── Texture.ts # Texture loading
│ │ └── math/ # Vector & Matrix math
│ └── index.html
├── web-gpu/ # WebGPU implementation
│ ├── src/
│ │ ├── Main.ts # Application entry point
│ │ ├── Renderer.ts # WebGPU pipeline setup
│ │ ├── shaders/
│ │ │ └── basic.wgsl
│ │ └── (shared: math, Mesh, Camera, Texture)
│ └── index.html
├── meshes/ # Shared 3D model assets (.obj, .png)
└── README.md
Controls
| Key |
Action |
W / S |
Pitch up/down |
↑ / ↓ |
Move forward/backward |
← / → |
Yaw left/right |
| Left mouse drag |
Rotate view |
Right mouse drag or Shift + drag |
Pan view |
| Mouse wheel |
Zoom in/out |
| Double-click |
Reset view |
1-6 |
Switch render modes (CPU only) |
C / X |
Toggle backface culling (CPU only) |
Included Models
- F-22 Raptor
- Eurofighter
- F-117 Nighthawk
- Drone
- Crab
- Cube
- Sphere
License
Apache-2.0