Admin | Edit

The light - Linux 256 bytes (Outline 2023)


100% x86 assembly program again and my first heavy use of the stack in a procedural graphics intro, i rewrote the code at least 3 times to fit the three layers i wanted to add.

It shows a night scene of a light illuminating some forefront sea / road and distant city lights / stars backdrop.

The idea was to produce something "less abstract" on Linux than my previous attempts, looked through my old minsky sketches and i had this sea reflection thingy which was a bit boring alone so i tried to build something around it.

Wrote an intermediate C version on Godbolt from which i used the GCC ASM output as a way to get faster result, i think GCC did reasonably well with some bits of optimization for 2 layers but i had to rewrite the whole program assembly code to use 3 layers, the colors handling code is the only part that didn't change that much compared to the GCC output.

There is three layers (backdrop, light, sea) with 8 parameters each, the (distorted) minsky circle algorithm use a lot of right shifts and the stack is heavily used to store the minsky x,y state for each layers (6 states), i also push the parameters and handle most of the right shifts with AVX2 vpsravd instruction.

There is some x86 tricks to handle drawing direction (up / down) which is dependent on data order / single bit pattern.

The program with the creation process i enjoyed the most probably, i was kinda stuck with 2 layers for some times and really wanted to fit in three layers, i had an idea with the stack and AVX2 and the dev took a night with the binary ending exactly at 256 bytes which was a very satisfying experience ! :)

I also built a small p5js tool to adjust the parameters of the layers. Download. (4.3MB .zip)

The 2 layers version i built upon. (also 256 bytes)

original 2 layers version, scaling, colors and lens flare fakery was perhaps better, a tiny bit higher bytes cost though

The light "demotool", all images produced with this are 256 bytes ! :)

some early minimalist version which i liked, also see this

another version with a bent sky, the forefront didn't fit much

a rough "planet" seen from above version

"rain" layer with heavy transforms, was a potential candidate

the "too much" fake Bokeh version

back to topLicence Creative Commons