Imagine the love child of character art and modern GPUs. Okay, probably you totally can’t imagine that, but someone did it anyway, entirely in JavaScript.
And I do mean replicated the GPU. The appropriately dubbed South Korean user “sinclairzx81” built this with a scene graph, and the usual math libraries, and programmable shaders.
Just instead of those programmable shaders running on a GPU, they run natively in JavaScript and output to the characters in the standard Windows, Mac, and Linux terminals.
It seems crazy, but this does demonstrate the … uh … actually, it really is completely crazy, but it is very cool. And it does genuinely output all of this via stdout in Node.js. The author claims the reasoning is “to see how far one could reasonably push JavaScript performance,” but “just because I could” seems as likely an explanation.
Check these features in the free library, dubbed Zero, I guess in reference to the number of real GPUs involved:
- Programmable Vertex and Fragment shaders (in JavaScript)
- Perspective Z-Correct Texture Mapping
- Per Pixel Depth Buffering
- Adaptive Resolution on Terminal resize (TTY only)
- Matrix and Vector math libraries.
- A Scene Graph
- Support for Windows Command Prompt, Powershell and Linux Terminals
It is licensed under an MIT license, so you could build on this. At the very least, I guess the OLED on your next hardware synth has no excuse not to render something interesting.
https://github.com/sinclairzx81/zero