//+KFF240 #include "colors.inc" #include "shapes.inc" #include "textures.inc" #include "metals.inc" #include "glass.inc" #include "stones.inc" #include "skies.inc" #include "axis.inc" /*################## # SETTINGS # ###################*/ //frame counting #declare frames = 690; #declare frame = frames*clock; //starpoint settings (th frame) #declare run_sp = 30; //30 #declare takeoff_sp = 150; //150 -> 120 #declare curve_sp = 370; //120+240 //possition settings #declare pl_y0 = 1; //1: wheels touch the surface #declare pl_z0 = 0; #declare roll0 = 0; //run settings #declare run_v0 = 0; #declare plane_acceleration = 0.005; #declare plane_max_velocity = 6; //takeoff settings #declare elevation_lag = 10; #declare max_height = 100; #declare roll_max = 30; #declare roll_length = 120; //curv settings #declare angle0 = 0; #declare curv_th = 0; #declare pl_ang_max = 45; #declare inclination_length = 60; //propeller settings #declare prop_a = 1; #declare prop_max_v = 66; #declare prop_v0 = 0; //initiation #declare roll = roll0; #declare pl_ang = angle0; /*###################### # CARCULATIONS # #######################*/ //run carculations #declare height = pl_y0; #declare pl_z = pl_z0; #declare plane_velocity = run_v0; #if(frame > run_sp) #declare plane_velocity = plane_acceleration*(frame - run_sp); #end #if(plane_velocity>plane_max_velocity) #declare plane_velocity = plane_max_velocity; #end #declare pl_x = plane_velocity*(frame - run_sp); //takeoff carculations #if(frame>takeoff_sp) #declare roll = roll_max/2 + roll_max/2*sin(pi*((frame-takeoff_sp)/roll_length-1/2)); #if(frame-takeoff_sp>roll_length*2) #declare roll = 0; #end #end #if(frame>takeoff_sp+elevation_lag) #declare height = pl_y0+max_height/2 + max_height/2*sin(pi*((frame-(takeoff_sp+elevation_lag))/(roll_length*2)-1/2)); #if(frame-takeoff_sp>roll_length*2) #declare height = max_height; #end #end //curve carculations #if(frame > curve_sp) #declare curve_x0 = run_v0 * curve_sp + 1/2*plane_acceleration*curve_sp*curve_sp; //angle (X axis) carculations #declare pl_ang = pl_ang_max/2 + pl_ang_max/2*sin(pi*((frame-curve_sp)/inclination_length-1/2)); #if(frame-curve_sp > inclination_length) #declare pl_ang = pl_ang_max; #end #end #if(frame>curve_sp+inclination_length*0.3) //location (X, Z) carculations #declare curv_r = 20; #declare curv_th = pi*(frame-(curve_sp+inclination_length*0.3))/curv_r/6; #declare pl_x = curve_x0 + curv_r*sin(curv_th); #declare pl_z = curv_r-curv_r*cos(curv_th); //direction (Y axis) carculations #declare z_direction = curv_th; #end //propeller carculations #declare prop_velocity = prop_v0 + prop_a*frame; #if(prop_velocity>prop_max_v) #declare prop_velocity = prop_max_v; #end #declare prop_angle = prop_velocity*frame; //last shot cheet #if(frame>600) #declare pl_x = 1000+plane_max_velocity*(frame-600); #declare pl_z = 0; #end /*############################# # CAMERA AND LIGHTING # #############################*/ #declare take0 = 60; //propeller shot #declare take01 = 160; //intact point shoit #declare take1 = 190; //bottom shot #declare take11 = 230; //rear side shot #declare take12 = 330; //pilot shot #declare take2 = 480; //front side shoy #declare take3 = 600; //sky point shot #declare take31 = 640; //aproaching last shot #if(frame look_at angle 50} #end #if(take0 look_at angle 50} #end #if(take01 look_at angle 50} #end #if(take1 look_at angle 50} #end #if(take11 look_at angle 50} #end #if(take12 look_at angle 50} #end #if(take2 look_at angle 50} #end #if(take3 look_at <1000, height, 0> angle 50} #end #if(take31 look_at <1190, height+(frame-take31), 0> angle 50} #end light_source{<10000, 10000, -10000> color White} /*################## # MODELING # ###################*/ #declare airplane = union{ //plane body difference{ sphere{<0, 0, 0>,1 scale x*4 texture{T_Chrome_1C pigment{color Red}} translate y*1} box { <0, 0, -1>, <2, 2, 1> texture{Silver1} translate x*2.5} sphere{<0, 0, 0>,1 scale <1, 1, 0.7> translate <1, 2, 0> texture{Silver1 pigment{color White}}} } //plane propeller cone {<2.5, 1, 0>, 0.8 <2.8, 1, 0>, 0.55 texture {T_Chrome_4B pigment{color Gray20}}} #declare BladeMaterial= intersection{ object{cone{<0,0,0>,1,<1,0,0>,0.8} texture {T_Chrome_1A pigment{color Black}} rotate z*4} object{box{<0,-1,-1>,<1,0,1>} texture {T_Chrome_1A pigment{color Black}}} } #declare Blade = union{ object{BladeMaterial scale <10, 1, 0> translate <1, 0, 0>} object{cone{<0, 0, 0>, 0.2 <10, 0, 0> 0.1 texture {T_Chrome_1A pigment{color Black}}}} } #declare Propeller = union{ #for (i, 0, 2, 1) object{Blade rotate x*-15 rotate z*(i*360/2)} #end object{Sphere scale <1, 1, 1.8> translate <0, 0, 1> texture{Silver1}} } object{Propeller rotate z*prop_angle rotate y*-90 scale 0.16 translate <3, 1, 0>} //plane front glass intersection{ difference{ sphere{<0, 0, 0>,1 scale <1, 1, 0.7> translate <1.1, 1.4, 0> texture{T_Old_Glass}} sphere{<0, 0, 0>,1 scale <1, 1, 0.7> translate <1.1, 1.4, 0> scale 0.99 texture{T_Old_Glass}} } cone {<-1, 0, 0>, 1, <1, 0, 0>, 1 scale <1, 0.5, 0.7> rotate z*30 translate <2, 2, 0> material{M_Dark_Green_Glass}} } //plane wings #declare wing = object{cone{<0, 1,0>,1,<0,1,1>,0.5} scale <1.2, 0.1, 5> texture{T_Copper_4B pigment{color Red}} } #declare wings = union{ object {wing} object {wing rotate y*180} } object{wings translate <1,0.5,0>} object{wings translate <1,2.9,0>} object{wings scale 0.5 translate<-3,1.2,0>} object{wing scale 0.5 rotate x*270 translate<-3,1,0> } //plane wing bars #declare bar = cone {<0, 0, 0>, 1 <0, 1, 0>, 1 scale <0.05, 2.4, 0.05> texture{Silver1}} object{bar translate <1.6, 0.6, 2>} object{bar translate <0.6, 0.6, 2>} object{bar translate <1.6, 0.6, -2>} object{bar translate <0.6, 0.6, -2>} //plane wheels #declare wheel = union{ cone{<0, -0.7, -0.1> 0.3, <0, -0.7, 0.1> 0.3 pigment{color Gray20}} cone{<0, -0.7, -0.2> 0.1, <0, -0.7, -0.1> 0.2 texture{Silver1}} cone{<0, -0.7, 0.2> 0.1, <0, -0.7, 0.1> 0.2 texture{Silver1}} } object{wheel translate z*-1.4 translate x*1.3} object{wheel translate z*-1.4 rotate y*180 translate x*1.3} object{wheel translate x*-2.5} //plane wheel bars #declare wheelbar = cone {<0, 0, 0>, 0.05 <0, -1.5, 0>, 0.05 pigment{color Black}} #declare wheelbars = union{ object{wheelbar rotate <30, 0, -15> translate< 0.35, 0.5, -0.6>} object{wheelbar rotate <30, 0, 15> translate<-0.35, 0.5, -0.6>} } object{wheelbars translate x*1.3} object{wheelbars rotate y*180 translate x*1.3} object{wheelbar rotate <15, 0, -30> translate <-1.8, 0.5, 0.5>} object{wheelbar rotate <15, 180, -30> translate <-1.8, 0.5, -0.5>} //pilot #declare pilot = union { //pilot head object{sphere{<0, 1, 0>, 0.9} pigment{color Yellow}} cone {<-1, 0, 0>, 1 <1, 0, 0>, 0 scale x*1.5 pigment { color OrangeRed } scale 0.3 translate <0.8, 0.6, 0> } //pilot cap difference{ sphere {<0, 1, 0>, 1 pigment{color BakersChoc}} box { <0, 0, -1> <1, 1, 1> pigment { color Black }} } intersection{ difference{ cone {<0, 0, 0>, 1 <0, 1, 0>, 1 pigment { color BakersChoc }} cone {<0, 0, 0>, 1 <0, 1, 0>, 1 scale 0.9 pigment { color BakersChoc }} } cone {<0, 1, -1>, 1 <0, 1, 1>, 1 scale x*0.5 pigment { color Orange }} } cone {<0, -1, 0>, 1 <0, 1, 0>, 1 scale <1.01, 0.1, 1.01> translate y*1.1 pigment { color Black }} //pilot glasses #declare glass = union{ difference{ cone {<-1, 0, 0>, 1 <1, 0, 0>, 1 texture{Silver1}} cone {<-2, 0, 0>, 1 <2, 0, 0>, 1 scale 0.8 texture{Silver1}} } cone {<-1, 0, 0>, 1 <1, 0, 0>, 1 scale <0.6, 0.8, 0.8> pigment { color SummerSky }} scale <0.2, 0.6, 1> } #declare glasses = union{ object{glass rotate y*15 translate z*-1 } object{glass rotate y*-15 translate z*1 } } object{glasses scale 0.4 translate <0.9, 1.1, 0> } //pilot scarf #declare th = pi*frame*1.2; #declare p1 = 0.2*sin(th); #declare p2 = 0.4*sin(th+pi/2); #declare p3 = 0.6*sin(th+2*pi/2); bicubic_patch{ type 1 flatness 0 u_steps 4 v_steps 4 <0,0,0>,<1,1,p1>,<2,2,p2>,<3,0,p3> <0,0,0>,<1,1,p1>,<2,2,p2>,<3,1,p3> <0,1,0>,<1,2,p1>,<2,3,p2>,<3,2,p3> <0,1,0>,<1,3,p1>,<2,3,p2>,<3,3,p3> pigment{checker White, Cyan scale 0.5} //finish{phong 1 reflection 0.2} //translate <-1.5,-1.5,0> scale y*0.3 rotate y*180 translate <0,0.5,1> } } object{pilot scale 0.5translate <0.7, 1.5, 0>} } //Wind Turbins #declare BladeMaterial= intersection{ object{cone{<0,0,0>,1,<1,0,0>,0.3} texture {Silver1} rotate z*4} object{box{<0,-1,-1>,<1,0,1>} texture{Silver1}} } #declare Blade = union{ object{BladeMaterial scale <20, 1, 0> translate <1, 0, 0>} object{cone{<0, 0, 0>, 0.2 <21, 0, 0> 0.1 texture{Silver1}}} } #declare Propeller = union{ #declare i = 0; #declare n = 3; #while (i translate <0, 0, 1> texture{Silver1}} } #declare Nacelle = intersection{ object{Cube scale <0.8, 0.8, 2> texture{ Silver1 }} object{Sphere scale <1, 1, 2> texture{ Silver1 }} } #declare Tower = union{ object{Nacelle} object{cone{<0, -38, 0>, 0.8, <0, 0, 0>, 0.4 texture{ Silver1 }}} } #declare WindTurbine = union{ object{Propeller rotate z*frame*0.3 translate <0, 0, -2.2>} object{Tower} } #if(frame} #end #end object{airplane rotate translate} //x axis: pitch //y axis: yaw //z axis: roll //gas emission //sphere{<0, 1, 0> 1 scale <1, 0.5, 0.5> pigment{White}} //earth surface object{Plane_XZ pigment{dents color_map{[0 YellowGreen][0.5 LimeGreen]} scale 1}} //object{Plane_XZ pigment{checker White Green scale 4}} //takeoff road box { <-20, 0, -5>, <160, 0.01, 5> texture {T_Grnt18a}} #for(i, -15, 160, 10) box { , pigment{White}} #end sky_sphere{ S_Cloud1 pigment { gradient y color_map { [0.0 color rgbt<1, 1, 1, 0.8>] [0.2 color rgbt<0.1, 0.3, 1, 0.6>] } } }