#version 3.7; #declare HPlanet_Water_Ratio = 1/3; #declare HPlanet_Seed_Value = seed(808232374); #declare Toggle_Area_Light = true; #declare Toggle_Sun_Object = true; #declare Toggle_Corona = true; #declare Toggle_Ringworld_Surface = true; #declare Toggle_Ringworld_Clouds = true; #declare Toggle_Ringworld_Atmosphere = false; #declare Toggle_Shadow_Squares = true; #declare Toggle_Radiosity = false; #declare Toggle_Camera_Mode = 1; // 1 unit = 100 miles #declare sun_diameter = 10000; #declare ring_radius = 950000; #declare ring_width = 10000; #declare rim_wall_height = 10; #declare shadow_square_radius = 130000; #declare shadow_square_width = 10000; #declare shadow_square_length = 25000; #declare sun_radius = sun_diameter/2; #declare corona_radius = ring_radius; #declare atmosphere_height = 1; #declare clouds_bottom = 0.01; #declare clouds_top = 0.05; #include "CIE.inc" // http://www.ignorancia.org/en/index.php?page=Lightsys #include "lightsys.inc" // http://www.ignorancia.org/en/index.php?page=Lightsys #include "math.inc" #include "transforms.inc" //------------------------------------------------------------------------------ // CAMERA #switch (Toggle_Camera_Mode) #case (1) #declare Camera_Vertical = 0; //45; #declare Camera_Horizontal = 30; //asind(tand(30)); #declare Camera_Aspect = image_height/image_width; #declare Camera_Distance = 10; #declare Camera_Translate = <0,0,0>; #declare Camera_Scale = ring_radius * 1.1; #declare Camera_Up = +y * 2 * Camera_Aspect; #declare Camera_Right = +x * 2; #declare Camera_Location = -z * Camera_Distance; #declare Camera_Direction = +z * Camera_Distance; #declare Camera_LookAt = Camera_Location + Camera_Direction; #declare Camera_Rotate = ; #declare Camera_Transform = transform { rotate Camera_Rotate scale Camera_Scale translate Camera_Translate } camera { perspective //orthographic up Camera_Up right Camera_Right location Camera_Location direction Camera_Direction transform {Camera_Transform} } #declare Camera_Location = vtransform(Camera_Location,Camera_Transform); #declare Camera_LookAt = vtransform(Camera_LookAt,Camera_Transform); #break #case (2) camera { perspective sky y location <0,0,-ring_radius*63/64> look_at <0,0,-ring_radius> } #break #case (3) camera { perspective sky z location <0,0,-ring_radius + 0.005> look_at <1,0,-ring_radius + 0.005> } #break #case (4) camera { perspective sky y location <0,ring_radius*1/4,-ring_radius*2/3> look_at <0,0,-ring_radius> } #break #end //------------------------------------------------------------------------------ // MISC GRAPHICAL SETTINGS global_settings { #if (Toggle_Radiosity = true) radiosity { always_sample off brightness 0.3 } #end ambient_light 0.01 charset utf8 assumed_gamma 1.0 } //background {color rgb 1/4} //------------------------------------------------------------------------------ // LIGHTS #if (Toggle_Area_Light = true) // my version of an area light, very slow #local light_radius = sun_radius; #local light_theta = 0; #local light_theta_num = 8; #local light_theta_dif = 2 * pi/light_theta_num; #local light_phi_num = 4; #local light_phi_dif = pi/light_phi_num; #declare light_lumens = 2/light_theta_num/light_phi_num; // float #declare light_temp = Daylight(5800); // float #declare light_color = Light_Color(light_temp,light_lumens); // vector #for (i, 1, light_theta_num) #local light_phi = 0; #for (j, 1, light_phi_num) #local light_x = light_radius * cos(light_theta) * sin(light_phi); #local light_y = light_radius * cos(light_phi); #local light_z = light_radius * sin(light_theta) * sin(light_phi); light_source { light_color } #local light_phi = light_phi + light_phi_dif; #end #local light_theta = light_theta + light_theta_dif; #end #else #declare light_lumens = 2; // float #declare light_temp = Daylight(5800); // float #declare light_color = Light_Color(light_temp,light_lumens); // vector // #declare light_color = light_color * light_color; light_source { 0 light_color } #end //------------------------------------------------------------------------------ // TEXTURE MAPS #declare HPlanet_Blue_texture = texture { pigment {color rgb <000,000,050,>/255} finish { //ambient 0.15 ambient 0 diffuse 0.2 brilliance 5.0 phong 1.0 phong_size 90.0 specular 0.1 roughness 0.01 conserve_energy reflection { 0.1, 0.9 falloff 2 } } } #declare HPlanet_Teal_texture = texture { pigment {color rgb <034,180,180,>/255} finish { //ambient 0.15 ambient 0 diffuse 0.2 brilliance 5.0 phong 1.0 phong_size 90.0 specular 0.1 roughness 0.01 conserve_energy reflection { 0.1, 0.9 falloff 2 } } } #declare HPlanet_LightGreen_texture = texture { pigment {color rgb <067,084,029,>/255} } #declare HPlanet_DarkGreen_texture = texture { pigment {color rgb <040,066,018,>/255} } #declare HPlanet_DarkTan_texture = texture { pigment {color rgb <084,076,037,>/255} } #declare HPlanet_LightTan_texture = texture { pigment {color rgb <132,114,076,>/255} } #declare HPlanet_White_texture = texture { pigment {color rgb <255,255,255,>/255} } #declare HPlanet_Altitiude_texture_map = texture_map { [0 HPlanet_Blue_texture] [HPlanet_Water_Ratio * 97.5/100 HPlanet_Blue_texture] [HPlanet_Water_Ratio * 1/1 HPlanet_Teal_texture] [HPlanet_Water_Ratio + (1 - HPlanet_Water_Ratio) * 0/6 HPlanet_LightGreen_texture] [HPlanet_Water_Ratio + (1 - HPlanet_Water_Ratio) * 2/6 HPlanet_DarkGreen_texture] [HPlanet_Water_Ratio + (1 - HPlanet_Water_Ratio) * 3/6 HPlanet_DarkTan_texture] [HPlanet_Water_Ratio + (1 - HPlanet_Water_Ratio) * 4/6 HPlanet_LightTan_texture] [HPlanet_Water_Ratio + (1 - HPlanet_Water_Ratio) * 4/6 HPlanet_White_texture] [HPlanet_Water_Ratio + (1 - HPlanet_Water_Ratio) * 6/6 HPlanet_White_texture] } #if (Toggle_Ringworld_Atmosphere = true) #declare HPlanet_BozoCloud_color_map = color_map { [0.0 color rgb <0.95, 0.95, 0.95>*0.5] [0.1 color rgb <0.85, 0.85, 0.85>*1.5] [0.5 color rgbt 1 ] [1.0 color rgbt 1 ] } #else #declare HPlanet_BozoCloud_color_map = color_map { [0.0 color rgb <0.95, 0.95, 0.95>*0.5] [0.1 color rgb <0.85, 0.85, 0.85>*1.5] [0.5 color rgbt <0.1, 0.3, 1.0, 0.99> ] [1.0 color rgbt <0.1, 0.3, 1.0, 0.99> ] } #end //------------------------------------------------------------------------------ // TEXTURE FUNCTIONS #local HPlanet_Crackle_function = function { pigment { crackle form <1,0,0> color_map { [0 rgb 0] [1 rgb 1] } scale 1 } } #local HPlanet_Granite_function = function { pigment { granite color_map { [0 rgb 0] [1 rgb 1] } warp { turbulence 0.75 lambda 3 } scale 10 } } #local HPlanet_EdgeHeightLand_function = function { pigment { gradient y color_map { [ 0/16 rgb 0/2] [ 2/16 rgb 1/2] //[ 5/16 rgb 1/2] [ 8/16 rgb 2/2] //[ 9/16 rgb 1/2] [14/16 rgb 1/2] [16/16 rgb 0/2] } translate -y/2 scale 2 } } #local HPlanet_EdgeHeightCloud_function = function { pigment { gradient y color_map { [ 0/16 rgb 2/2] [ 7/16 rgb 0/2] [ 8/16 rgb 2/2] [ 9/16 rgb 0/2] [16/16 rgb 2/2] } translate -y/2 scale 2 warp { turbulence 1 } } } #local HPlanet_BozoCloud_function = function { pigment { bozo turbulence 0.65 octaves 6 omega 0.7 lambda 2 color_map { [0 rgb 0] [1/16 rgb 0] [1 rgb 1] } scale 1/10 } } //------------------------------------------------------------------------------ // FINAL TEXTURES #local HPlanet_GraniteCrackle1_texture = texture { function {((1-HPlanet_Crackle_function(x,y,z).green) * 2 + HPlanet_Granite_function(x,y,z).green * 1 + HPlanet_EdgeHeightLand_function(x,y,z).green * 3)/5 * -1} texture_map { HPlanet_Altitiude_texture_map } /* #local HPlanet_WarpCount = 0; #local HPlanet_WarpTotal = 10000; #while (HPlanet_WarpCount < HPlanet_WarpTotal) #local cylradius = ring_radius/(ring_width/2); #local cyltheta = rand(HPlanet_Seed_Value) * 2 * pi; #local cylheight = floor(rand(HPlanet_Seed_Value) + 1/2) * 2 - 1; #local cylheight = rand(HPlanet_Seed_Value) * 2 - 1; #local holeradius = rand(HPlanet_Seed_Value) * 2; warp { black_hole , holeradius falloff 3/6 strength 1/24 inverse } #local HPlanet_WarpCount = HPlanet_WarpCount + 1; #end */ } #local HPlanet_GraniteCrackle2_texture = texture { function {((1-HPlanet_Crackle_function(x,y,z).green) * 2 + HPlanet_Granite_function(x,y,z).green * 2)/3 * -1} texture_map { [0 HPlanet_Blue_texture] [HPlanet_Water_Ratio * 97.5/100 HPlanet_Blue_texture] [HPlanet_Water_Ratio * 1/1 HPlanet_Teal_texture] [HPlanet_Water_Ratio + (1 - HPlanet_Water_Ratio) * 0/6 HPlanet_GraniteCrackle1_texture] [HPlanet_Water_Ratio + (1 - HPlanet_Water_Ratio) * 6/6 HPlanet_GraniteCrackle1_texture] } /* #local HPlanet_WarpCount = 0; #local HPlanet_WarpTotal = 10000; #while (HPlanet_WarpCount < HPlanet_WarpTotal) #local cylradius = ring_radius/(ring_width/2); #local cyltheta = rand(HPlanet_Seed_Value) * 2 * pi; #local cylheight = rand(HPlanet_Seed_Value) * 2 - 1; #local holeradius = rand(HPlanet_Seed_Value) / 10; warp { black_hole , holeradius falloff 3/6 strength 4/24 inverse } #local HPlanet_WarpCount = HPlanet_WarpCount + 1; #end */ } #local HPlanet_CloudEdge_pigment = pigment { function {(HPlanet_BozoCloud_function(x,y,z).x * 3 + HPlanet_EdgeHeightCloud_function(x,y,z).x * 1)/4 * -1} color_map { HPlanet_BozoCloud_color_map } warp { turbulence <1,0,1> } /* #local HPlanet_WarpCount = 0; #local HPlanet_WarpTotal = 10000; #while (HPlanet_WarpCount < HPlanet_WarpTotal) #local cylradius = ring_radius/(ring_width/2); #local cyltheta = rand(HPlanet_Seed_Value) * 2 * pi; #local cylheight = floor(rand(HPlanet_Seed_Value) + 1/2) * 2 - 1; #local cylheight = rand(HPlanet_Seed_Value) * 2 - 1; #local holeradius = rand(HPlanet_Seed_Value) * 1; warp { black_hole , holeradius falloff 3 strength 1/6 inverse } #local HPlanet_WarpCount = HPlanet_WarpCount + 1; #end */ } //------------------------------------------------------------------------------ // RINGWORLD #if (Toggle_Ringworld_Surface = true) // surface difference { cylinder {<0,ring_width/2,0>, <0,-ring_width/2,0>, ring_radius + 1} cylinder {<0,ring_width/2 + 1,0>, <0,-ring_width/2 - 1,0>, ring_radius} texture { HPlanet_GraniteCrackle2_texture scale ring_width/2 } } // rim difference { cylinder {<0,ring_width/2 + 1,0>, <0,-ring_width/2 - 1,0>, ring_radius + 2} cylinder {<0,ring_width/2,0>, <0,-ring_width/2,0>, ring_radius + 0.99999} cylinder {<0,ring_width/2 + 2,0>, <0,-ring_width/2 - 2,0>, ring_radius - rim_wall_height} texture { pigment {color rgb 1} scale ring_width/2 } } #end #if (Toggle_Ringworld_Clouds = true) // clouds difference { cylinder {<0,ring_width/2,0>, <0,-ring_width/2,0>, ring_radius - clouds_bottom} cylinder {<0,ring_width/2 + 1,0>, <0,-ring_width/2 - 1,0>, ring_radius - clouds_top} hollow // should this be hollow? texture { pigment {HPlanet_CloudEdge_pigment} finish {ambient 0 diffuse 1} scale ring_width/2 } } #end #if (Toggle_Ringworld_Atmosphere = true) // atmosphere #local atmos_color_scatter = <0.1, 0.3, 1.0>; #local atmos_color_absorb = <0.9, 0.7, 0.0>; // should be the inverse of atmos_color_scatter difference { cylinder {<0,ring_width/2,0>, <0,-ring_width/2,0>, ring_radius - 0.0001} // cylinder {<0,ring_width/2 + 1,0>, <0,-ring_width/2 - 1,0>, ring_radius - atmosphere_height} hollow material { texture { pigment {rgbt 1} } interior { media { scattering { 4, atmos_color_scatter } density { // Reverse: It starts at 1.0 at the origin and decreases to a minimum value of 0.0 as it approaches a distance of 1 unit from the Y axis. function {1-f_cylindrical(x,y,z)} density_map { [0 rgb 0] [1-atmosphere_height/ring_radius rgb 0] [1 rgb 1/10] } scale ring_radius } } media { absorption atmos_color_absorb density { function {1-f_cylindrical(x,y,z)} density_map { [0 rgb 0] [1-atmosphere_height/ring_radius rgb 0] [1 rgb 1/10] } scale ring_radius } } } } } #end //------------------------------------------------------------------------------ // SUN & HELIOSPHERE #if (Toggle_Sun_Object = true) sphere { 0, sun_radius hollow material { texture { pigment {rgbt 1} } interior { media { emission 10/sun_radius density { spherical density_map { [0 rgb 0] [1 rgb light_color] } scale sun_radius #local HPlanet_WarpCount = 0; #local HPlanet_WarpTotal = 100; #while (HPlanet_WarpCount < HPlanet_WarpTotal) #local sphradius = sun_diameter/2; #local sphtheta = rand(HPlanet_Seed_Value) * pi * 2; #local sphphi = rand(HPlanet_Seed_Value) * pi; #local holeradius = rand(HPlanet_Seed_Value) * sun_radius / 10; warp { black_hole , holeradius falloff 3/6 strength 2/6 inverse } #local HPlanet_WarpCount = HPlanet_WarpCount + 1; #end } } } } } #end #if (Toggle_Corona = true) sphere { 0, corona_radius hollow material { texture { pigment {rgbt 1} } interior { media { scattering {1, light_color/20} // needs to be divided by corona_radius doesn't it? //emission light_color/1000 density { function{1/(x*x + y*y + z*z)/corona_radius} density_map { [0 rgb 0] [1 rgb 1] } scale corona_radius } } } } } #end //------------------------------------------------------------------------------ // SHADOW SQUARES #if (Toggle_Shadow_Squares = true) #local ShieldNumber = 40; #local ShieldAngle = 360 / ShieldNumber; #declare ShieldPiece = intersection { difference { cylinder {<0,shadow_square_width/2,0>, <0,-shadow_square_width/2,0>, shadow_square_radius} cylinder {<0,shadow_square_width/2 + 1,0>, <0,-shadow_square_width/2 - 1,0>, shadow_square_radius - 0.001} } plane {-z, 0 rotate y * ShieldAngle/2} plane {+z, 0 rotate y * -ShieldAngle/2} } union { #for (i, 1, ShieldNumber, 2) object {ShieldPiece rotate y * ShieldAngle * i} #end pigment {color rgb 0} } #end