top of page

Camouflage Algorithm

To provide an adequate camouflage design for every environment in the world, a Russian pattern was emulated. This design, known as единая маскировочная расцветка (edinaya maskirovochnaya rascvetka) or EMR, which translates roughly as Universal Camouflage Pattern, has a superflous, nondirectional form which the eye naturally integrates into many background textures.

The appearance of fading edges paired with hard edges, crucial to the most advanced camouflage patterns such as Multicam, Pencott, CADpat, and many others, is accomplished here by overlapping the areas of several colors of squares with disseminating concentrations. Printed at a small scale, as EMR is in real life (each square roughly 3mm by 3mm), the human eye has trouble detecting the form covered by the camouflage, as the randomized fades and contrasts blend into many natural textures of the real world. The important aspect, as put by Lt. Col O'Neill of the US Army, is that "the patterns of squares (or whatever shape we use) is employed to model the texture of typical backgrounds using a mathematical function. We could use hexagons or shapeless blobs as well, except that it is easier to render complex patterns by computer using squares."

 

The official digital screens produced by the Russian government are off-limits, so a randomized algorithm was created from scratch.

The algorithm is a multi-step process to generate a square 2-dimensional arraylist of integers 0, 1, 2, or 3. Each is indicative of, respectively, the base, primary, secondary, and tertiary color. The user determines sidelength in squares.

 

Imagine the formation of a pearl: an initial grain of sand gathers minerals to form a pearl.

 

This 2D arraylist begins as all 0s, and a simple process generates random "grains of sand" all across the 2D matrix. This guarantees the lack of macro-directionality (larger areas of color trending horizontally or vertically), true to real EMR. 

       Emulation matrix after initial generation of all layers        

Each layer then goes through expansions. 

 

The "grains of sand" of the primary layer grow near-circular "pearls." Each "pearl" has an individually randomly-selected radius.

Each square in these "pearls" has a chance of becoming the layer in question. This chance varies per layer. The primary layer has a 3/8 chance, leading to semi-definite regions of the primary layer. These regions are transitioned into the rest of the pattern using "tidbit" generation: a very few random squares within a wide range of the "grain of sand" are set to that layer color.

 

The primary color (light green) is generated using both "pearl" and "tidbit" generation, the secondary color (brown) is generated using purely "tidbit" generation, and the tertiary color (black) is generated using purely "pearl" generation. 

Still with me? It's been a long read so far, but there isn't much left until you understand the whole process!

 

The shape of the "tidbit" potential color locations, shown above in brown, is so bizarre for a few reasons. The job of "tidbit" generation is to break up spaces of solid color, hence the large areas of potential color locations. However, these "tidbits" in real EMR feature micro-directionality. That means a vertical or horizontal trend among just a few squares, which greatly enhance the pattern's blending capabilities: nearly every surface will reflect light in mixtures of tiny lines and tiny blobs to the human eye. This micro-directionality is crucial to extremely successful modern patterns such as Pencott, and has for decades been present in effective designs such as British DPM and German Splittermuster. Project Chameleon generates limited randomized micro-directionality. 

Once the 2D matrix of 0s, 1s, 2s and 3s is generated, it is interpreted into squares and the full pattern is created as a .gif image. The user determines the sidelength of each square in pixels, and selects which pre-loaded set of RGB values will color the design. For this page and example, the set of colors used by Project Chameleon was taken from photographs of EMR in pre-2013 summer colors.

That is how the randomized digital camouflage similar to Russian EMR is produced by Project Chameleon. 

 

Every execution of Project Chameleon's code is random and independant from the last. It would take an extraordinary amount of time to produce 2 identical results. The Mersenne Twister algorithm used by Python's builtin random class has a period of repetition, meaning how long it will create pseudo-random results before repeating itself, of ((2^19937) − 1). This is applied n^2 times in Project Chameleon's initial generation, where n is the sidelength in squares of the pattern being produced. The later expansions apply the random another n^2 times (on average, that is--not every square is reconsidered but many squares are reconsidered multiple times). The period of repetition of Project Chameleon is, on average, (n^4)*((2^19937) − 1) executions. Thus, if a user is dissatisfied with the pattern produced by one execution, they have but to run the program again for a different camouflage pattern.

bottom of page