Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
Release
  • Loading branch information
Dnyarri committed Jul 22, 2024
2 parents 51e4f31 + b6f0628 commit 068ece9
Show file tree
Hide file tree
Showing 14 changed files with 665 additions and 70 deletions.
377 changes: 377 additions & 0 deletions 36zaika.py

Large diffs are not rendered by default.

63 changes: 38 additions & 25 deletions 4zaika.py → 44zaika.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@
0.0.0.1 Complete rewriting to more flexible project - 21 May 2024.
0.0.0.12 4zaika ready to release - 10 June 2024.
1.6.12.12 First Production release - 12 June 2024.
1.7.16.11 Global color modifier changed to transfer function.
1.7.16.17 Coordinate system match Photoshop, origin is top left, z points to the viewer.
Camera improved. Global color modifier changed to transfer function. Scaling changed from subtractive to additive, be careful with old presets if they include scaling!
1.7.17.1 Global/individual texture switch added for pseudo-heightmap effects.
1.7.18.21 Renamed to 44zaika to reflect regular plane partition class 4/4.
Project mirrors:
https://github.com/Dnyarri/POVmosaic
Expand All @@ -30,7 +33,7 @@
__copyright__ = "(c) 2007-2024 Ilya Razmanov"
__credits__ = "Ilya Razmanov"
__license__ = "unlicense"
__version__ = "1.7.16.11"
__version__ = "1.7.19.8"
__maintainer__ = "Ilya Razmanov"
__email__ = "[email protected]"
__status__ = "Production"
Expand All @@ -46,8 +49,8 @@
# Creating dialog

sortir = Tk()
sortir.title('POVRay Mosaic: 4Zaika')
sortir.geometry('+128+64')
sortir.title('POVRay Mosaic: 44Zaika')
sortir.geometry('+64+128')
sortir.overrideredirect(True)
progressbar = Progressbar(sortir, orient='horizontal', mode='determinate', value=0, maximum=100, length=500)
progressbar.pack(fill=BOTH, expand=True)
Expand Down Expand Up @@ -145,7 +148,7 @@ def srcY(x, y):
'/*\n',
'Persistence of Vision Ray Tracer Scene Description File\n',
'Version: 3.7\n',
'Description: Mosaic picture consisting from solid boxes, square packing.\n',
'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',
Expand Down Expand Up @@ -203,6 +206,8 @@ def srcY(x, y):
'#declare thingie_normal_3 = normal{bumps 0.05 scale<1.0, 0.05, 0.5>}\n',
'#declare thingie_normal_4 = normal{spiral1 16 0.5 scallop_wave rotate y*90}\n',
'\n// Global modifiers for all thingies in the scene\n',
'#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',
Expand All @@ -225,8 +230,8 @@ def srcY(x, y):
'#declare thingie_finish = thingie_finish_1\n',
'#declare thingie_normal = thingie_normal_1\n',
'\n// Per-thingie modifiers\n',
'#declare move_map = <0, 0, 0>; // To move thingies depending on map. No constrains on values\n',
'#declare scale_map = <0, 0, 0>; // To rescale thingies depending on map. Expected values 0..1\n',
f'#declare move_map = <0, 0, 0>; // To move thingies depending on map. Additive, no constrains on values. Source image size is {max(X, Y)}\n',
'#declare scale_map = <0, 0, 0>; // To rescale thingies depending on map. Additive, no constrains on values except object overlap on x,y\n',
'#declare rotate_map = <0, 0, 0>; // To rotate thingies depending on map. Values in degrees\n',
'#declare move_rnd = <0, 0, 0>; // To move thingies randomly. No constrains on values\n',
'#declare rotate_rnd = <0, 0, 0>; // To rotate thingies randomly. Values in degrees\n',
Expand All @@ -235,25 +240,27 @@ def srcY(x, y):
'#declare normal_rotate_rnd = <0, 0, 0>; // Random rotate of finish. Values in degrees\n',
'\n// Seed random\n',
f'#declare rnd_1 = seed({int(seconds * 1000000)});\n\n',
'background{color rgbft <0, 0, 0, 1, 1>} // Sometimes need to be redefined\n\n\n',
'\n// -<*<* Insert preset to override setting above *>*>-\n',
'// #include "preset_01.inc" // Set path and name of your file related to scene file\n\n',
# Starting scene content
# Camera
'\n// # # # # # SCENE SECTION # # # # #\n\n',
'#declare camera_height = 3.0; // Camera height over object, used for view angle\n\n',
'\n/*\n\n# # # # # SCENE SECTION # # # # #\n\n',
'NOTE: Coordinate system match Photoshop,\norigin is top left, z points to the viewer.\nsky vector is important!\n\n*/\n\n',
'#declare camera_position = <0.0, 0.0, 3.0>; // Camera position over object, used for view angle\n\n',
'camera{\n',
' // orthographic\n',
' location<0.0, 0.0, camera_height>\n',
' location camera_position\n',
' right x*image_width/image_height\n',
' up y\n',
' direction <0, 0, 1>\n',
f' angle 2.0*(degrees(atan2({0.5 * max(X,Y)/X}, camera_height-({1.0/max(X,Y)})))) // Supposed to fit object\n',
' sky <0, -1, 0>\n',
f' direction <0, 0, vlength(camera_position - <0.0, 0.0, {1.0/max(X, Y)}>)> // May alone work for many pictures. Otherwise fiddle with angle below\n',
f' angle 2.0*(degrees(atan2({0.5 * max(X, Y)/X}, vlength(camera_position - <0.0, 0.0, {1.0/max(X, Y)}>)))) // Supposed to fit object, unless thingies are too high\n',
' look_at<0.0, 0.0, 0.0>\n',
'}\n\n',
# Light
'light_source{0*x\n color rgb<1.1, 1.0, 1.0>\n translate<4, 2, 3>\n}\n\n',
'light_source{0*x\n color rgb<0.9, 1.0, 1.0>\n translate<-2, 6, 7>\n}\n\n',
'background{color rgbft<0, 0, 0, 1, 1>}\n\n',
'light_source{0*x\n color rgb<1.1, 1.0, 1.0>\n translate<4, -2, 3>\n}\n\n',
'light_source{0*x\n color rgb<0.9, 1.0, 1.0>\n translate<-2, -6, 7>\n}\n\n',
# Main object
'\n// Object thething made out of thingies\n',
'#declare thething = union{\n', # Opening big thething
Expand Down Expand Up @@ -305,16 +312,18 @@ def srcY(x, y):
# Opening object "thingie" to draw
resultfile.writelines([
' object{thingie\n',
f' pigment{{rgbft<cm({r}), cm({g}), cm({b}), f_val, t_val>}}\n',
' finish{thingie_finish}\n',
' normal{thingie_normal translate(normal_move_rnd * <rand(rnd_1), rand(rnd_1), rand(rnd_1)>) rotate(normal_rotate_rnd * <rand(rnd_1), rand(rnd_1), rand(rnd_1)>)}\n',
f' scale(scale_all - (scale_map * <map({c}), map({c}), map({c})>))\n',
' #if (yes_color)\n',
f' pigment{{rgbft<cm({r}), cm({g}), cm({b}), f_val, t_val>}}\n',
' finish{thingie_finish}\n',
' normal{thingie_normal translate(normal_move_rnd * <rand(rnd_1), rand(rnd_1), rand(rnd_1)>) rotate(normal_rotate_rnd * <rand(rnd_1), rand(rnd_1), rand(rnd_1)>)}\n',
' #end\n',
f' scale(scale_all + (scale_map * <map({c}), map({c}), map({c})>))\n',
f' {even_odd_string_rot}\n',
f' rotate((rotate_map * <map({c}), map({c}), map({c})>) + rotate_all)\n',
f' rotate(rotate_rnd * <rand(rnd_1), rand(rnd_1), rand(rnd_1)>)\n',
f' {even_odd_string_trn}\n',
f' translate(move_map * <map({c}), map({c}), map({c})>)\n',
f' translate(move_rnd * <rand(rnd_1), rand(rnd_1), rand(rnd_1)>)\n',
' translate(move_rnd * <rand(rnd_1), rand(rnd_1), rand(rnd_1)>)\n',
f' translate<{x}, {y}, 0>\n',
' }\n'
# Finished thingie
Expand All @@ -323,12 +332,16 @@ def srcY(x, y):
# Transform object to fit 1, 1, 1 cube at 0, 0, 0 coordinates
resultfile.writelines([
'\n // Object transforms to fit 1, 1, 1 cube at 0, 0, 0 coordinates\n',
f' translate <0.5, 0.5, 0> + <{-0.5*X}, {-0.5*Y}, 0>\n', # centering at scene zero
f' scale<{-1.0/max(X, Y)}, {-1.0/max(X, Y)}, {1.0/max(X, Y)}>\n', # fitting and mirroring
f' translate <0.5, 0.5, 0> + <{-0.5*X}, {-0.5*Y}, 0>\n', # centering at scene zero
f' scale<{1.0/max(X, Y)}, {1.0/max(X, Y)}, {1.0/max(X, Y)}>\n', # fitting
'} // thething closed\n\n'
'\nobject {thething\n'
f'// interior {{ior 2.0 fade_power 1.5 fade_distance 1.0*{1.0/max(X, Y)} fade_color<0.95, 0.95, 0.95>}}\n',
'}\n',
'\nobject {thething\n' # inserting thething
' #if (yes_color < 1)\n',
' pigment {color rgb<0.5, 0.5, 0.5>}\n',
' finish {thingie_finish}\n',
' #end\n',
f' interior {{ior 2.0 fade_power 1.5 fade_distance 1.0*{1.0/max(X, Y)} fade_color <0.0, 0.5, 1.0>}}\n',
'}\n', # insertion complete
'\n/*\n\nhappy rendering\n\n 0~0\n (---)\n(.>|<.)\n-------\n\n*/'
])
# Closed scene
Expand Down
73 changes: 43 additions & 30 deletions 3zaika.py → 63zaika.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env python3

'''
POV Mosaic, Triangle packing
POV Mosaic, Triangle packing, Regular plane partition 6/3
Created by: Ilya Razmanov (mailto:[email protected])
aka Ilyich the Toad (mailto:[email protected])
Expand All @@ -19,7 +19,10 @@
0.0.0.12 3zaika ready to release - 10 June 2024.
1.6.12.12 First Production release - 12 June 2024.
1.7.9.10 Bilinear interpolation added to map. Not used for coloring since results are too smooth.
1.7.16.11 Global color modifier changed to transfer function.
1.7.16.17 Coordinate system match Photoshop, origin is top left, z points to the viewer.
Camera improved. Global color modifier changed to transfer function. Scaling changed from subtractive to additive, be careful with old presets if they include scaling!
1.7.17.1 Global/individual texture switch added for pseudo-heightmap effects.
1.7.21.21 Renamed to 63zaika to reflect regular plane partition class 6/3. Prisms changed.
Project mirrors:
https://github.com/Dnyarri/POVmosaic
Expand All @@ -31,7 +34,7 @@
__copyright__ = "(c) 2007-2024 Ilya Razmanov"
__credits__ = "Ilya Razmanov"
__license__ = "unlicense"
__version__ = "1.7.16.11"
__version__ = "1.7.21.21"
__maintainer__ = "Ilya Razmanov"
__email__ = "[email protected]"
__status__ = "Production"
Expand All @@ -47,8 +50,8 @@
# Creating dialog

sortir = Tk()
sortir.title('POVRay Mosaic: 3Zaika')
sortir.geometry('+128+64')
sortir.title('POVRay Mosaic: 63Zaika')
sortir.geometry('+64+128')
sortir.overrideredirect(True)
progressbar = Progressbar(sortir, orient='horizontal', mode='determinate', value=0, maximum=100, length=500)
progressbar.pack(fill=BOTH, expand=True)
Expand Down Expand Up @@ -171,7 +174,7 @@ def srcYL(x, y):
'/*\n',
'Persistence of Vision Ray Tracer Scene Description File\n',
'Version: 3.7\n',
'Description: Mosaic picture consisting from solid spheres, triangle packing.\n',
'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',
Expand Down Expand Up @@ -215,10 +218,10 @@ def srcYL(x, y):
'#declare thingie_1 = sphere{<0, 0, 0>, 0.5}\n',
'#declare thingie_2 = cylinder{<0, 0, 0>, <0, 0, 1.0>, 0.5}\n',
'#declare thingie_3 = cone{<0, 0, 0>, 0.5, <0, 0, 1.0>, 0.0}\n',
'// Hexagonal prism below, like pencils in honeycomb pack, try conic_sweep as well\n',
'#declare thingie_4 = prism{linear_sweep linear_spline 0, 1, 7,\n <-0.5, 0.5*revsqrtof3>, <0,revsqrtof3>, <0.5, 0.5*revsqrtof3>,\n <0.5,- 0.5*revsqrtof3>, <0,-revsqrtof3>, <-0.5,- 0.5*revsqrtof3>,\n <-0.5, 0.5*revsqrtof3> rotate x*270}\n',
'// Rhomb prism below, try conic_sweep as well\n',
'#declare thingie_5 = prism{linear_sweep linear_spline 0, 1, 5, <-1.0, 0>,\n <0, sqrtof3>, <1, 0>, <0, -sqrtof3>, <-1.0, 0> rotate x*270 scale 0.5}\n',
'// Hexagonal prism below, like pencils in honeycomb pack. Try conic_sweep as well\n',
'#declare thingie_4 = prism{linear_sweep linear_spline -1, 0, 7,\n <-0.5, 0.5*revsqrtof3>, <0,revsqrtof3>, <0.5, 0.5*revsqrtof3>,\n <0.5,- 0.5*revsqrtof3>, <0,-revsqrtof3>, <-0.5,- 0.5*revsqrtof3>,\n <-0.5, 0.5*revsqrtof3> rotate x*90 translate z}\n',
'// Rhomb prism below. Try conic_sweep as well\n',
'#declare thingie_5 = prism{linear_sweep linear_spline -1, 0, 5, <-1.0, 0>,\n <0, sqrtof3>, <1, 0>, <0, -sqrtof3>, <-1.0, 0> rotate x*90 scale 0.5 translate z}\n',
'// CSG examples below, may be good for randomly rotated thingies\n',
'#declare thingie_6 = intersection{\n cylinder{<0, 0, -1.0>, <0, 0, 1.0>, 0.5}\n cylinder{<0, 0, -1.0>, <0, 0, 1.0>, 0.5 rotate x*90}\n cylinder{<0, 0, -1.0>, <0, 0, 1.0>, 0.5 rotate y*90}\n } // Cubic rounded CSG end\n',
'#declare thingie_7 = intersection{\n cylinder{<0, -1.0, 0>, <0, 1.0, 0>, 0.5}\n cylinder{<0, -1.0, 0>, <0, 1.0, 0>, 0.5 rotate z*109.5}\n cylinder{<0, -1.0, 0>, <0, 1.0, 0>, 0.5 rotate z*109.5 rotate y*109.5}\n cylinder{<0, -1.0, 0>, <0, 1.0, 0>, 0.5 rotate z*109.5 rotate y*219.0}\n } // Tetrahedral rounded CSG end\n',
Expand All @@ -233,6 +236,8 @@ def srcYL(x, y):
'#declare thingie_normal_3 = normal{bumps 0.05 scale<1.0, 0.05, 0.5>}\n',
'#declare thingie_normal_4 = normal{spiral1 16 0.5 scallop_wave rotate y*90}\n',
'\n// Global modifiers for all thingies in the scene\n',
'#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',
Expand All @@ -251,8 +256,8 @@ def srcYL(x, y):
'#declare thingie_finish = thingie_finish_1\n',
'#declare thingie_normal = thingie_normal_1\n',
'\n// Per-thingie modifiers\n',
'#declare move_map = <0, 0, 0>; // To move thingies depending on map. No constrains on values\n',
'#declare scale_map = <0, 0, 0>; // To rescale thingies depending on map. Expected values 0..1\n',
f'#declare move_map = <0, 0, 0>; // To move thingies depending on map. Additive, no constrains on values. Source image size is {max(X, Y)}\n',
f'#declare scale_map = <0, 0, 0>; // To rescale thingies depending on map. Additive, no constrains on values except object overlap on x,y\n',
'#declare rotate_map = <0, 0, 0>; // To rotate thingies depending on map. Values in degrees\n',
'#declare move_rnd = <0, 0, 0>; // To move thingies randomly. No constrains on values\n',
'#declare rotate_rnd = <0, 0, 0>; // To rotate thingies randomly. Values in degrees\n',
Expand All @@ -261,25 +266,27 @@ def srcYL(x, y):
'#declare normal_rotate_rnd = <0, 0, 0>; // Random rotate of finish. Values in degrees\n',
'\n// Seed random\n',
f'#declare rnd_1 = seed({int(seconds * 1000000)});\n\n',
'background{color rgbft <0, 0, 0, 1, 1>} // Sometimes need to be redefined\n\n\n',
'\n// -<*<* Insert preset to override setting above *>*>-\n',
'// #include "preset_01.inc" // Set path and name of your file related to scene file\n\n',
# Starting scene content
# Camera
'\n// # # # # # SCENE SECTION # # # # #\n\n',
'#declare camera_height = 3.0; // Camera height over object, used for view angle\n\n',
'\n/*\n\n# # # # # SCENE SECTION # # # # #\n\n',
'NOTE: Coordinate system match Photoshop,\norigin is top left, z points to the viewer.\nsky vector is important!\n\n*/\n\n',
'#declare camera_position = <0.0, 0.0, 3.0>; // Camera position over object, used for view angle\n\n',
'camera{\n',
' // orthographic\n',
' location<0.0, 0.0, camera_height>\n',
' location camera_position\n',
' right x*image_width/image_height\n',
' up y\n',
' direction <0, 0, 1>\n',
f' angle 2.0*(degrees(atan2({0.5 * max(X,Y)/X}, camera_height-({1.0/max(X,Y)})))) // Supposed to fit object\n',
' sky <0, -1, 0>\n',
f' direction <0, 0, vlength(camera_position - <0.0, 0.0, {1.0/max(X, Y)}>)> // May alone work for many pictures. Otherwise fiddle with angle below\n',
f' angle 2.0*(degrees(atan2({0.5 * max(X+0.5, Y+0.5)/X}, vlength(camera_position - <0.0, 0.0, {1.0/max(X, Y)}>)))) // Supposed to fit object, unless thingies are too high\n',
' look_at<0.0, 0.0, 0.0>\n',
'}\n\n',
# Light
'light_source{0*x\n color rgb<1.1, 1.0, 1.0>\n translate<4, 2, 3>\n}\n\n',
'light_source{0*x\n color rgb<0.9, 1.0, 1.0>\n translate<-2, 6, 7>\n}\n\n',
'background{color rgbft<0, 0, 0, 1, 1>}\n\n',
'light_source{0*x\n color rgb<1.1, 1.0, 1.0>\n translate<4, -2, 3>\n}\n\n',
'light_source{0*x\n color rgb<0.9, 1.0, 1.0>\n translate<-2, -6, 7>\n}\n\n',
# Main object
'\n// Object thething made out of thingies\n',
'#declare thething = union{\n', # Opening big thething
Expand Down Expand Up @@ -339,15 +346,17 @@ def srcYL(x, y):
# Opening object "thingie" to draw
resultfile.writelines([
' object{thingie\n',
f' pigment{{rgbft<cm({r}), cm({g}), cm({b}), f_val, t_val>}}\n',
' finish{thingie_finish}\n',
' normal{thingie_normal translate(normal_move_rnd * <rand(rnd_1), rand(rnd_1), rand(rnd_1)>) rotate(normal_rotate_rnd * <rand(rnd_1), rand(rnd_1), rand(rnd_1)>)}\n',
f' scale(<1, 1, 1> - (scale_map * <map({c}), map({c}), map({c})>))\n',
' #if (yes_color)\n',
f' pigment{{rgbft<cm({r}), cm({g}), cm({b}), f_val, t_val>}}\n',
' finish{thingie_finish}\n',
' normal{thingie_normal translate(normal_move_rnd * <rand(rnd_1), rand(rnd_1), rand(rnd_1)>) rotate(normal_rotate_rnd * <rand(rnd_1), rand(rnd_1), rand(rnd_1)>)}\n',
' #end\n',
f' scale(<1, 1, 1> + (scale_map * <map({c}), map({c}), map({c})>))\n',
f' rotate(rotate_map * <map({c}), map({c}), map({c})>)\n',
f' rotate(rotate_rnd * <rand(rnd_1), rand(rnd_1), rand(rnd_1)>)\n',
f' {even_odd_string}\n',
f' translate(move_map * <map({c}), map({c}), map({c})>)\n',
f' translate(move_rnd * <rand(rnd_1), rand(rnd_1), rand(rnd_1)>)\n',
' translate(move_rnd * <rand(rnd_1), rand(rnd_1), rand(rnd_1)>)\n',
f' translate<{x}, {y*triangle_height}, 0>\n',
' }\n'
# Finished thingie
Expand All @@ -356,12 +365,16 @@ def srcYL(x, y):
# Transform object to fit 1, 1, 1 cube at 0, 0, 0 coordinates
resultfile.writelines([
'\n // Object transforms to fit 1, 1, 1 cube at 0, 0, 0 coordinates\n',
f' translate <0.25, 0.5, 0> + <{-0.5*X}, {-0.5*Y}, 0>\n', # centering at scene zero
f' scale<{-1.0/max(X, Y)}, {-1.0/max(X, Y)}, {1.0/max(X, Y)}>\n', # fitting and mirroring
f' translate <0.25, 0.5, 0> + <{-0.5*X}, {-0.5*Y}, 0>\n', # centering at scene zero
f' scale<{1.0/max(X, Y)}, {1.0/max(X, Y)}, {1.0/max(X, Y)}>\n', # fitting
'} // thething closed\n\n'
'\nobject {thething\n'
f'// interior {{ior 2.0 fade_power 1.5 fade_distance 1.0*{1.0/max(X, Y)} fade_color<0.95, 0.95, 0.95>}}\n',
'}\n',
'\nobject {thething\n' # inserting thething
' #if (yes_color < 1)\n',
' pigment {color rgb<0.5, 0.5, 0.5>}\n',
' finish {thingie_finish}\n',
' #end\n',
f' interior {{ior 2.0 fade_power 1.5 fade_distance 1.0*{1.0/max(X, Y)} fade_color <0.0, 0.5, 1.0>}}\n',
'}\n', # insertion complete
'\n/*\n\nhappy rendering\n\n 0~0\n (---)\n(.>|<.)\n-------\n\n*/'
])
# Closed scene
Expand Down
Loading

0 comments on commit 068ece9

Please sign in to comment.