JavaScript-Based Zero Brings an Impressively-Featured 3D Graphics Pipeline to the Terminal

Clever JavaScript package doesn't lean on the GPU, and yet offers programmable vertex and fragment shaders — in JavaScript, naturally.

ghalfacree
about 6 years ago Displays

Developer Haydn Paterson has released Zero, a 3D graphics pipeline written entirely in JavaScript and rendering its output to a terminal window — all without recourse to a system's graphics processing unit (GPU.)

A traditional 3D rendering pipeline, in these days of hardware transform and lighting, leans heavily on the massively-parallel processors in modern graphics cards. Zero, by contrast, doesn't — and it doesn't even require a graphical display, outputting its surprisingly smooth though somewhat monochromatic 3D renders to the console.

"Zero is a small graphics demo that uses JavaScript to replicate the functionality of a GPU and uses the terminal to display its rendered output via nodejs' stdout," explains Paterson, who goes by the handle 'sinclairzx81' online. "Zero was written for fun as well as to see how far one could reasonably push JavaScript performance. Rendering has been tested on Windows, OSX and Linux terminals. This project and associative materials are offered as is to anyone who may find them of use."

The list of features implemented in Zero is surprising: The current release, v2, includes vertex and fragment shaders programmable in JavaScript, perspective Z-correct texture mapping, per-pixel depth buffering, the ability to adapt its resolution according to the size of the TTY, matrix and vector maths libraries, and a scene graph, while supporting operation on Linux terminals as well as Microsoft's PowerShell and Windows Command Prompt.

The software is available from Paterson's 'sinclairzx81' GitHub repository under the MIT Licence, along with instructions on building and running a bundled demo.

ghalfacree

Freelance journalist, technical author, hacker, tinkerer, erstwhile sysadmin. For hire: freelance@halfacree.co.uk.

Latest Articles