Jon Baker, Graphics Programming

    home

    writings

Siren: Masked Planes

  Code page 437 is an extended ASCII table which shipped with the IBM PC. It includes all the standard alphanumerics, plus accented characters, punctuation, greek symbols, terminal UI glyphs, etc. I have played with it before, when I did my text renderer, putting this data into a texture. It's a neat little resource for ASCII art, what is sometimes referred to as "semigraphics".

Code Page 437

  I was invited to participate in the shader jam at the Inércia Demoparty on December 1. This used a piece of software called Bonzomatic, which a friend extended to add compute shader support. Because of the way it was being used - about 30 people connected to a central server in parallel, with a stream running on the host machine shuffling through them randomly - you could not add custom textures, there was a default set plus a couple of Inércia themed ones. I decided to write code page 437 as a LUT, in preparation for the event, encoding the 1-bit pixel values into an array of unsigned integers. The total size of the LUT is 4kB. I ported this to shadertoy, which you can find here. Hopefully it's fairly straightforward to use, if you have an application for it.

  It's kind of an interesting resource. I used it because of the constraints on textures, but I think it's interesting that this will be using different hardware, that this will stay very high up in the caches. At some point, I need to do some profiling between the two methods for my text renderer. I think it will be interesting to see in practical terms, if this is a valuable approach.

  My shader during the event didn't turn out very good, I need to practice live coding if I want to do something like this again. It's a particular skillset to be able to implement these things in the space of an hour or less. I think having some code snippets available would make your life a lot easier - some events disallow that, but this was a pretty chill arrangement, just a bunch of people messing around. I met some new people, and one person who inspired some experiments related to simulating opalescence via brute force metamaterials. More on that, soon.

Usage in Siren

Code Page 437

  Something I decided to try - stacking up some planes and then using an atlassed 3D texture to create these greeble patterns. It has an interesting information amplification thing to it - each texel has a 3-channel color and an 8-bit character ID in the alpha channel. By mapping the x,y to the UV of the texture for each of the planes and the z to the layer in the stack, I can reference a particular texel on a particular character.

optical1 optical1 optical1

  I think it's very interesting, too, how easily you can drop in words. Because everything here is done with real ASCII values, I can iterate through the characters in a string, and drop them into the texture when preparing it. Initially empty, the rest is filled with boxes, lines, etc, of various different characters. It can create very visually complex patterns very quickly and cheaply. It's actually technically "cheaper" to have it tile infinitely - so you can use this to do things like very vast planes with these patterns drawn on them.

voxels1 voxels2

  I really like how it looks, especially when looking through multiple refractive interfaces. This is something I have played around with quite a bit the last month or so, and I think some of them look really interesting. It's very simple logic to accept or reject hits, based on this glyph masking. I messed with using the color channels to inform material types, tried making some of them emissive, things like that. I would like to try to map them onto a cylinder, or maybe try some kind of hallway, where four of these stacks of planes form the walls. It adds a lot of very interesting texture, with a very computationally cheap primitive. Click through on any of these to see full size.

optical1 optical1 optical1

Last updated 1/14/2024