Skip to content

Twister

Making a column appear to twist, one horizontal slice at a time

A twister makes a column appear to rotate by giving its horizontal slices different angles. The visual effect can be calculated during rendering or assembled from prepared graphics, as in Bitbreaker's C64 example.

A twister makes a column appear to turn like a strip of soft material. Its top and bottom face different directions, and the twist travels along its length. A useful way to construct it is to treat the column as a stack of horizontal slices, each with its own rotation angle.

Drawing a slice

Imagine looking down on a square slice. As it rotates, the positions of its corners change. Viewed from the front, its visible sides become horizontal spans on one screen line. Give successive slices different angles and the column twists; change those angles over time and it moves.

Nikos Papadopoulos demonstrates this in a shader, a program that calculates the image on the graphics processor. His example computes corner positions with sine functions, draws the visible spans and applies a texture. It calculates these positions while rendering, so pre-drawn rotation frames are not a requirement of the effect.

A C64 approach

Bitbreaker’s Codebase64 example prepares narrow strips of an eight-sided shape at different rotation steps. During display, the C64 selects those stored strips in an order that produces the twist. The preparation program and the running demo have different jobs: one generates graphics; the other chooses which graphics to show.

His implementation uses FLI on alternate display lines to select character and screen data. Sprites cover the unwanted area beside the shape. This is a particular C64 rendering method, not the definition of a twister.

The same article adapts its stored-strip approach to an x-rotating cube and a waving chequerboard. Their motion differs, but they share prepared graphics and tables that select the visible strips. The examples show why an apparent three-dimensional movement need not involve redrawing a complete solid object every frame.

Sources

See also

Checked. Verified against primary sources and signed off by a person.