#version 3.7; #declare HPlanet_Water_Ratio = 1/3; #declare HPlanet_Seed_Value = seed(808232374); #declare Toggle_Area_Light = false; #declare Toggle_Sun_Object = false; #declare Toggle_Ringworld_Object = true; #declare Toggle_Shadow_Squares = false; #declare Camera_Mode = 2; // 1 unit = 100 miles #declare sun_diameter = 10000; #declare ring_radius = 950000; #declare ring_width = 9970; #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 = sun_diameter * 8; #declare corona_radius = ring_radius; #declare atmosphere_height = 1; #declare clouds_bottom = 1/100; #declare clouds_top = 5/100; #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 (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; #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,ring_radius*1/32,-ring_radius*63/64> look_at <0,0,-ring_radius> } #break #case (3) camera { perspective sky z location <0,0,-ring_radius + 1/100> look_at <1,0,-ring_radius + 1/100> } #break #end //------------------------------------------------------------------------------ // MISC GRAPHICAL SETTINGS global_settings { // radiosity // { // always_sample off // brightness 0.3 // } ambient_light 0.1 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 light_source { 0 light_color } #end //------------------------------------------------------------------------------ // TEXTURE MAPS #declare HPlanet_Blue_texture = texture { pigment {color rgb <000,000,050,>/255} // normal // { // ripples 0.3 // scale 0.25 // turbulence 0.75 // translate < 1,0,2> // } finish { ambient 0.45 diffuse 0.55 reflection 0.3 } } #declare HPlanet_Teal_texture = texture { pigment {color rgb <034,180,180,>/255} } #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] } #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, 1, 1> ] [1.0 color rgbt <1, 1, 1, 1> ] } //------------------------------------------------------------------------------ // TEXTURE FUNCTIONS #local HPlanet_Crackle_function = function { pigment { crackle form <1,0,0> color_map { [0 rgb 0] [1 rgb 1] } } } #local HPlanet_Granite_function = function { pigment { granite color_map { [0 rgb 0] [1 rgb 1] } scale 10 scale .5 warp { turbulence .75 lambda 3 } scale .5 } } #local HPlanet_EdgeHeight_function = function { pigment { gradient y color_map { [0/8 rgb 2/2] [1/8 rgb 1/2] [2/8 rgb 1/2] [4/8 rgb 0/2] [6/8 rgb 1/2] [7/8 rgb 1/2] [8/8 rgb 2/2] } scale 2 } } #local HPlanet_BozoCloud_function = function { pigment { bozo turbulence 0.65 octaves 6 omega 0.7 lambda 2 color_map { [0 rgb 0] [1 rgb 1] } //scale 1/10 } } //------------------------------------------------------------------------------ // FINAL TEXTURES #local HPlanet_GraniteCrackle_texture = texture { function {(HPlanet_Crackle_function(x,y,z).x * 3 + HPlanet_Granite_function(x,y,z).x * 1 + HPlanet_EdgeHeight_function(x,y,z).x * 5)/8 * -1} texture_map { HPlanet_Altitiude_texture_map } #local HPlanet_WarpCount = 0; #local HPlanet_WarpTotal = 100; #while (HPlanet_WarpCount < HPlanet_WarpTotal) #local cylradius = 10; #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 2/6 inverse } #local HPlanet_WarpCount = HPlanet_WarpCount + 1; #end } #local HPlanet_CloudEdge_pigment = pigment { function {(HPlanet_BozoCloud_function(x,y,z).x * 3 + HPlanet_EdgeHeight_function(x,y,z).x * 1)/4 * -1} color_map { HPlanet_BozoCloud_color_map } #local HPlanet_WarpCount = 0; #local HPlanet_WarpTotal = 100; #while (HPlanet_WarpCount < HPlanet_WarpTotal) #local cylradius = 10; #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 2/6 inverse } #local HPlanet_WarpCount = HPlanet_WarpCount + 1; #end } //------------------------------------------------------------------------------ // RINGWORLD #if (Toggle_Ringworld_Object = 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_GraniteCrackle_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 } } // 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} texture { pigment { HPlanet_CloudEdge_pigment #local HPlanet_WarpCount = 0; #local HPlanet_WarpTotal = 1000; #while (HPlanet_WarpCount < HPlanet_WarpTotal) #local sphradius = ring_radius/(ring_width/2); #local sphtheta = rand(HPlanet_Seed_Value) * pi * 2; #local sphphi = rand(HPlanet_Seed_Value) * pi; #local holeradius = rand(HPlanet_Seed_Value) * 1/2; warp { black_hole , holeradius falloff 3/6 strength 2/6 inverse } #local HPlanet_WarpCount = HPlanet_WarpCount + 1; #end } finish {ambient 0 diffuse 1} scale ring_width/2 } } // atmosphere difference { cylinder {<0,ring_width/2,0>, <0,-ring_width/2,0>, ring_radius - 0.00001} 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, <0.1, 0.3, 1.0> * 1000/ring_radius} density { // 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. cylindrical density_map { [0 rgb 1] [atmosphere_height/ring_radius rgb 0] [1 rgb 0] } scale ring_radius } } } } } #end //------------------------------------------------------------------------------ // SUN & HELIOSPHERE #if (Toggle_Sun_Object = true) sphere { 0, sun_radius pigment {rgbt 1} finish {emission 1} hollow interior { media { emission 10/sun_radius density { spherical density_map { [ 0/10 rgb 0] [10/10 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 } } } } sphere { 0, corona_radius pigment {rgbt 1} hollow interior { media { scattering {1, 1/1000} // needs to be divided by corona_radius doesn't it? //emission 1/100 density { function{1/(x*x + y*y + z*z)/corona_radius} density_map { [0 rgb 0] [1 rgb light_color] } 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