This is a script that generates random camouflage patterns.
It's mostly a toy, a product of my interest in military camouflage and joy of programming. It can emulate polygon-based (such as swedish M90 or german Splittermuster), blot-based (Flecktarn and the derivative danish M84) and modern "digital" camouflage (CADPAT, MARPAT) quite well.
It uses a binary space partitioning algorithm. It starts with an empty canvas which is broken 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.
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.
Things that could 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 a single script file. While this is hardly the best way to design a script, it was a fun exercise in PHP and makes distribution simple (though maybe not development). You are free to view the source.
This script was written by Ulf Åström (happyponyland.net). If you have any questions or make improvements to it, you can contact me, but please note that this project is unmaintained and I'm not really taking feature requests.
With love,
/Happy Pony Land
Note: This project is unmaintained and the design is obsolete (it should have been a client-side application all along). There are some features I would have liked to add (and some bugs that could be fixed), but after not having touched this in nearly 7 years I think it is safe to say I will never get around to it. You can play around with it, but I'm not really providing any support or taking feature requests.
What's this? Read the explanation.