Check out my Youtube video here:
Graphics and sound library from captainys
Audio from @freemusicc
Demoscene is a computer subculture and artistic movement that emerged in the 1980s and centers around the creation of real-time audiovisual demonstrations, known as "demos," on computer platforms. These demos showcase the technical and artistic skills of programmers, artists, and musicians within a limited space and time frame. Demos typically feature graphics, sound, and often innovative programming techniques.
The demoscene began in the 1980s on home computer platforms like the Commodore 64 and Amiga. Early demos were often created by "cracking" groups to showcase their skills in breaking copy protection on games and software. Over time, the focus shifted from cracking to artistic expression and technical prowess. Demoscene groups formed, competing to create the most impressive demos at events known as "demoscene parties."
Demoscene places a strong emphasis on technical artistry, where programming and graphic art are mixed to create interesting visual effects, animations, and intricate scenes that challenge the boundaries of what can be achieved with code. Programmers often delve into low-level rendering techniques, shaders, and optimization to create stunning visuals that captivate viewers and showcase their programming prowess.
Demos also often push hardware to its limits, demonstrating what was possible on older systems. Creating demos helps preserve computing history and demonstrates the enduring creativity of the demoscene community.
I was inspired by the more geometric-looking graphics in the example demos I watched and wanted to do something similar. I also wanted to incorporate elements of vaporwave and the outrun aesthetic to give it a feel of the 1980s, when demoscene began.
While demos can feature a wide variety of music genres, demos on older platforms like the Commodore 64 and Amiga will often use chiptune music, characterized by the distinctive sound of vintage computer and video game hardware like the NES (Nintendo Entertainment System), Commodore 64, Atari 2600, and Game Boy. I chose Density & Time - MAZE due to its catchy beat and chiptune sound.
To make some simple moving geometric art using only C++, I first defined the shapes I was creating as a mesh of triangles. I first made a rotating cube on the 2D screen by definging the original object coordinates, projecting them into the virtual space using a projection matrix, and rotating it around various axes using rotation matrices.
To do this, I first normalized the screen space as shown below.
Normalizing the screen also ensures that the field of view is not limited to a rectangle but instead a space defined by a variable
When objects are further away, they appear to move less. This means the
To define
Thus,
To simplify this a bit let aspect ratio,
Now we have a projection matrix:
3d affine transformation matrices can then be used for translating, scaling, or rotating the points before projecting them:
Although I used an OpenGL graphics library, I coded the projection, translation, rotation, and scaling matricies from scratch. Each triangle in the cube is simply 3 points drawn using the GL_LINE_LOOP
OpenGL primitive and projected into the virtual 3D space. Each frame, the points are rotated about the
For the grid, I defined the initial locations of 6 horizontal and 10 vertical lines. For the movement of the horizontal lines, instead of using a projection matrix, I instead gave the horizontal lines an initial velocity and an acceleration to simulate them appearing to move faster as they approach the viewer. Each frame, the
y1 += (vel * t) + (0.5 * accel * pow(t, 2));
y2 += (vel * t) + (0.5 * accel * pow(t, 2));
where:
const double vel = 3, accel = 0.0001, dt = 0.01;
One of the key elements of the vaporwave aesthetic is the large sun. I used the GL_POLYGON
OpenGL primitive with 64 points to create a "circle" and used a radial shading technique using glShadeModel(GL_SMOOTH)
where I defined the color of a section of the polygon based on the angle the point makes from the first point:
if (angle == 0.5 * YS_PI)
{
glColor3ub(252, 20, 252); // neon pink
}
else
{
glColor3ub(22, 255, 255); // aqua
}
For the last scene, although this technique would not have been possible if I were creating a demo to be played on old hardware, I added a .png background that eventually pans up to the ending screen.
I used the same technique to animate the octehedron as I did the cube except I restricted rotation and translation to the