POVRay mosaic: square pattern, Regular plane partition 44

Converting 2D image into mosaic of 3D objects

POVRay mosaic is a set of programs, which read every pixel of source image and convert it into a virtual 3D object, packed side by side with objects created from other pixels, thus creating something like 3D-mosaic in POVRay format. You can download POVRay mosaic from GitHub and use it for free. 44Zaika is a part of this package, covering 44 Euclidean tiling.

44zaika is a small program, opening a PNG image, and converting it into a mosaic of 3D objects, packed in square pack. Each source pixel is turned into a 3D cube, colored like this pixel. Surely, instead of cubes, other 3D shapes may be used; at the moment of writing 44zaika provides seven prebuilt object types, and new ones may be easily inserted.

Since POV files are text files, containing 3D scene description, they can be easily edited; 44zaika output is as human-friendly as possible, reasonably commented internally, and, besides, there is a help file with more prolific descriptions. Next to the examples below there are short descriptions of changes introduced into scene file before rendering.

thingie = thingie_4

The main idea behind 44zaika is mapping. Object properties (size, position, rotation) can be mapped to (that is, made functions of) source image pixel properties, currently brightness. Ok, let's map something:

thingie = thingie_3 scale_all = <1, 1, 5>; scale_map = <1, 1, 0>;

Not too bad for a simple example, may even go for a logo.

Since version 1.6.21, all predefined maps were replaced by generalized linear spline interpolation. Descriptive part in the beginning of POV file generated look like this:

    #declare Curve = function {
        spline { linear_spline
            0.0,   <0.0,   0>
            0.25,  <0.25,  0>
            0.5,   <0.5,   0>
            0.75,  <0.75,  0>
            1.0,   <1.0,   0>}
        }
    #declare map = function(c) {Curve(c).u}

This map is direct analog of Photoshop and GIMP "Curves", so general idea should be familiar: first column contain input values, second column contain corresponding output values (third column currently is not used for anything good, just leave it alone). By default, input=output, that is, map does not change anything. However, you can edit it.

Note that POVRay does not pay attention to the order of control points appearance, so you can add midpoints after endpoints in no particular order. Just remember to have endpoints 0 and 1 defined, since POVRay cannot use undefined functions; everything between 0 and 1 is up to you to edit.

Beside scaling, we can also map rotation and position:

thingie_5 move_map = <0, 0, -2>; rotate_map = <60, 60, 180>; and rotate_all = <-10, -20, -20>; for baseline

In general, I'd suggest gradually changing setting one by one, unless you are not afraid of total mess. And you will be. You will be.

Let's look at mapping capabilities more closely, to see why I call it "vast potential":

thingie_3 thingie_finish_3 scale_all = <0.6, 0.6, 2>; rotate_map = <160, 120, 0>;

Well, not quite a painting, but may be considered art. After all, painter is mapping brushstrokes direction to image sigmal, and we are mapping virtual cylinders rotation, what's the difference?

Note, in the scene above I edited camera to look_at<0.005, 0.025, 0.0> to keep it centered since growing cylinders went off margins.

Let's make it bolder:

thingie_3 thingie_finish_4 scale_all = <1.5, 1.5, 2.5>; rotate_map = <160, 120, 0>;

Superellipsoids also make nice 3D-brush strokes.

One of the funny things about POVMosaic programs is, beside editing resulting files directly, you can plug a preset file in them, redefining everything. Preset files are regular POVRay .inc files and must be plugged after standard objects to overwrite them.

#include "44_puzzle.inc"

Above is a result of changing just one string to #include "44_puzzle.inc" in POV file. It imports additional small POV file and plugs in whole new CSG object, corresponding to puzzle element, and its positioning. Yes, what you see above is not some simple bitmap tile - it's a whole lot of 3D objects, with easily editable geometry, perfectly aligned to form a puzzle-like picture.

Below is result of adding just one string #include "44_dice.inc" (44_dice.inc is included into project distribution, so you can investigate how it works. You a supposed to be laughing once you understand the rotation trick. At least I was, albeit I invented it):

#include "44_puzzle.inc"

Assuming you scrolled that far, I remind you that you can download POVRay mosaic from GitHub.


...or Move back to main page.