POV-Ray : Newsgroups : povray.text.scene-files : Galaxy? Server Time
31 Oct 2024 16:16:23 EDT (-0400)
  Galaxy? (Message 1 to 1 of 1)  
From: Nekar Xenos
Subject: Galaxy?
Date: 27 May 2006 19:00:15
Message: <4478d9ff@news.povray.org>
// My galaxy stuff

#include "math.inc"
#include "transforms.inc"

#declare MaxRadius= 1;
#declare Angle= 0;
#declare Radius=1;
#declare 
Position=<.1*(clock),1-(2*(clock)*(1-clock)),9-(clock*clock*10)>;//<0,0,-1>;
#declare Counter=0;

#declare Anim=off;
#declare ShowShip=on;
#declare PosLook=Position;

#declare Rotation=z*(90-clock*90);//0 ;// y*(clock*90)
#declare Quality = 2; // 0=Dummy  // 1=Basic  // 2=Full Detail


#declare Cam_Spline = spline {
                           cubic_spline

                           -2, <0, -1, -6>, // control point
                           -1, <0, -.11, -5>, // control point

                           00, < 0, -.01, -4>, // start below ship
                           01, < 0, 0, -2.21>, // behind ship

                           02, < -1, .99, -1.01>, //
                           03, < -.5, .1, -.51>,
                           04, < -.5, .1, -.01>, //
                           05, <0, -.05, .49>, //

                           06, < 0, .01, 0>, // control point
                           07, < 0, -2, 0>, // control point

                        }



#declare Ship_Spline = spline {
                           cubic_spline

                           -2, <0, 0, -6>, // control point
                           -1, <0, 0, -5>, // control point

                           00, < 0, 0, -4>, // start
                           01, < 0, 0, -2>,

                           02, < -1, 1, -1>, //
                           03, < -.5, .1, -.5>,
                           04, < -.5, .1, 0>, //
                           05, <0, -.05, .5>, //

                           06, < 0, 0, 0>, // control point
                           07, < 0, -3, 0>, // control point

                        }


/*
Spline_Trans(Spline, Time, SkyVector, ForeSight, Banking)

This macro aligns an object to a spline for a given time value. The Z axis of 
the object will point in the forward direction of the spline and the Y axis of 
the object will point upwards.
Parameters:

Spline = The spline that the object is aligned to.
Time = The time value to feed to the spline, for example clock.
Sky = The vector that is upwards in your scene, usually y.
Foresight = A positive value that controls how much in advance the object will 
turn and bank. Values close to 0 will give precise results, while higher values 
give smoother results. It will not affect parsing speed, so just find the value 
that looks best.
Banking = How much the object tilts when turning. The amount of tilting is 
equally much controlled by the ForeSight value.
Usage:

   object {MyObj Spline_Trans(MySpline, clock, y, 0.1, 0.5)}



*/
#declare DenStars=density {crackle scale.003 warp{black_hole 0,1 strength .2} 
density_map{[.1 rgb .5][.3 rgb 1][.9 rgb 1][1 rgb 10]}}

#declare DenStars2=density {crackle scale.01 warp{black_hole 0,1 strength 1} 
density_map{[.1 rgb .8][.2 rgb 1][.5 rgb 2][1 rgb 10]}}

#declare DenSphere=
  density {
    spherical
    turbulence .1
    omega .7
    lambda 3
    density_map {
      [0 color rgb 0]
      [0.5 color rgb <0.01, 0.1, 0.4>/4]
      [0.6 color rgb <0.1, 0.3, 0.5>/2]
      [0.7 color rgb <1.0, 0.5, 0.5>/2]
      [0.8 color rgb <1.0, 0.8, 0.5>]
      [1.0 color rgb 1]
    }
  }

#declare DenSphere2=
  density {
    spherical
    omega .7
    lambda 2
    density_map {
      [0.5 color rgb 0]
      [0.6 color rgb <0.01, 0.1, 0.4>/4]
      [0.65 color rgb <0.1, 0.3, 0.5>/4]
      [0.7 color rgb <1.0, 0.5, 0.5>/2]
      [0.8 color rgb <1.0, 0.9, 0.5>]
      [1.0 color rgb 1]
    }
  }

#declare DenSphere3=
  density {
    spherical
    turbulence .5
    omega 1
    lambda 2
    density_map {
      [0.5 color rgb 0]
      [0.6 color rgb <0.01, 0.1, 0.4>/4]
      [0.65 color rgb <0.1, 0.3, 0.5>/4]
      [0.7 color rgb <1.0, 0.5, 0.5>/2]
      [0.8 color rgb <1.0, 0.9, 0.5>]
      [1.0 color rgb 1]
    }
  }

#declare DenSpiral=
  density {
    spiral1 1
    //warp{black_hole <.001,0,.001>,.5 strength 1 falloff 3 inverse}
    turbulence .1 omega .7
    lambda 2
    colour_map {
      [0  color rgb 0]
      [0.1 color rgb <0.01, 0.1, 0.3>]
      [0.4 color rgb <0.1, 0.3, 0.5>]
      [0.7 color rgb 1]
      [0.8 color rgb <0.1, 0.3, 0.5>]
      [0.9 color rgb <0.01, 0.1, 0.3>]
      [1 color rgb 0]
    }
  }

#declare DenSpiral2=
  density {
    spiral1 25  scale.1
    //warp{black_hole 0,.2 strength 1.01 falloff .01 inverse}
    turbulence .2
    //lambda 2
    omega .8
    colour_map {
      [0.0 color rgb 0]
      [0.1 color rgb 1]
      [0.7 color rgb 2]
      [0.9 color rgb 1]
      [1.0 color rgb 0]

    }
  }


#declare DenSpiral3=
  density {
    spiral1 1
    warp{black_hole 0,.5 strength 1 falloff 3 inverse}
    turbulence .1 omega .5
    lambda 1
    colour_map {
      [0.2 rgb 0]
      [0.23 rgb .5]
      [0.3 rgb 0]

    }
  rotate x*90
  }


#declare DenSpiral4=
  density {
    spiral1 10  scale.1
    //warp{black_hole 0,.2 strength 1.01 falloff .01 inverse}
    turbulence .2
    //lambda 2
    omega .8
    density_map {
      [0.2 color rgb 0]
      [0.3 color rgb 2]
      [0.4 color rgb 0]

    }
  rotate x*90
  }


#declare ColSpiral=
  pigment {
    spiral1 1
    //warp{black_hole <.001,0,.001>,.5 strength 1 falloff 3 inverse}
    turbulence .1 omega .7
    lambda 2
    colour_map {
      [0 color rgbt <0,0,0,1>]
      [0.1 color rgbt <0.01, 0.1, 0.3,.9>]
      [0.4 color rgbt <0.1, 0.3, 0.5,.5>]
      [0.7 color rgb <1,1,1,.1>]
      [0.8 color rgbt <0.1, 0.3, 0.5,.5>]
      [0.9 color rgbt <0.01, 0.1, 0.3,.9>]
      [1 color rgbt <0,0,0,1>]
    }
  }

#declare SpaceShip =
union{   // space ship
        difference{
                union{
                      sphere{0,1 scale <.2,.2,2>  pigment{colour rgbt 
<0,0,0,clock>}normal{bozo clock*2 scale.3 phase clock}finish {reflection 
1-clock } interior{ior(1.5-(clock/2))}}



                      }
                sphere{0,1 scale <.2,.2,.5> pigment{colour rgbt 1} 
 translate -2*z }
                sphere{0,1 scale <.2,.2,.5> pigment{colour rgbt <0,0,1,.9>} 
translate 2*z}
                interior {fade_power 1001  fade_distance .1  fade_color <0, 1, 
1> }
                }
        sphere{0,1 scale <.1,.1,.05>
                pigment{colour rgbt <0,.5,1,.9>}
                normal{bozo 10 scale .01 turbulence .1 phase clock}
                finish {reflection{0,<.8,.9,1>}}
                interior {fade_power 1001  fade_distance .15  fade_color <0, 
.5, 1> }
                translate 1.6*z
                 }
        sphere{0,1 scale <.12,.12,.12>
                pigment{colour rgbt 1}
                interior {fade_power 1001  fade_distance .1  fade_color <0, .5, 
1.5> }
                translate 1.6*z
                 }
        torus{.9,.1 scale .12 rotate x*90 translate 1.6*z pigment{colour rgb 
.1}finish {reflection 1 }}

        //sphere {0,1 scale <.3,.3,2.1>pigment{colour rgbt 
<0,0,0,clock>}normal{bozo .1 phase clock} finish{reflection clock} }

        light_source {1.6*z  color rgb <1,3,3>*(1-clock)  fade_power 1001 
fade_distance .1*(1-clock) }
        //scale .05
        //rotate <-90,15,0>

        //translate Position - ((Position-PosLook)*.1)+(z*.01*clock)
        }



camera {location <0,.5,-2> rotate z*-30 look_at <0,0,0>}



#if(Quality = 0)

        #declare SpaceShip =
        union{   // space ship
                difference{
                        union{
                              sphere{0,1 scale <.2,.2,2>  pigment{colour rgb 
<2,0,2>}finish {ambient <2,0,2>}}



                              }
                        sphere{0,1 scale <.2,.2,.5> pigment{colour rgb 
<0,0,10>} finish {ambient <0,1,2>} translate -2*z }
                        sphere{0,1 scale <.2,.2,.5> pigment{colour rgb 
<0,0,10>} finish {ambient <0,1,2>} translate 2*z}

                        }

                }

#end // Quality = 0


#if(Quality=2) // full detail

sky_sphere {
  pigment {

    crackle scale .01

    //turbulence 10
    //omega .1
    //lambda 25

    color_map {
      [0.6 color rgb 0]
      [0.7 color rgb <0.01, 0.1, 0.4>/5]
      [0.8 color rgb <0.1, 0.3, 0.5>/4]
      [0.9 color rgb <1.0, 0.5, 0.5>/2]
      [0.95 color rgb <1.0, 0.9, 0.5>]
      [1.0 color rgb 1]
    }

  }
}


sphere{ // surrounding stars
        0,100 pigment {rgbt 1}
        interior {
          media {
           emission 1
           method 3
                                density {crackle scale .001
                                         warp{black_hole 0,100 strength .3}
                                         density_map {
                                                      [0.83 color rgb 0]
                                                      [0.87 color rgb <0.01, 
0.1, 0.4>/5]
                                                      [0.9 color rgb <0.1, 0.3, 
0.5>/4]
                                                      [0.93 color rgb <1.0, 
0.5, 0.5>/2]
                                                      [0.97 color rgb <1.0, 
0.9, 0.5>]
                                                      [1.0 color rgb 1]
                                                    }
                                    }
                                }
                  }
         hollow
         }



sphere {0, 1
         texture {
          pigment {rgbt 1}
                 }
         interior {
          media {
           emission 10
           //scattering {1, 0.1}
           //intervals 1
           //samples 5
           method 3
           density {DenSpiral   rotate x*90 translate y*.05}
                  density {DenSpiral2  rotate x*90 translate y*.05}
                  density {DenSphere   scale y*.1}
                  density {DenStars}
                  density {spherical density_map{[0 rgb .1][1 rgb 1]} scale 
<1.5,.1,1.5>}
                  //scale <1,1,1>
                  }
                  media { emission 1 method 3  density {DenSphere2 scale y*.3} 
density{DenStars}}
                  media { emission 2 method 3  density {DenSphere2 scale .4} 
density{DenStars}}
                  media { emission 1 method 3  density {DenSphere3 scale .1} 
density{DenStars2}}
                  /*
                  media {
           absorption 5
           //emission <0,100,0>
           //scattering {1, 0.1}
           //intervals 1
           //samples 5
           method 3
           density {DenSpiral3  rotate z*0 translate y*.05}
                  density {DenSpiral4  rotate z*0 translate y*.05}
                  //density {DenSphere scale y*.1}
                  //density {DenStars}
                  density {spherical density_map{[.5 rgb 0][.8 rgb 1][.9 rgb 
0]} scale <1.5,.1,1.5>}
                  //scale <1,1,1>
                  }
                  */
                 }
         hollow

         rotate Rotation
                }

#end // #if(Quality=2) // full detail

#if(Quality=1) // Basic
        sphere {0, 1
         texture {
          pigment {rgbt 1}
                 }
         interior {
          media {
           emission 10
           method 3
           density {DenSpiral   rotate x*90 translate y*.05}
                  density {spherical density_map{[0 rgb 0][1 rgb .5]} scale 
<1,.1,1>}
                  }

                 }
         hollow
         rotate Rotation
         }

#end // #if(Quality=1) // Basic

#if(Quality=0) // Dummy

    sphere {0, 1 scale y*.1
         texture {
          pigment {ColSpiral   rotate x*90 translate y*.05}
                 }
         finish{diffuse 1 ambient 1}
         rotate Rotation
         }

#end // #if(Quality=0) // Dummy



//light_source {<500,500,-500> rgb 1}



        /*
        #if (clock <.5)
                #declare PosLook=Position;
                #declare Position=<clock/2,clock*.03,(1-clock)*2>; // 
2/Final_Frame
                #declare Radius=Position.x;

                camera {location Position rotate z*(-90*(1-clock)) look_at 
PosLook*.9999}
        #end

         #if (clock >=.5)
                #declare PosLook=Position;
                #declare Angle=Angle+2;
                #declare Radius=Radius-(1/13);
                #declare 
Position=<Radius*(sin(radians(Angle))),clock*.03,Radius*(cos(radians(Angle)))>;

                camera {location Position rotate z*(-90*(1-clock)) look_at 
PosLook*.9999}

          #end
          */

           #declare PosLook=Position;
                #declare Angle=Angle+2;
                #declare Radius=Radius-(1/13);
                #declare 
Position=<Radius*(sin(radians(-Angle))),clock*.3,2*(1-clock)*Radius*(cos(radians(-Angle)))>;
        #if (Anim)
                camera {location Position rotate z*(-90*(1-clock)) look_at 
PosLook*.9999}


        #if (clock=1)
                #declare Anim=off;
        #end

 #end


//object{SpaceShip scale .05 translate Position - 
((Position-PosLook)*.1)+(z*.01*clock)}

#if (Anim)
        //#if (ShowShip)
        //        object { SpaceShip pigment{colour rgb 1000} scale .03 
Spline_Trans (Ship_Spline,clock*7 , y, 0, 0) }
        //#end

        camera {
              location  Cam_Spline(clock*7)   // 0 //
              //look_at <-.01,-.3,.9>
              //translate 
<.1*(1-clock),(2*(1-clock)*(1-clock))-1,(clock*clock*4)-3>
              //rotate (90*z)+(z*clock*(90/final_frame))
              look_at  0//<-.01,-.3,.9> //
              //translate  <0,0.4,0.4>

              //Spline_Trans (Ship_Spline, clock*6.5, y, .5, .5)

              //look_at Ship_Spline(clock*7)
           }
#end //  #if (Anim)


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.