The minimalistic Rubik's Cube mosaic generator written in C++.
Have you ever seen a Rubik's Cube mosaic?
Y'know, these?
Tessellate is a program for Windows that displays a grid of 3D, graphical Rubik's Cubes. The cubes solve themselves in order to display a supplied image in low (or if your CPU can handle it, medium) resolution.
It was my goal to create Tessellate without the aid of huge image libraries. The project served as my first time working with 3D graphics, and I wanted to create each part of the process, from vertex shaders to a custom BMP image loader.
That said, in order to fully realize Tessellate, I needed to take advantage of a few external libraries and resources.
These include:
- Pillow to resize input images and convert between file types
- GLM, a lightweight math library for OpenGL
- GLFW, an OpenGL library that handles windowing and input
- GLEW, the OpenGL Extension Wrangler Library
Tessellate reads a supplied bitmap image file (.BMP) to properly arrange the grid of cubes. If you wish to display another file type, dithering.py will downsample, apply dither, and convert an image to .BMP format.
In the diagram above, Marilyn Monroe (.PNG) is downsampled to an efficient resolution (lower res = faster calculations) and converted into the bitmap image file type (.BMP).
Due to the Rubik's Cube's limited color palette, the image is also manipulated by the Floyd–Steinberg dithering algorithm to maintain as much resemblence to the original as possible.
In the .GIF above, 289 cubes calculate the most efficient set of moves to display their respective patterns. Immediately after calculating, the cubes begin simultaneously solving for the image.
Pick a cube and control its faces manually, or optionally avoid the grid altogether.
Grow your solving skills with fast, easy to learn software. Testing an algorithm? Enter a series of legal moves. Tesselate understands Singmaster notation!
View the action from above...
...or down low.