Version 1 — © 1993 Christian Cohnen
Left / Right: cycle model · Click or tap: cycle model · Space: reset speed
A real-time software Z-buffer 3D rendering engine. Originally written in Borland Turbo Pascal and x86 Assembly for DOS in December 1993, targeting VGA Mode 13h (320×200, 256 colors). Since modern systems cannot run DOS executables, the original code was transpiled to JavaScript/Canvas in 2026.
The demo renders rotating 3D polygon objects and pre-rendered sphere sprites into the same scene, all composited through a shared Z-buffer for correct depth ordering. Polygon faces are flat-shaded based on their Z-depth (closer = brighter). Sphere sprites use a pre-computed depth map so they correctly occlude and are occluded by the polygon geometry.
.CON binary filesrequestAnimationFrame| Name | Type | Description | Default |
|---|---|---|---|
model | number | Starting model index (0=halb/dome, 1=wing, 2=ring/torus) | 0 |
| Key / Input | Action |
|---|---|
| Arrow Left / Right | Cycle through 3D models |
| Click or tap canvas | Cycle through 3D models |
| Space | Reset rotation speed to defaults |
<canvas id="game" width="640" height="400"></canvas>
<script>var ZBUFFER_CFG = { model: 0 };</script>
<script src="zbufferdemo.min.js"></script>
Originally written in Borland Turbo Pascal 7.0 with TASM x86 Assembly (December 1993).
The JavaScript port uses the authentic original data: 3D models parsed from the binary .CON files
(HALB, WING, RING, WURF1), the sphere Z-depth map from
KUGEL.DAT, the 5 sphere textures and the 256-color palette from KUGELN!.PCX —
all embedded directly in the script. The rendering logic (Z-buffer compositing, scanline polygon rasterizer,
depth-based shading, sphere placement) faithfully follows ZERO3D2.PAS.