	

// Persistence of Vision Ray Tracer Scene Description File
// File: rocket nozzle.pov
// Vers: 3.5
// Desc: example of a rocket nozzle and supersonic exhaust
// Date: 2004.139
// Auth: Bob Hughes
// Mail: omniverse [at] charternet
// Note: plume expands to mimic going from atmosphere to vacuum of space
// Free: use as needed, no credit necessary


global_settings {
assumed_gamma 1
}

camera {
 location <0,0,-15>
 angle 50
 look_at 2*x
}

light_source {
 -1000*z,
 1
 rotate <30,-30,0>
}

plane {z,100
 pigment {
  hexagon color rgb 1, color rgb 0.5, color rgb 0
  rotate 90*x scale 10
 }
 hollow
}

/* Rocket Nozzle */

#declare N=
function {

(sin(0.667*pow(x,4))-pow(1.04*pow(x,2),1.12)-pow(y,2)-pow(z,2)+0.4)-0.0333*x
}

#declare Nozzle=
isosurface {
 function {
  abs(N(x,y,z))-0.03
 }
 contained_by {
  box {<-1.4,-0.75,-0.75>,<-0.125,0.75,0.75>}
 }

 max_gradient 2
 //all_intersections
 texture {
  pigment {
   gradient x
   color_map { // nozzle's heated colors
    [0 color rgb 0.5]
    [0.3 color rgb <5,0.5,0>]
    [1 color rgb <8,5,0.5>]
   }
   scale 1.1
  }
  normal {
   gradient x 0.6 scallop_wave scale 0.05
  }
  finish {
   ambient 0.05 diffuse 0.3 specular 0.5 roughness 0.01
  }
 }
 scale <1.5,1,1> //translate x
}

/* Exhaust Plume */

#declare S=
density {
 function {N(x,y,z)}//spherical
 density_map {
  [0 rgb 0]
  [0.0125 rgb <0.1,0.3,0.9>]
  [0.1 rgb <0.1,0.3,0.9>*0.02]
  [0.6 rgb <0.1,0.3,0.9>*0.06]
  [1 rgb <0.1,0.3,0.9>]
 }
 translate -x/6
}

#declare GS=
density {
 gradient x
 density_map {
  [0 S]
  [0.5 rgb 0]
 }
}

#declare C=
density {
 cylindrical
 density_map {
  [0.1 rgb 0]
  [0.25 rgb <0.9,0.3,0.6>*0.25]
  [0.5 rgb <0.9,0.3,0.6>*2]
  [0.75 rgb <0.9,0.3,0.6>*0.25]
  [0.9 rgb 0]
 }
 poly_wave 0.8
 warp {turbulence <0.2+0.1*clock,0,0.2+0.1*clock>}
 warp {repeat y/4 flip y}
 warp {turbulence <0.2,0,0.2>*clock}
 scale <1/3-0.15*clock,1/3,1/3-0.15*clock> //rotate 90*z
}

#declare G=
density {
 gradient y
 density_map {
  [0.1 rgb 0]
  [0.2 rgb 0.05]
  [0.5 C]
  [0.6 C]
  [0.8 rgb 0.05]
  [0.9 rgb 0]
 }
 poly_wave 0.4 frequency 8
}

#declare GC=
density {
 cylindrical
 density_map {
  [0.25 rgb 0]
  [0.75 G]
  [1 rgb 0]
 }
 rotate 90*z
}

#declare X=
function(x) {x}


#declare Exhaust=
sphere {
 0,1
 scale <0.5,1,1> translate -0.5*x
 pigment {
  color rgbt 1
 }
 interior {
  media {
   samples 15
   emission 1.5
   density {
    function {abs(X(x))}
    density_map {
     [0 rgb 0]
     [0.5 GC]
     [0.75 GS]
    }
   }
  }
  media {
   samples 15
   absorption 0.5
   density {
    function {abs(X(x))}
    density_map {
     [0 rgb 0]
     [0.5 GC]
     [0.75 GS]
    }
   }
  }
 }
 scale <12,1.5+1.5*clock,1.5+1.5*clock> translate <11.2+0.4*clock,0,0>
 hollow
}

/* Finished Nozzle */

union {
 object {
  Nozzle
 }
 object {
  Exhaust
 }
 translate -3*x
 rotate 75*clock*y
}


