Skip to content

Commit

Permalink
1.11.1.1 Layered texture
Browse files Browse the repository at this point in the history
  • Loading branch information
Dnyarri committed Nov 1, 2024
1 parent a39a3e2 commit fecc533
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 53 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
__pycache__
development/
old/
temp/
Expand Down
28 changes: 7 additions & 21 deletions 36zaika.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
1.9.1.0 Reworked normals, added triangle tile normal.
1.9.16.2 Added global transform, changed randoms in normal and move from + to +/-,
changed globals in export to UTF-8, added gamma note etc.
1.10.29.1 Per thingie texture overlay.
1.11.1.1 Per thingie texture overlay.
-------------------
Main site:
Expand All @@ -36,7 +36,7 @@
__copyright__ = '(c) 2007-2024 Ilya Razmanov'
__credits__ = 'Ilya Razmanov'
__license__ = 'unlicense'
__version__ = '1.10.29.1'
__version__ = '1.11.1.1'
__maintainer__ = 'Ilya Razmanov'
__email__ = '[email protected]'
__status__ = 'Production'
Expand Down Expand Up @@ -130,13 +130,6 @@ def src_lum(x, y): # {#884400, 19}
'''

cx = int(x)
cy = int(y)
cx = max(0, cx)
cx = min((X - 1), cx)
cy = max(0, cy)
cy = min((Y - 1), cy)

if info['planes'] < 3: # supposedly L and LA
yntensity = src(x, y, 0)
else: # supposedly RGB and RGBA
Expand All @@ -156,10 +149,6 @@ def src_lum_blin(x, y): # {#884400, 25}

fx = float(x)
fy = float(y) # Uses float input coordinates for interpolation
fx = max(0, fx)
fx = min((X - 1), fx)
fy = max(0, fy)
fy = min((Y - 1), fy)

# Neighbor pixels coordinates (square corners x0,y0; x1,y0; x0,y1; x1,y1)
x0 = int(x)
Expand Down Expand Up @@ -188,16 +177,13 @@ def src_lum_blin(x, y): # {#884400, 25}
'Persistence of Vision Ray Tracer Scene Description File\n',
'Version: 3.7\n',
'Description: Mosaic picture consisting from solid spheres, triangle packing, Regular plane partition 3/6.\n',
'Author: Automatically generated by 3zaika program, based on AmphiSoft POV Sphere Mosaic plug-in, see POVRay Mosaic project at\n',
'Author: Automatically generated by 36zaika program, based on AmphiSoft POV Sphere Mosaic plug-in, see POVRay Mosaic project at\n',
'https://github.com/Dnyarri/POVmosaic\n',
'https://gitflic.ru/project/dnyarri/povmosaic\n\n',
'developed by Ilya Razmanov aka Ilyich the Toad\n',
'https://dnyarri.github.io\n',
'mailto:[email protected]\n\n',
f'Generated by: {__file__} ver: {__version__} at: {localtime}\n'
f'Converted from: {sourcefilename}\n'
f'Source info: {info}\n'
'*/\n\n',
f'Generated by: {__file__} ver: {__version__} at: {localtime}\n' f'Converted from: {sourcefilename}\n' f'Source info: {info}\n' '*/\n\n',
]
)

Expand Down Expand Up @@ -245,9 +231,9 @@ def src_lum_blin(x, y): # {#884400, 25}
'#declare thingie_normal_3 = normal{bumps 0.05 scale<1.0, 0.05, 0.5>}\n',
'#declare thingie_normal_4 = normal{spiral1 8 0.5 scallop_wave}\n',
'#declare thingie_normal_5 = normal{tiling 3 scale <0.5, 5, 0.5> rotate <90, 0, 0>}\n',
'\n// Global modifiers for all thingies in the scene\n',
'\n/* ----------------------------------------------------\n | Global modifiers for all thingies in the scene |\n ---------------------------------------------------- */\n\n',
'#declare thingie_texture_2 = texture { // Define transparent texture overlay here\n',
' pigment {gradient z colour_map {[0.0, rgbt <0,0,0,1>] [1.0, rgbt <0,0,0,1>]} scale 0.1 rotate <30, 30, 0>}};\n', # Transparent texture overlay
' pigment {gradient z colour_map {[0.0, rgbt <0,0,0,1>] [1.0, rgbt <0,0,0,1>]} scale 0.1 rotate <30, 30, 0>}};\n\n', # Transparent texture overlay
'#declare yes_color = 1; // Whether source per-thingie color is taken or global patten applied\n',
'// Color-relater settings below work only for "yes_color = 1;"\n',
'#declare cm = function(k) {k} // Color transfer function for all channels, all thingies\n',
Expand Down Expand Up @@ -285,7 +271,7 @@ def src_lum_blin(x, y): # {#884400, 25}
'#declare thething_transform = transform {\n // You can place your global scale, rotate etc. here\n}\n',
'\n// Seed random\n',
f'#declare rnd_1 = seed({int(seconds * 1000000)});\n\n',
'background{color rgbft <0, 0, 0, 1, 1>} // Hey, I''m just trying to be explicit in here!\n\n',
'background{color rgbft <0, 0, 0, 1, 1>} // Hey, I' 'm just trying to be explicit in here!\n\n',
# Camera {#ff0000, 0}
'\n/*\n Camera and light\n\n',
'NOTE: Coordinate system match Photoshop,\norigin is top left, z points to the viewer.\nsky vector is important!\n\n*/\n\n',
Expand Down
21 changes: 7 additions & 14 deletions 44zaika.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
1.9.1.0 Reworked normals.
1.9.16.2 Added global transform, changed randoms in normal and move from + to +/-,
changed globals in export to UTF-8, added gamma note etc.
1.10.29.1 Per thingie texture overlay.
1.11.1.1 Per thingie texture overlay.
-------------------
Main site:
Expand All @@ -41,7 +41,7 @@
__copyright__ = '(c) 2007-2024 Ilya Razmanov'
__credits__ = 'Ilya Razmanov'
__license__ = 'unlicense'
__version__ = '1.10.29.1'
__version__ = '1.11.1.1'
__maintainer__ = 'Ilya Razmanov'
__email__ = '[email protected]'
__status__ = 'Production'
Expand Down Expand Up @@ -135,13 +135,6 @@ def src_lum(x, y): # {#884400, 19}
'''

cx = int(x)
cy = int(y) # nearest neighbor for float input
cx = max(0, cx)
cx = min((X - 1), cx)
cy = max(0, cy)
cy = min((Y - 1), cy)

if info['planes'] < 3: # supposedly L and LA
yntensity = src(x, y, 0)
else: # supposedly RGB and RGBA
Expand All @@ -165,7 +158,7 @@ def src_lum(x, y): # {#884400, 19}
'Description: Mosaic picture consisting from solid boxes, square packing, Regular plane partition 4/4.\n',
' Other included objects are cylinders, spheres, etc.\n',
' see list "#declare thingie_1=" and below.\n',
'Author: Automatically generated by 4zaika program, based on AmphiSoft POV Sphere Mosaic plug-in, see POVRay Mosaic project at\n',
'Author: Automatically generated by 44zaika program, based on AmphiSoft POV Sphere Mosaic plug-in, see POVRay Mosaic project at\n',
'https://github.com/Dnyarri/POVmosaic\n',
'https://gitflic.ru/project/dnyarri/povmosaic\n\n',
'developed by Ilya Razmanov aka Ilyich the Toad\n',
Expand Down Expand Up @@ -227,15 +220,15 @@ def src_lum(x, y): # {#884400, 19}
'#declare thingie_normal_4 = normal{spiral1 8 0.5 scallop_wave}\n',
'#declare counts = 8; #declare thingie_normal_5 = normal{function{mod(abs(cos(counts*x)+cos(-counts*y)+cos(counts*z)), 1)}}\n',
'#declare thingie_normal_6 = normal{function{mod(8*sqrt(pow(x,2)+pow(y,2)+pow(z,2)), 1.0)}}\n',
'\n// Global modifiers for all thingies in the scene\n',
'\n/* ----------------------------------------------------\n | Global modifiers for all thingies in the scene |\n ---------------------------------------------------- */\n\n',
'#declare thingie_texture_2 = texture { // Define transparent texture overlay here\n',
' pigment {gradient z colour_map {[0.0, rgbt <0,0,0,1>] [1.0, rgbt <0,0,0,1>]} scale 0.1 rotate <30, 30, 0>}};\n', # Transparent texture overlay
' pigment {gradient z colour_map {[0.0, rgbt <0,0,0,1>] [1.0, rgbt <0,0,0,1>]} scale 0.1 rotate <30, 30, 0>}};\n\n', # Transparent texture overlay
'#declare yes_color = 1; // Whether source per-thingie color is taken or global patten applied\n',
'// Color-relater settings below work only for "yes_color = 1;"\n',
'#declare cm = function(k) {k} // Color transfer function for all channels, all thingies\n',
'#declare f_val = 0.0; // Filter value for all thingies\n',
'#declare t_val = 0.0; // Transmit value for all thingies\n',
'#declare evenodd_rotate = <0.0, 0.0, 0.0>; // Odd lines rotate, rarely useful\n',
'\n#declare evenodd_rotate = <0.0, 0.0, 0.0>; // Odd lines rotate, rarely useful\n',
'#declare evenodd_offset = <0.5, 0, 0>; // Even lines shift for brick wall\n',
'#declare evenodd_offset = <0.0, 0, 0>; // Default 0 even lines shift for no brick wall\n',
'#declare scale_all = <1, 1, 1>; // Base scale of all thingies. 1=original\n',
Expand Down Expand Up @@ -272,7 +265,7 @@ def src_lum(x, y): # {#884400, 19}
'#declare thething_transform = transform {\n // You can place your global scale, rotate etc. here\n}\n',
'\n// Seed random\n',
f'#declare rnd_1 = seed({int(seconds * 1000000)});\n\n',
'background{color rgbft <0, 0, 0, 1, 1>} // Hey, I''m just trying to be explicit in here!\n\n',
'background{color rgbft <0, 0, 0, 1, 1>} // Hey, I' 'm just trying to be explicit in here!\n\n',
# Camera {#ff0000, 0}
'\n/*\n Camera and light\n\n',
'NOTE: Coordinate system match Photoshop,\norigin is top left, z points to the viewer.\nsky vector is important!\n\n*/\n\n',
Expand Down
25 changes: 7 additions & 18 deletions 63zaika.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
1.9.1.0 Reworked normals.
1.9.16.2 Added global transform, changed randoms in normal and move from + to +/-,
changed globals in export to UTF-8, added gamma note etc.
1.10.29.1 Per thingie texture overlay.
1.11.1.1 Per thingie texture overlay.
-------------------
Main site:
Expand All @@ -44,7 +44,7 @@
__copyright__ = '(c) 2007-2024 Ilya Razmanov'
__credits__ = 'Ilya Razmanov'
__license__ = 'unlicense'
__version__ = '1.10.29.1'
__version__ = '1.11.1.1'
__maintainer__ = 'Ilya Razmanov'
__email__ = '[email protected]'
__status__ = 'Production'
Expand Down Expand Up @@ -138,13 +138,6 @@ def src_lum(x, y): # {#884400, 19}
'''

cx = int(x)
cy = int(y) # nearest neighbor for float input
cx = max(0, cx)
cx = min((X - 1), cx)
cy = max(0, cy)
cy = min((Y - 1), cy)

if info['planes'] < 3: # supposedly L and LA
yntensity = src(x, y, 0)
else: # supposedly RGB and RGBA
Expand All @@ -164,10 +157,6 @@ def src_lum_blin(x, y): # {#884400, 25}

fx = float(x)
fy = float(y) # Uses float input coordinates for interpolation
fx = max(0, fx)
fx = min((X - 1), fx)
fy = max(0, fy)
fy = min((Y - 1), fy)

# Neighbor pixels coordinates (square corners x0,y0; x1,y0; x0,y1; x1,y1)
x0 = int(x)
Expand Down Expand Up @@ -198,7 +187,7 @@ def src_lum_blin(x, y): # {#884400, 25}
'Description: Mosaic picture consisting from solid spheres, triangle packing, Regular plane partition 6/3.\n',
' Other included objects are hexagonal prisms (honeycomb packing), cylinders,\n',
' etc., see list "#declare thingie_1=" below.\n',
'Author: Automatically generated by 3zaika program, based on AmphiSoft POV Sphere Mosaic plug-in, see POVRay Mosaic project at\n',
'Author: Automatically generated by 63zaika program, based on AmphiSoft POV Sphere Mosaic plug-in, see POVRay Mosaic project at\n',
'https://github.com/Dnyarri/POVmosaic\n',
'https://gitflic.ru/project/dnyarri/povmosaic\n\n',
'developed by Ilya Razmanov aka Ilyich the Toad\n',
Expand Down Expand Up @@ -263,15 +252,15 @@ def src_lum_blin(x, y): # {#884400, 25}
'#declare thingie_normal_4 = normal{spiral1 8 0.5 scallop_wave}\n',
'#declare counts = 8; #declare thingie_normal_5 = normal{function{mod(abs(cos(counts*x)+cos(-counts*y)+cos(counts*z)), 1)}} // Typically counts 4-16 is acceptable\n',
'#declare thingie_normal_6 = normal{function{64*abs(x*y*z)}}\n',
'\n// Global modifiers for all thingies in the scene\n',
'\n/* ----------------------------------------------------\n | Global modifiers for all thingies in the scene |\n ---------------------------------------------------- */\n\n',
'#declare thingie_texture_2 = texture { // Define transparent texture overlay here\n',
' pigment {gradient z colour_map {[0.0, rgbt <0,0,0,1>] [1.0, rgbt <0,0,0,1>]} scale 0.1 rotate <30, 30, 0>}};\n', # Transparent texture overlay
' pigment {gradient z colour_map {[0.0, rgbt <0,0,0,1>] [1.0, rgbt <0,0,0,1>]} scale 0.1 rotate <30, 30, 0>}};\n\n', # Transparent texture overlay
'#declare yes_color = 1; // Whether source per-thingie color is taken or global patten applied\n',
'// Color-relater settings below work only for "yes_color = 1;"\n',
'#declare cm = function(k) {k} // Color transfer function for all channels, all thingies\n',
'#declare f_val = 0.0; // Filter value for all thingies\n',
'#declare t_val = 0.0; // Transmit value for all thingies\n',
'#declare evenodd_transform = transform {rotate <0.0, 0.0, 0.0>} // Odd lines rotate, rarely useful\n',
'\n#declare evenodd_transform = transform {rotate <0.0, 0.0, 0.0>} // Odd lines rotate, rarely useful\n',
'\n/* Map function\nMaps are transfer functions control value (i.e. source pixel brightness) is passed through.\n',
'By default exported map is five points linear spline, control points are set in the table below,\n',
'first column is input, first digits in second column is output for this input.\n',
Expand Down Expand Up @@ -304,7 +293,7 @@ def src_lum_blin(x, y): # {#884400, 25}
'#declare thething_transform = transform {\n // You can place your global scale, rotate etc. here\n}\n',
'\n// Seed random\n',
f'#declare rnd_1 = seed({int(seconds * 1000000)});\n\n',
'background{color rgbft <0, 0, 0, 1, 1>} // Hey, I''m just trying to be explicit in here!\n\n',
'background{color rgbft <0, 0, 0, 1, 1>} // Hey, I' 'm just trying to be explicit in here!\n\n',
# Camera {#ff0000, 0}
'\n/*\n Camera and light\n\n',
'NOTE: Coordinate system match Photoshop,\norigin is top left, z points to the viewer.\nsky vector is important!\n\n*/\n\n',
Expand Down
1 change: 1 addition & 0 deletions help.html
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ <h2>Predefined objects, properties and modifiers thereof</h2>
<p><span class='pre strong'>#declare thingie_finish_<span class='em'>n</span> =</span> Defines thingie finish. Default one is smooth plastic, but you can use anything else. Surely, using POVRay include files is also possible.</p>
<p><span class='pre strong'>#declare thingie_normal_<span class='em'>n</span> =</span> Defines thingie surface normal modifier. Default one have zero intensity to simplify the picture appearance. Remember that normal may be rotated and moved on a per thingie basis later (see <span class='pre'>normal_move_rnd</span> and <span class='pre'>normal_rotate_rnd</span> below), so any "elongated" patterns will be giving interesting results.</p>
<h2>Global modifiers for all thingies in the scene</h2>
<p><span class='pre strong'>#declare thingie_texture_2 = texture{}</span> Defines texture overlay <span class='pre'>thingie_texture_2</span>, applied above generated texture of each thingie, thus giving the capability to build layered textures. Default exported example overlay is completely transparent and therefore invisible gradient, just edit one of its control points to opaque to get a feeling of what it's all about.</p>
<p><span class='pre strong'>#declare yes_color = 1;</span> Switch defining whether source per-thingie color is taken or global texture applied. Default is 1, i.e. colored mosaic; 0 gives solid <i>thething</i> texture which, in combination with <span class='pre'>scale_map</span>, may give interesting pseudo-heightfield effects.</p>
<p><span class='pre strong'>#declare cm = function(k) {k}</span> Color modifier. Transfer function(k), by default output = input, changing it to something like <i>{k+0.1}</i> or <i>{0.9*k}</i> may be useful for a quick fix of poor color scene.</p>
<p><span class='pre strong'>#declare f_value =</span> Input: float number. All thingies colors are specified as <span class='em'>rgbft</span> (red, green, blue, filter, transmit); while <span class='em'>rgb</span> is set according to source image pixel color, filter component value is set to <span class='pre'>f_value</span> globally. Default is 0.0 (completely opaque), you may change it to turn <i>thething</i> into glass.</p>
Expand Down

0 comments on commit fecc533

Please sign in to comment.