eddy.work /

Realtime Spheretracing

Inspired by Inigo Quilez , I've created a special kind of ray tracer running on the GPU. I've ported it to VR in the past, and this is a quick and dirty port to WebGL. The novel thing about my implementation was creating an LOD operator which can remove high frequency surface detail (fractals have a lot) in the distance while preserving the signed distance properties which are important for rendering.

Try moving the LOD slider and see how bad the aliasing becomes. You cannot really combat this aliasing through classic multisampling techniques since there is so much detail you would have to take hundreds of samples.

If you want to learn more about it, you can read my old essay (German, sorry!). More realistically you can check out my sources, although my mathematical proof for the LOD operator should also be understandable by an English audience. I might also write a more thorough blog post about it in the future. There are still a lot of loose ends: Currently the LOD operator decrease in detail is linear in relation to the distance, but actual visible surface area behaves quadratically (perspective). Also, I've only proved that the operator works when applied to SDFs, but did not prove it also works when it is applied to SDBs which are a common result of SDF operators (you can see the difference between them here).

Demo:

Since this is an interactive WebGL demo, this does not work without JavaScript, sorry.

Browser-based WebAssembly Application Platform

Today (even more so when I was working on this) the WebAssembly interoperability story looks quite bleak. Inspired by the WASM4 fantasy console, I tried to envision what a WebAssembly fantasy computer might look like. After a bit of digging, I realized that a multitasking WASM Platform, able to run different programs at the same time, would be realizable in the browser. My initial goal was being able to natively run WASM4 binaries. This turned out viable through dynamically linking the WASM4 binaries with a runtime also written in WASM, most importantly no special casing for this in the platform was needed. After reaching my initial goal, I ported the libretro version of the Snes9x emulator to the platform, which should allow to unlock a big part of the libretro software suite in the future.

The project ground to a halt when I realized that the macOS version of Chrome had a bad frame-skipping rendering bug (still not resolved...). In addition, the integration story for different languages was not quite there yet. I am really looking forward to picking this up in the future, hopefully WASI or something else has matured enough to be up to the task by then.

All I have available right now are a few old videos. If I find more time I might clean everything up into a demo-able state.

  • We can run a lot of WASM4 software in parallel.

  • And also SNES games.

VT420 WiFi SSH Client

I acquired a DEC VT420 terminal some time ago- I owned another DEC terminal in the past, but it was just not convenient to use. This time I created an adapter that turns the terminal into a standalone appliance for SSH access.

Another thing that was bothersome about my last terminal experience was the missing unicode support. I found out that the VT420 supports "Soft Characters", i.e. you can upload up to 94 custom glyphs. With that ability, I was able to display up to 94 different unicode characters at the same time.

The most challenging part about this project was dealing with the actual font. It turns out there are not that many low resolution unicode fonts, there really only is GNU Unifont. In addition, I was working with an ESP32-C3 which did not have enough memory to contain the entire font so I had to strip it down to "important" characters.

After finishing up, I realized that, although I feel at home in the shell, I needed to properly learn tmux/screen to put a phyisical terminal to good use. So I ended up donating it to my office.

  • A VT420 terminal showing a list of WiFi networks.
    We can browse our WiFi networks.
  • A VT420 terminal showing a prompt for an IP address.
    And connect to a local SSH server.
  • A VT420 terminal showing it is running an SSH handshake.
    The handshake takes some time on an ESP32-C3.
  • A VT420 terminal showing an directory listing.
    Output of ls appears quickly and looks fine.
  • A VT420 terminal showing the output of a unicode file, umlauts display correctly.
    We can even show unicode by uploading the characters to the terminal on the fly.
  • A VT420 terminal showing the output of an emoji file, emojis are truncated.
    Although the resolution is small and there are not many bitmap fonts with emojis (Unifont is used).