Carpetdiem is a collection of 555 generative carpet forms created by a digital code that fuses ancient patterns and contemporary algorithms. Continuously evolving designs are digitized in the form of 555 pieces of NFT collection where each artwork is unique. Through the algorithm developed by Mammadov, a novel artwork is created at each run. Generated artwork fuses thousands of years of history with contemporary technology that suits the automated era that we live in.

license: CC BY-NC 4.0

Carpetdiem, from a point of view, is more than just an NFT, it is rather smartly crafted bridge between past and future. Mammadov almost throws a magic carpet on the floor of blockchain and gives you a digital experience to walk through the memories of a long-lost culture. Also, the magic is giving its holders IP rights to fully ownership and possibility to monetize their carpet art. Inspired by the tedious craftmanship of weaving, infinite dimensions of savannahs and deserts as well as mystical harmony of mathematics, Carpetdiem provides an exquisite encounter of time, space and being.


The Carpetdiem is a representation of the magic in mathematics through a mesmerizing display of the fractal geometry that unfolds like blossoming flowers to infinity. Spontaneously evolving designs captivate the viewer by a hypnotizing temptation and take them to an exquisite journey on a magic carpet. Indeed, revealing the unique beauty in mathematics is at the core of Orkhan Mammadov’s work. The recursive fractal system that was derived from the Sierpiński carpet formula subdivides the shape of the equilateral squares consecutively while the algorithm generates a different configuration at each run and creates unique patterns autonomously.

The ubiquitous precision of universe lies in every piece of nature whether it is living or non-living. Indeed, we are surrounded by a whole system that agrees with mathematical formulas, algorithms, and magic numbers such as Fibonacci sequence, the golden ratio, Π number etc... Such an agreement enchanted scientists, artists, architects, and engineers for centuries and led them to a quest to find the perfect harmony. As the human eye finds pleasure in formations that agree with such formulas, it has been suggested that the foundation of beauty and aesthetics lies within the mathematical sequences and algorithms. Mammadov dives deep into the mysteries that binds beauty and mathematics to digitize the craftsmanship of his home country: Azerbaijan. Carpet weaving has been a long-time tradition in Azerbaijan where patterns have certain meaning and spiritual significance. Mammodov, as an intergenerational artist, creates a fusion between past and future by translating the ancient carpet patterns into a contemporary digital code that generates a novel artwork. He stands at the very border where future is celebrated whilst past is acknowledged and cherished. Hence, Mammodov’s magic carpets lie in a chasm between two dimensions of existence, which he crafted using fractal geometry, a universally compelling magic recipe.

generative system

01. The Concept

Carpetdiem is a generative interpretation of middle eastern carpet designs. The traditional carpets are woven meticulously by artisans and the underlying code tries to emulate these intricacies through simple yet sophisticated algorithms. At its core, the code uses fractals and recursion to generate unique designs on each execution of the code.

Each Carpetdiem generative art is a piece of code that is stored immutably on the Ethereum blockchain and IPFS, giving owners the ability to generate the artwork from the source without any dependency on third parties. Blockchain allows for the control of ownership of artworks. Additionally, with cryptography, we can generate unique identifiers or a “hash” to guarantee that each piece of art differs from the other. The blockchain holds all required information to generate the art from the given hash. Theoretically, any 3rd party is able to download the art script from the blockchain and re-generate the art script from the hash.

02. The Algorithm

The original inspiration for this algorithm came from Sierpiński Carpet, a mathematical formula that subdivides the shape of the equilateral squares, again and again, making smaller copies of itself. However, as the algorithm evolved, the fractal propagation was turned outwards rather than inwards. At its lowest level, each artwork is made from the same building block, henceforth known as the cell. Every carpet design is a combination of cells on a predefined grid. The cell has only a few properties — position on the grid, state of visibility(on or off), and color. Each fractal set begins as a single cell on the grid. After the first cell is drawn, the algorithm looks at the four adjacent positions on the grid. If they aren’t already occupied by other cells, new cells are drawn. This strategy of outward recursion opens up a myriad of possibilities. Firstly, more than one fractal can be used, each spawning at random positions on the canvas.

Additional complexity comes from the fractals existing in the same field and interacting with each other. In other words, each fractal knows of the existence of others. As their frontiers meet, intricate patterns emerge. Fractals also have spaces where they can propagate, which in this case was analogous to the middle eastern carpet structure with borders and the central field. The final piece of the puzzle is emergence. The beauty of fractals not only comes from the way they look but also from how they emerge from a single unassuming point. This quality is retained in how the code executes. Each stage in the fractal propagation is comprised of the 240-frame animation that runs at every code execution.

03. The Structure

As mentioned earlier, the core structure of the carpet comprises four parts namely — the field, main border, and outer and inner secondary borders. Each border width can vary randomly all the way from very thin to very thick. The central field occupies the remaining area. Some variations also remove the inner secondary border, which results in a unique look.

04. Spawn Positions and Density

The main border and the field occupy the most space in the design. Hence these are the areas where the spawn positions of the fractals are randomized. This manifests very differently in the border and the field. Let’s look at the difference closely.

Within the field, the idea is simple. A number of spawn points determine the density of the pattern. The higher the points, the higher the density. Each spawn position is also random. This results in a large set of possible outcomes.

In the case of the main border, things get a little complex. The corners have fixed spawn points. This ensures visible corner articulation and makes the art true to its traditional roots. The remaining points occupy a linear space between the corners. Similar to the field, the main border has a density parameter. This determines the number of spawn points between the corners. The border spawn points also get an offset property. This is expressed as the closeness to the outer edge or the central field, which can create vastly different outcomes based on the thickness of the main border. Finally, the border gets a uniformity parameter that dictates how ordered(i.e. linear) or chaotic the border pattern is.

05. Propagation

As the underlying algorithm of the artwork is a fractal, the duration for which it is allowed to propagate is another parameter that can be randomized on a per fractal basis. This greatly influences the complexity of the outputs. Longer propagation not only means higher density but also an increased possibility of fractals interacting. Each section has its own propagation value, which means the border can have higher propagation while the field has a lower value or vice versa.

06. Color and Visibility

As mentioned earlier, cells are the building blocks of the piece. Hence the colors and visibility apply directly to the cells. The algorithm picks from a curated set of 50 color palettes. The color application follows the fractal progression, in other words, a new color from the palette is applied at every progression.

Finally, the visibility parameter toggles the visibility of the cell. While the algorithm computes the cell internally, it does not draw it to the canvas. This adds another dimension to the composition with differences in contrast and complexity. The visibility parameter is applied similar to the color, i.e. on every progression. The parameter varies from full visibility, showing all the cells in the fractal to sparse visibility, showing only a few progressions.

This project is a culmination of months of research and work. The code is built on the free and open-source JavaScript library called p5.js, which is part of the Processing Foundation. This makes the artwork reside completely on the web without needing any additional frameworks, at the same time being extremely lightweight (mere kilobytes for the entire code base). This project wouldn’t have been possible without the support of the amazing generative art community, which is arguably the most inclusive and supportive online community out there. I hope the love and care that went into making this project happen, reflects in each and every piece.