happyponyland.net / Camouflage generator: About

What's this?

A script that generates random camouflage patterns.

It's a toy, a product of my interest in military camouflage and joy of programming.

It uses a binary space partitioning algorithm. It starts with an empty canvas which it breaks into smaller pieces (usually a three to five-sided polygon). Each polygon is then divided further, until a sufficient level of detail is reached (the polygon size parameter).

Each polygon is assigned a color. Color bleed determines how many polygons are painted with each "stroke". Low values (0) yields a very random color distribution while higher values form cohesive blobs.

Following this spots are added. These have randomized radii and placement. Spot sampling variation determines how far away the color is fetched - a low value will result only in fuzzy edges, while higher values introduce more noise.

The final step is pixelization which reduces the resolution and gives a "blocky" look. This also has a sampling variation parameter.

It can emulate polygon-based (such as swedish M90 or german Splittermuster) and modern "digital" camouflage quite well.

My main motivation was to study how BSP could be applied to arbitrary polygons. While I had written BSP algorithms before (for generating random levels in games), they were strictly grid-based and could only generate rectangles.

Writing this has given me a better understanding of geometry. I learned the PHP GD library and also picked up a bit of JavaScript.

Things that can be improved:

Some other thoughts:

The color picker is JSColor. It is an excellent, light-weight package.

Except for the color picker, everything is self-contained in the same script file. While this is hardly the best way to design a script, it was an exercise in PHP and makes distribution simple. You are free to view the source.

This script was written by Ulf Åström (happyponyland.net). If you have questions, find bugs or make improvements to it, you can contact me.

With love,
/Happy Pony Land