Behind the scenes: 5 Shades Of Grey

Szórádi Balázs
Lethargy Dev
Published in
7 min readSep 24, 2020

5 Shades of Grey is a demo we (Lethargy) released at Gubbdata 2020, a special C64 retro demo party. As the title suggests, this article will walk you through the demonstration giving you part by part details.

Here is the full demo on youtube for you to recap or watch for the first time.

Concept

Our concept was to remember the 90's when the majority of eastern block families could not afford a color tv/monitor for the c64. In Hungary a cheap black & white TV, the Russian made Yunost was the usual choice.

Russian made B&W Yunost TV

Users with such a set had no colors, therefore our demo uses only five colors (3 grey colors plus black and white) of the fixed 16 colors palette.

The title

The name of the demo comes from Vincenzo, who originally had the idea to call the demo “50 shades of grey” but accidentally mistyped it in our forum as “5 shades of grey”. And as it turned out there are exactly 5 shades of grey on the c64 so the name was set.

Intro

Lethargy HQ 1991

The intro screen shows a scener starting up his C64 on a black & white Junoszt TV back in 1991 to watch a demo. Technically there is nothing special in this part, standard MC picture with hires sprites for the TV screen. Great colored background “real” world by Grass.

Code: Visage Gfx: Grass

Parallax

Lethargy in parallax

The first part shows a multi-layer logo swinger creating a parallax effect. The routine uses 4x4 chunky mode in multicolor char mode, allowing 13 dither colors in 80x50 resolution. You will see that we used this mode a lot in this demo. (Note: this mode was not invented by us.)

Code: EGO Gfx: Grass

Presents

Presents with the 5 B&W colors

This part uses a mode called “hyper screen” in which the screen is turned off, but opening the top/bottom borders would in fact leave the screen on with no character fetches. In a mode like this only sprites and rasters can be displayed with the benefit of easy timing, as no cycle stealing character fetches are happening (No bad lines). Opening the side border in this mode is a piece of cake. (Note: this mode was not invented by us.)

Code: Strepto Gfx: Grass

Wave scroll

This part uses normal MC char mode in multi-color char mode with 4x4 size pixels showing the title of the demo on a wawing ribbon.

Code: EGO Gfx: Grass

Gfx part

This part displays an MC bitmap covered with one layer of X expanded hires sprites. This allows a total of 5 colors with no restrictions (4 of which from the bitmap and 1 from the sprite overlay). Drawing with only color restrictions is a rare enjoyment for the c64 artist. Grass for sure enjoyed every minute of it.

The fade-in/out uses the “bad line elimination” VIC trick to allow quick updates of colors for the whole picture with minimal raster time. (Normally you would have to update 1000 bytes in color ram and 1000 bytes in screen ram for a full picture. With the trick in place this is reduced to 80 updates)

Code: Strepto Gfx: Grass

Head

The head part started with creating a 100MB 3D voxel scan of EGO’s head, which then was then scaled down to a 10000 poly 3D mesh:

EGO’s head in 3D mesh view

Then with a C++ application, this mesh was sliced by 50 horizontal planes. 50 planes were needed because in 4x4 mode we have 50 rows of graphics.

EGO’s head intersected by 50 planes

On each plane, the intersected object’s perimeter consists of 16 sides/segments therefore the whole head consists of 50 x 16 = 800 segments.

Each segment’s 3D coordinates were transformed to planar 2D polar coordinates plus texture coordinates. Each plane has one specific horizontal row in the texture, therefore the texture is 50 pixels high.

The texture used in the demo is 256x50 pixels

Code: EGO Gfx: Grass

Chess wave

The idea for this part came from the first prototype of the wave scroll which was a waving chessboard. As in the meantime, Strepto came up with using 4x4 FLI in char mode with max. 13 dither colors, EGO had an idea to further improve the base effect by adding a feeling of perspective with shading. EGO pointed out that he loves how the outward progressing wave hides the one behind.

Code: EGO

Grey

The grey part was the first piece of work for this demo, originally planned as an intro, finally became the main inspiration for the demo. The background effect is an animating roto zoomer, with a neat PETSCII logo over it.

Code: EGO, Strepto Gfx: Grass

Twister

The twister in this demo can both twist and zoom, each twist stage has 16 zoom levels that are cleverly selected and modulated in realtime. The zoom stages are Z shaded, extended with the small shadow on the left side to increase the feeling of depth. The effect needs to do 1600 reads and 1600 writes per frame, running at approximately 25fps.

Code: Strepto, Gfx: Grass

Greetings

The greetings part features a scroller, a logo, and a zooming chessboard moving independently and blended transparently. Uses the same 4x4 char mode with 13 dither colors like most of the effects in this demo.

Code: EGO

Environment mapping

Environment mapping is an old-school demo effect from the nineties. The trick is in fact pretty simple, just use the vertex normals as texture coordinates. The result is a fake but realistic reflective surface, hence the name environment.

Code: EGO, Gfx: Grass

End part

The end part is an MC bitmap with a set of multiplexed sprites for the scroller. The scroller consists of 56 sprites with double buffering for smoothness.

In multicolor mode, the bit combinations “00” and “01” belong to the background and “10” and “11” to the foreground. Thus setting the sprites to the background the bitmap bit combinations “10” and “11” will appear on top of the sprites giving a nice bitmap overlay on the sprites.

Code: Visage, Gfx: Grass

Testing

d’Avid excelled at putting together our hardware test environment, finally offering side by side comparison of the demo running on different c64 models and peripherals. Thanks to his efforts we hopefully made sure the demo runs in sync and problem-free on your c64. (PAL only sorry.)

To rule out CIA timing issues, we used boards with both CIA chip versions. We used three 1541-II floppy-drives (+JiffyDOS) to see how loading speeds of different drives affect the demo/music sync.

The test environment

Blackmagic Design Intensity Shuttle USB 3.0 with a MacBook Pro 2015. The Intensity Shuttle was throwing away the video signal of the C64 because it has a non-standard 50.125 Hz refresh rate. Therefore d’Avid had an idea to connect his Sony RDR-HX870 DVD-recorder in between as a TimeBase Corrector. The video output of the DVD-recorder (a 3 component RCA RGB-signal) is then fed to the Intensity Shuttle USB. Apple ProRes 422 HQ was the capture format in SD PAL which is more or less a RAW format, so an instance of each recording was almost 3GB on disk. The 8 recordings totaled almost 24GB of raw data which you finally see scaled-down in the multiview comparison video. For video editing, Adobe Premiere Pro CC was used.

Music

Vincenzo excelled at creating the soundtrack for the demo. For some demos, we have the soundtrack ahead, then we try to figure out which part of the music suites which effect… This demo was more or less complete before having the soundtrack, so Vincenzo could put his full potential at composing fitting music for the demo. Visage helped Vincenzo master GIT and the build system so he could do on the fly test builds to see how the music fits the parts.

The reception

The demo finished 4th at the party, which is, in our opinion, a bit off compared to what we believe realistic. On the other hand, we got excellent reception and loving feedback for it which is why we love doing demos for you.

Full credits

Code: EGO, Strepto, Visage
Music: Vincenzo
Graphics: Grass
Charset: Grass
Linking: Visage
Loader: Sparta (Genesis Project)
Test: d’Avid
Dir Art: Grass

Making this demo was approximately 6 months of our limited spare time…

--

--

Lethargy Dev
Lethargy Dev

Published in Lethargy Dev

In this publication, you will find articles on c64 (mostly demo) development. Articles cover coding, pixeling, music-making, cross-platform development, algorithms, etc…

Szórádi Balázs
Szórádi Balázs

Written by Szórádi Balázs

Programming in assembly, c, c++, java, javascript, typescript. Interested in 3d graphics, visual effects, demoscene, dsp, c64, cycling, climbing…