// INCLUDES #include "randWood.inc" // DECLARES #version unofficial MegaPov 1.20; #debug "\nWavy arrangement of boxes\\spheres\\pegs.\nWritten and Rendered by Evan Trask \n\n" #default { texture { pigment { color rgb <0.7,0.7,0.7> } finish { ambient 0 diffuse 1 } } } #declare useShape = 2; // 0 - boxes, 1 - spheres, 2 - pegs #declare xIteration = 0; // Used for loops, do not change #declare zIteration = 0; // Ditto #declare xCount = 150; // Number of objects in the x-axis #declare zCount = 200; // Number of objects in the y-axis #declare sphereRadius = 0.25; // Self explanitory. Box side lengths are 2*sphereRadius #declare sphereSpacing = 0.525; // Space between objects. Should be slightly larger than 2*sphereRadius #declare useRadiosity = 1; // 0 - none (must insert light sources), 1 - fast, 2 - good #declare useFocalBlur = 0; // Not used with orthographic camera. High-quality and CPU-intensive #declare useRandom = 0; // Makes pegs have random-ness in their height. Only used if useShape = 2 #declare useOrthoTopView = 0; // Interesting orthographic view, or normal perspective #declare pigShapes = array [18] { P_WoodGrain1A, P_WoodGrain1B, P_WoodGrain2A, P_WoodGrain2B, P_WoodGrain3A, P_WoodGrain3B, P_WoodGrain4A, P_WoodGrain4B, P_WoodGrain5A, P_WoodGrain5B, P_WoodGrain6A, P_WoodGrain6B, P_WoodGrain7A, P_WoodGrain7B, P_WoodGrain8A, P_WoodGrain8B, P_WoodGrain9A, P_WoodGrain9B } #declare finShapes = array [18] { M_Wood1A, M_Wood2A, M_Wood3A, M_Wood4A, M_Wood5A, M_Wood6A, M_Wood7A, M_Wood8A, M_Wood9A, M_Wood10A, M_Wood11A, M_Wood12A, M_Wood20A, M_Wood14A, M_Wood15A, M_Wood16A, M_Wood17A, M_Wood18A } // GLOBAL SETTINGS global_settings { #switch (useRadiosity) #case (0) #debug "No radiosity used.\n" #break #case (1) radiosity { #debug "Fast radiosity settings used.\n" adc_bailout 1/pow(2,8) // 24-bit images //adc_bailout 1/pow(2,16) // 48-bit images brightness 1.0 count 100 error_bound 0.45 gray_threshold 0 low_error_factor 0.95 minimum_reuse 0.025 nearest_count 5 //normal on pretrace_start 0.25 pretrace_end 16/(image_width*image_height) recursion_limit 1 save_file "wavy_shapes_lowq.radiosity" } #break #case (2) radiosity { #debug "High-quality radiosity settings used.\n" adc_bailout 1/pow(2,8) // 24-bit images //adc_bailout 1/pow(2,16) // 48-bit images brightness 1.0 count 900 error_bound 0.3 gray_threshold 0 low_error_factor 0.6 minimum_reuse 0.01 nearest_count 8 //normal on pretrace_start 1 pretrace_end 4/(image_width*image_height) recursion_limit 1 save_file "wavy_shapes_hiq.radiosity" } #break #end #undef useRadiosity adc_bailout 1/pow(2,8) // 24-bit images //adc_bailout 1/pow(2,16) // 48-bit images } // CAMERA camera { #switch (useOrthoTopView) #case (0) #debug "Perspective camera used.\n" location <1,7,-12> right (image_width/image_height)*x up y look_at <0,-1,0> sky <0.125,1,0> #switch (useFocalBlur) #case(0) #debug "No focal blur used.\n" #break #else #debug "Focal blur used.\n" aperture 0.22 focal_point <0,-1,0> blur_samples 315 #break #end #undef useFocalBlur #break #else #debug "Orthographic camera used. Focal blur settings ignored.\n" orthographic location <0,10,0> look_at <0,0,0> #break #end #undef useOrthoTopView } // LIGHTS // SCENE plane { // Floor, duh y, -2.25 } sphere { // HDRi Sphere <0,0,0> 125 texture { pigment { image_map { hdr "hdr_environment.hdr" once interpolate 2 map_type 1 } } finish { ambient 0.75 diffuse 0 } } hollow } #switch ( useShape ) #case (0) #debug "Boxes used.\n\n" #debug concat("There are ", str(xCount,3,0), " boxes in the x-axis.\n") #debug concat("There are ", str(zCount,3,0), " boxes in the z-axis.\n\n") #break #case (1) #debug "Spheres used.\n\n" #debug concat("There are ", str(xCount,3,0), " spheres in the x-axis.\n") #debug concat("There are ", str(zCount,3,0), " spheres in the z-axis.\n\n") #break #case (2) #debug "Pegs used.\n\n" #debug concat("There are ", str(xCount,3,0), " pegs in the x-axis.\n") #debug concat("There are ", str(zCount,3,0), " pegs in the z-axis.\n\n") #break #else #error "Variable \"useShape\" has invalid declaration.\n" #break #end #while ( xIteration < xCount ) #while ( zIteration < zCount ) //#declare xPlacement = xIteration*sphereSpacing; //#declare yPlacement = (xIteration/(xCount-1))*sin(degrees(zIteration)); //#declare zPlacement = zIteration*sphereSpacing+abs(sin(degrees(xIteration-(10*clock)))); object { #switch (useShape) #case (0) box { <-sphereRadius,-sphereRadius,-sphereRadius> } #break #case (1) sphere { <0,0,0> sphereRadius } #break #case (2) #if ( useRandom = 1 ) cylinder { <0,-2.24999,0> <0,yPlacement+(rand(xIteration+zIteration)*0.5),0> sphereRadius } #else cylinder { <0,-2.24999,0> <0,((xIteration/(xCount-1))*sin(degrees(zIteration))),0> sphereRadius } #end #break #else #error "Variable \"useShape\" has invalid declaration.\n" #break #end #if (useShape != 2) translate <(xIteration*sphereSpacing),((xIteration/(xCount-1))*sin(degrees(zIteration))),(zIteration*sphereSpacing+abs(sin(degrees(xIteration-(10*clock)))))> #else translate <(xIteration*sphereSpacing),0,(zIteration*sphereSpacing+abs(sin(degrees(xIteration-(10*clock)))))> #end translate #declare randPigSeed = seed((xIteration+zIteration)+zIteration/xCount); #declare randMapSeed = seed((xIteration+zIteration)-xIteration/zCount+rand(seed(randPigSeed))); #declare randPigment = mod(int(rand(seed(randPigSeed))*1000),18); #declare randColrMap = mod(int(rand(seed(randMapSeed))*1000),18); texture { pigment { pigShapes[randPigment] color_map { finShapes[randColrMap] } scale 0.5 } } } #declare zIteration = zIteration + 1; #end #declare zIteration = 0; #declare xIteration = xIteration + 1; #end