-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpov3zaika.html
80 lines (80 loc) · 7.94 KB
/
pov3zaika.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
<!doctype html>
<html lang='en-US'>
<head>
<link rel='icon' type='image/x-icon' href='favicon.ico'>
<link rev='made' href='mailto:[email protected]'>
<link rel='canonical' href='https://dnyarri.github.io/pov3zaika.html'/>
<meta charset='utf-8' />
<meta name='author' content='Ilyich the Toad'>
<meta name='description' content='POVRay mosaic: triangle pack'>
<meta name='keywords' content='Python, POVRay, mosaic, pattern, painting'>
<link rel='stylesheet' href='toc.css' type='text/css'>
<link rel='stylesheet' href='content.css' type='text/css'>
<title>POVRay mosaic: 63zaika (6/3 Euclidean tiling)</title>
</head>
<body>
<div class='leftarea'> <!-- Nav holder begin -->
<object data='toc.html' class='leftbar'></object>
</div>
<div class='content'> <!-- Content block begin -->
<h1 class='darkbg'>POVRay mosaic: triangle/hexagon pattern, Regular plane partition 6<sup>3</sup></h1>
<h2 class='lightbg'>Converting 2D image into mosaic of 3D objects</h2>
<p class='lightbg justborder'><a href='povzaika.html'>POVRay mosaic</a> 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 <a href='https://www.povray.org/'>POV-Ray</a> format. You can <a href='https://github.com/Dnyarri/POVmosaic' class='git'>download POVRay mosaic from GitHub</a> and use it for free. <b>63Zaika</b> is a part of this package, covering 6<sup>3</sup> <a href='https://en.wikipedia.org/wiki/List_of_regular_polytopes#Euclidean_tilings'>Euclidean tiling</a>.</p>
<p class='lightbg justborder'><span class='red'><b>Update:</b></span> In version 1.11.1.1 texture syntax changed to fully blown texture, thus providing a capability to build layered textures.</p>
<div class='lightbg justborder cols512'>
<p>This whole story begun decades ago when I needed some way to simulate real world colored sphere packing. There are some ad and deco technologies, based on constructing big pictures from plastic balls, and I needed a quick preview for expected result.</p>
<div class='justborder center' style='break-inside: avoid;'><img src='3z/300.png' width='512'>
<p class='small center'>default output</p>
</div>
<p>Necessary program was created and successfully used. And forgotten, also successfully.</p>
<p>Until now.</p>
<p><b>63zaika</b> program is a part of POVMosaic project, intended for opening source PNG image, and creating <b>triangle</b>-packed mosaics of 3D objects in <a href='https://www.povray.org/'>POV-Ray</a> format, colored after source image pixels.</p>
<p>Most important features of the program are:</p>
<p><b>Configurable output.</b> Since POV files are text files, containing 3D scene description, they can be easily edited; 63zaika output is as human-friendly as possible, reasonably commented internally, and, besides, there is a help file with more prolific descriptions. You may easily switch 3D objects and their properties, except for color, which comes from the source image. Examples below will be added with short notation of change introduced between 63zaika output and rendering.</p>
<p>Any 63zaika output scene is already equipped with several predefined objects (below is an intersection of four cylinders coming along tetrahedron axes, with some rough pearl finish):</p>
<div class='justborder center' style='break-inside: avoid;'><img src='3z/302.png' width='512'>
<p class='small center pre'>thingie_7; thingie_finish_4; rotate_rnd = <60, 60, 60>;</p>
</div>
<p>plus you can add external objects to the scene;</p>
<p><b>Mapping.</b> It means you can map (make dependant of) some 3D object property to some source image pixel property. For example, on sample image below hexagonal prism (one of predefined objects) height is mapped to source brightness:</p>
<div class='justborder center' style='break-inside: avoid;'><img src='3z/301.png' width='512'>
<p class='small center pre'>thingie_4; #declare map = function(c) {abs((2.0 * c) - 1.0)}; scale_map = <0, 0, 1.5>;</p>
</div>
<p>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:</p>
<pre>
#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}</pre>
<p>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.</p>
<p>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.</p>
<p>Object texture, beside color and finish, include normal modifier, which can be modified independently of object itself:</p>
<div class='justborder center' style='break-inside: avoid;'><img src='3z/303.png' width='512'>
<p class='small center pre'>thingie_normal_4; normal_rotate_rnd = <0, 0, 180>;</p>
</div>
<p>And finally, whole bunch of settings may be redefined by inserting external .inc file:</p>
<div class='justborder center' style='break-inside: avoid;'><img src='3z/304.png' width='512'>
<p class='small center pre lightbg'>#include "63_icosa.inc"</p>
</div>
<p>"63_icosa.inc" is included in distribution and defines icosahedron. Sorry for a small preview, surely you'll find a use for icosahedron in something bigger. Icosahedra don't grow on trees, after all, they can't be left unused.</p>
<div class='justborder center' style='break-inside: avoid;'><img src='3z/306.png' width='512'>
<p class='small center pre lightbg'>thingie_5 conic_sweep</p>
</div>
<h3 style='column-span: all;'>External resources</h3>
<p>Do you know that there are priceless collections of jewels you can get for free?</p>
<p><a href='https://github.com/syanenko/povgems'>POV-Ray gems</a> contain several gem examples in POVRay .inc format.</p>
<div class='justborder center chess' style='column-span: all;'><img src='3z/305.png' width='1021'></div>
<p>Above is an example of importing one of geometry files into casual scene with some random rotation. Note that current version of POVRay mosaic does not produce <span class='pre'>interior</span> block per object to avoid complexity and complications, so I used very primitive <span class='pre'>interior</span> per whole union.</p>
<p><a href='https://github.com/syanenko/povgems'>POV-Ray gems</a>, besides geometry files, provide realistic interiors for real minerals. They even implemented light dispersion lookup tables based on actual data!</p>
</div>
<p class='lightbg justborder'>Assuming you scrolled that far, I remind you that you can <a href='https://github.com/Dnyarri/POVmosaic' class='git'>download POVRay mosaic from GitHub</a>.</p>
<br>
<p class='right'><span class='lightbg justborder'>...or Move back to <a href='https://dnyarri.github.io'>main page</a>.</span></p>
</div> <!-- Content block end -->
</body>
</html>