#include "colors.inc" #include "stars.inc" #include "screen.inc" #include "finish.inc" global_settings { assumed_gamma 1.0 } #declare framepertime = 200;//need this, ini values are not passed! // frequencies are in rotations per unit time #declare omega_earth_rotate = -5*360; #declare omega_mars_rotate = -4*360; #declare reo=1; // radius of earth's orbit #declare rmo=1.52*reo; // radius of mars' orbit #declare omega_earth_orbit = 1; #declare omega_mars_orbit = omega_earth_orbit*pow((reo/rmo),1.5);//ala kepler #declare ssize=.06*reo; // sun radius #declare esize=.6*ssize; // earth radius #declare msize=1*esize; // mars radius #declare phaser = function(time,f,delta) { (time*f+delta)*2*pi } #declare t_offset = -1;// initial time phase relative to retrograde #declare localtime=clock+ t_offset; #declare epx = reo*cos(phaser(localtime,omega_earth_orbit,0)); #declare epz = reo*sin(phaser(localtime,omega_earth_orbit,0)); #declare mpx = rmo*cos(phaser(localtime,omega_mars_orbit,0)); #declare mpz = rmo*sin(phaser(localtime,omega_mars_orbit,0)); #macro Make_Earth (tt) sphere {0,1 //basic earth, possibly transparant texture { pigment { agate color_map { [0.0 color rgbt <.05,.05,.4,tt> ] [0.4 color rgbt <.2,.1,.1,tt> ] [1.2 color rgbt <.7,.7,.7,tt> ] } turbulence .3 } finish { ambient 1.0 diffuse 0.0 } } scale esize } #end #macro Make_Mars (tt) sphere {0,1 //basic mars, possibly transparant texture { pigment { agate color_map { [0.0 color rgbt <.2,.1,.05,tt> ] [0.4 color rgbt <.2,.15,.10,tt> ] [1.2 color rgbt <.1,.08,.05,tt> ] } turbulence .7 } finish { ambient 1.0 diffuse 0.0 } }texture { pigment { cylindrical color_map { [0.0 color rgbt <.2,.15,.10,1> ] [.78 color rgbt <.4,.4,.4,tt> ] [.80 color rgbt <.9,.9,.9,tt> ] } turbulence .1 } finish { ambient 1.0 diffuse 0.0 } } scale msize } #end #declare sun = union{ /* sphere {0,ssize //sun texture { pigment { color rgb <.8,.8,0>} finish { ambient 1.0 diffuse 0.0 } } */ sphere { 0.0, 1 #declare scolor=<1,.7,.5>; texture { pigment { spotted turbulence 8 color_map { [0.00 color rgb scolor ] [0.80 color rgb scolor ] [0.95 color rgb scolor*0 ] [1.00 color rgb scolor*0 ] } scale 1.1 } finish{ specular 0.6 ambient 1.2 } } no_shadow } sphere { 0,1 pigment { rgbt 1 } hollow interior { media { emission 1 density { spherical density_map { [0 rgb 0] [0.4 rgb <1,0,0>] [0.8 rgb <1,1,0>] [1 rgb 1] } } } } scale 1.2 } scale ssize } #declare solarsys1 = union{ object{sun scale 1.5} object{ Make_Earth (0) rotate y*omega_earth_rotate*localtime scale 2 translate (epz*z+epx*x) } object{ Make_Mars (0) rotate y*omega_mars_rotate*localtime scale 2 translate (mpz*z+mpx*x) } torus { rmo, 0.02 //mars' orbit pigment { color rgb .8*<1,.4,.41>} finish {ambient .4 diffuse 0.0 }} torus { reo, 0.02 //earth' orbit pigment { color rgb .8*<.4,.4,1> } finish {ambient .4 diffuse 0.0 } } cylinder{-1.4*ssize*y,-1.42*ssize*y,3.2 pigment{Gray*.1}} // some cues #declare mycue="prograde"; #declare cuepig=pigment{Green}; #if(abs(localtime)<.25) #declare mycue="retrograde"; #declare cuepig=pigment{Red}; #end text { ttf "crystal.ttf", mycue, .01, 0 pigment{cuepig} finish{Luminous} rotate x*90 translate -8*x-2.8*z } #declare srad=3; #declare ev=epz*z+epx*x; #declare mv=mpz*z+mpx*x; #declare d=mv-ev; #declare a=vdot(d,d); #declare b=2*vdot(ev,d); #declare c=vdot(ev,ev)-srad*srad; #declare lmd=(-b+sqrt(b*b-4*a*c))/(2*a); #declare plocate=ev+lmd*d; #declare plocate=plocate/vlength(plocate)*3; union{ cylinder{ev, plocate,.02} sphere{plocate .06 } torus { srad, 0.02 } pigment{Gray*.2} finish{Luminous} } } #declare solarsys2 = union{ object{sun} object{ Make_Mars (0) rotate y*omega_mars_rotate*localtime translate (mpz*z+mpx*x) } //make ghosts for trail #declare nghostmax=5; #declare step = 5; #declare i=1; #declare nghost=min(frame_number/step,nghostmax); #while(i <= nghost) #declare fframe = (int(frame_number/step)-i+1)*step; #declare ftime = (fframe-1)/framepertime+t_offset; #declare mpxg = rmo*cos(phaser(ftime,omega_mars_orbit,0)); #declare mpzg = rmo*sin(phaser(ftime,omega_mars_orbit,0)); object{ Make_Mars (i/nghost) rotate y*omega_mars_rotate*ftime translate (mpzg*z+mpxg*x) } #declare i=i+1; #end } object{ solarsys2 } Set_Camera_Location(epz*z+epx*x) Set_Camera_Look_At(mpz*z+mpx*x-1.2*msize*y) Set_Camera_Angle(75) Screen_Object ( object{solarsys1 scale 1.8 rotate -90*x translate 4*(5*z+2.6*x-1.5*y) }, <0,.00>, .0, false ,1) sky_sphere { // rgb - Red Green Blue color shortcut pigment{color rgb 0*<0.1, 0.1, 0.1>} //finish { diffuse 0 ambient 1 } } // we need CONSTELLATIONS! #declare T2=3; #declare cel_sphr_rad=40; #declare stars=union{ #declare ra=0; #declare dec=0; #declare mag=0; #declare con="aaa"; #fopen MyFile "decimal_yale.csv" read #read (MyFile,ra,dec,mag,con) #declare star_origin=cel_sphr_rad*(z); #declare altitude_axis=vcross(star_origin,y); #declare altitude_axis=altitude_axis/vlength(altitude_axis); #while (mag<=6) sphere { star_origin, 0.0075*(1-mag/7)*cel_sphr_rad texture{ pigment{color rgb 1*(1-mag/7)} finish{ambient 2 diffuse 0} } rotate altitude_axis*dec //rotate towards y for "altitude" like declination rotate -y*ra //right ascension in a left handed coord system... } #read (MyFile,ra,dec,mag,con) #end #fclose MyFile /**//**/ }; #declare lat=23.5; #declare hour=0; object { stars rotate y*hour rotate x*lat}