/* dodecaland.pov * * Regular dodecahedron crystal on an island amidst islands. * * Copyright © 2008 Richard Callwood III. Some rights reserved, under the * terms of the Creative Commons GNU General Public License. * This software carries no warranty, express or implied. * See http://creativecommons.org/licenses/GPL/2.0/ for more information. * Created 09-sep-2008 * Updated 23-sep-2008 * * Acknowledgements: * Idea generator - alphaQuad * Inspiration - Jonathan Hunt * Media assistance - Mike Williams * Numerical analysis - Alain * Water spectral absorption - Martin Chaplin * Water surface normal - Christoph Hormann */ #ifndef (Cam) #declare Cam = 2; #end //0...2 #ifndef (Fog) #declare Fog = yes; #end #ifndef (H2O) #declare H2O = 1; #end //0...2 #ifndef (Mat) #declare Mat = 1; #end //0...2 #ifndef (Ph) #declare Ph = 0; #end #ifndef (Rad) #declare Rad = off; #end #ifndef (Soft) #declare Soft = no; #end /* scene parameters 0 1 2 Cam bird's eye, wide angle bird's eye final view Fog no ground fog ground fog H2O no refraction or scattering add refraction add scattering Mat opaque crystal no dispersion dispersion checkered sea floor sandy sea floor sandy sea floor smooth rocks, glassy sea textured rocks & sea textured rocks & sea Rad no radiosity radiosity Soft sharp shadows soft shadows 0 > 0 Ph no photons photons spacing Main: //+a0.1 +am1 +r3 declare=H2O=2 declare=Ph=0.1 declare=Rad=1 declare=Mat=2 Patch://+a0.1 +am1 +r3 declare=H2O=2 declare=Ph=0.1 declare=Rad=1 declare=Soft=1 +sc0.30 +ec0.53 +sr0.64 +er0.77 */ #include "shapes.inc" //required by shapes2.inc #include "shapes2.inc" global_settings { assumed_gamma 1 max_trace_level 50 #if (Rad) radiosity { recursion_limit 1 gray_threshold 0.5 error_bound 0.5 pretrace_end 0.01 normal on } #end #if (Ph) photons { spacing Ph autostop 0 } #end } #declare c_General = <-1, 0, 2>; light_source { 10000 * z rgb (Rad? 1.25 - c_General * 0.1: 1.45 - c_General * 0.1) #if (Soft) area_light 10000 / 107.6 * x, 10000 / 107.6 * z, 5, 5 circular orient adaptive 1 #end rotate <-45, 135, 0> } #declare c_Ambience = #if (Rad) 0; #else 0.16 + c_General * 0.05; #end #default { finish { ambient c_Ambience } } camera { #switch (Cam) #case (0) angle 90 location <0, 100, -100> look_at <0, 10, 0> #break #case (1) angle 45 location <0, 100, -100> look_at 0 #break #else location <0, 10, -60> look_at <0, 12, 0> #break #end up y right image_width / image_height * x } //=================================== SKY ====================================== #declare c_Horizon = rgb <0.5, 0.75, 1.0>; #declare c_Zenith = rgb <0.0, 0.2, 0.8>; #declare c_Cloud_top = rgb 1; #declare c_Cloud_base = rgb 0.5; #declare Cloud_lumps = 2; sky_sphere { pigment { gradient y color_map { [0.0 c_Horizon] [0.2 (c_Horizon + c_Zenith) / 2] [0.8 c_Zenith] } } } #if (Fog) fog { fog_type 2 color c_Horizon distance 10000 fog_offset 0 fog_alt 100 } #end #macro Clouds_t (Paint) texture { pigment { bozo turbulence 1 octaves 5 omega 0.6 lambda 2.25 color_map { Paint } } finish { diffuse 0 ambient 1 } } #end union { plane { y, Cloud_lumps Clouds_t ( color_map { [0.5 c_Cloud_top transmit 1] [0.75 c_Cloud_top transmit 0.2] } ) translate (Cloud_lumps * 0.015) * y } plane { y, Cloud_lumps Clouds_t ( color_map { [0.7 c_Cloud_base transmit 1] [0.9 c_Cloud_base transmit 0.2] [1 c_Cloud_base transmit 0] } ) } hollow scale 1000 / Cloud_lumps photons { pass_through collect off } } //================================= CRYSTAL ==================================== #declare Height = 10; #declare Crystal_clear = 0.85; #declare c_Color1 = <1, Crystal_clear, 1>; #declare c_Color2 = ; #declare c_Clear1 = rgb c_Color1 filter 1; #declare c_Clear2 = rgb c_Color2 filter 1; #declare Crystal0 = object { Dodecahedron rotate <37.41, -10, 0> scale 8 } object { Crystal0 translate Height * y #if (Mat < 1) pigment { bozo color_map { [0.20 rgb c_Color1] [0.35 rgb c_Color2] [0.50 rgb c_Color1] [0.65 rgb c_Color2] [0.80 rgb c_Color1] } scale 1.5 } #else pigment { bozo color_map { [0.20 c_Clear1] [0.35 c_Clear2] [0.50 c_Clear1] [0.65 c_Clear2] [0.80 c_Clear1] } scale 1.5 } finish { reflection { 0 1 fresnel } conserve_energy specular 1 roughness 0.001 } interior { ior 1.7 #if (Mat = 2) dispersion 1.02 dispersion_samples 30 #end #if (!Ph) caustics 1 #end } photons { target refraction on collect off } #end } //========================== LAND AND SEA MATERIALS ============================ #declare c_Sand = rgb <0.75, 0.5, 0.25>; #declare t_Sand = texture { pigment { c_Sand } #if (Mat >= 1) normal { average normal_map { [1 bumps 1 scale 0.4] [1 bumps 2 scale 0.01] } scale <1,2,1> } #end } #declare c_Red = rgb <0.8, 0.4, 0.2>; #declare c_Brown = rgb <0.55, 0.4, 0.2>; #declare c_Trans = c_Red * 2/3 + c_Brown/3; #declare c_White = c_Sand + 0.05; #declare t_Rock = texture { pigment { gradient y color_map { [0.00 c_Red] [0.05 c_Brown] [0.58 c_Trans] [0.61 c_White] [0.64 c_Trans] [0.90 c_Red] [0.94 c_White] [0.94 c_Red] [0.95 c_Red] [0.96 c_Brown] [0.97 c_Red] [0.98 c_Red] [0.98 c_White] [1.00 c_White] } warp { turbulence 0.1 } scale <1, 10, 1> * 0.5 rotate <10, 0, 20> } } #declare c_H2O_abs = rgb <0.272, 0.046, 0.010>; //at 1 meter #declare c_Sea = <0.004, 0.012, 0.020>; //H2O scattering trial&error #declare n_Sea = normal { function { f_ridged_mf (x, y, z, 0.1, 3.0, 7, 0.7, 0.7, 2) } 2 } #declare ior_NaCl_H2O = 1.34; //35g/l #declare FOAMY = 1.25; #declare f_Foam = finish { diffuse 0.6 * FOAMY ambient c_Ambience * FOAMY specular 1 roughness 0.01 } #declare c_Foam = rgb 1; #declare c_Foamy = c_Sand / FOAMY; //poor man's scattering #declare p_Foam = pigment { bozo scale 0.1 } #declare p_Foam1 = pigment { p_Foam color_map { [0.33 c_Foamy transmit sqrt(0.5)] [0.50 c_Foam transmit sqrt(0)] [0.67 c_Foamy transmit sqrt(0.5)] } } #declare p_Foam2 = pigment { p_Foam color_map { [0.36 c_Foamy transmit sqrt(0.7)] [0.50 c_Foam transmit sqrt(0.15)] [0.64 c_Foamy transmit sqrt(0.7)] } } #declare p_Foam3 = pigment { p_Foam color_map { [0.39 c_Foamy transmit sqrt(0.9)] [0.50 c_Foam transmit sqrt(0.45)] [0.61 c_Foamy transmit sqrt(0.9)] } } #declare p_Foam4 = pigment { p_Foam color_map { [0.42 c_Foam transmit 1] [0.50 c_Foam transmit sqrt(0.75)] [0.58 c_Foam transmit 1] } } //=================================== LAND ===================================== #declare fn_Isle_curve2d = function (x, P0_r) { P0_r - sqrt (pow(P0_r,2) + pow(x,2)) } #macro Foam (Form) intersection { object { Form translate 2 * y } plane { y, 0.001 } plane { -y, 0.001 } pigment { object { Form translate 0.8 * y pigment { object { Form translate 1.4 * y pigment { p_Foam4 } pigment { p_Foam3 } } } pigment { object { Form translate 0.4 * y pigment { p_Foam2 } pigment { p_Foam1 } } } } } finish { f_Foam } #if (Mat >= 1) normal { n_Sea } #end } #end #declare Seq = seed(1); #declare Center_isle = blob { #declare Rho = 0; #while (Rho <= 12) #declare Jitter = floor (mod (Rho, 4) / 2) / 2; #declare Theta = 0; #while (Theta < 6 * Rho) sphere { 0, 1.5 * (1 + rand(Seq)), 10 scale <1, 3, 1> translate <2*Rho, fn_Isle_curve2d (2*Rho, 10), 0> + rotate y * (Theta + Jitter) * 60 / Rho } #declare Theta = Theta + 1; #end #declare Rho = Rho + 1; #end translate 2.5 * y } #macro Side_isle (Seed, Where, Textured) #local Seq = seed (Seed); blob { #local Rhold = 0; #local I = -21; #while (I <= 8) #local Jitter = (I + floor (mod (I, 4) / 2)) / 2; #local Rho = sqrt (pow (I, 2) + 64) - I - 3; #if (Rhold) #local Step = Rhold - Rho; #else #local Step = 2; #end #local Around = floor (6 * Rho / Step + 0.5); #local Tall = 4 / Step * max (1, 5.25 - Rho); #local Theta = 0; #while (Theta < Around) sphere { 0, 0.75 * Step * (1 + rand(Seq)), 10 scale <1, Tall, 1> translate + * 0.5 * Step rotate y * (Theta + Jitter) * 360 / Around #if (Textured & Rho < 4.5) texture { t_Rock #if (Mat >= 1) normal { average normal_map { [1 bumps 1 scale 0.2 * <1, Tall, 1> * Step] [1 bumps 2 scale 0.05 * <1,5,1>] } } #end rotate -Where * y translate <-27.5, 0, 0> } #end } #local Theta = Theta + 1; #end #local Rhold = Rho; #local I = I + 1; #end translate <27.5, 3.75, 0> rotate Where * y #if (Textured) texture { t_Sand } #end } #end #declare Looks_good = 8; #declare I = 0; #while (I < 5) Side_isle (I + Looks_good, I * 72, yes) Foam (Side_isle (I + Looks_good, I * 72, no)) #declare I = I + 1; #end difference { object { Center_isle } object { Crystal0 scale 1.0001 translate Height * y } texture { t_Sand } } Foam (Center_isle) plane //sea floor { y, -30 #if (Mat) texture { t_Sand } #else pigment { checker rgb 0 rgb 1 scale 10 } #end } //=================================== SEA ====================================== plane //surface { y, 0 hollow texture { pigment { rgbf 1 } finish { reflection { 0 0.5 fresnel } conserve_energy specular 1 roughness 0.01 } #if (Mat >= 1) normal { n_Sea } #end } interior { #if (H2O >= 1) ior ior_NaCl_H2O #end media { absorption c_H2O_abs #if (H2O >= 2) scattering { 3, c_Sea } #end method 3 intervals 1 samples 3, 3 aa_level 2 } } }