POV-Ray : Newsgroups : povray.text.scene-files : Clumpy star field Server Time
31 Oct 2024 21:22:25 EDT (-0400)
  Clumpy star field (Message 1 to 1 of 1)  
From: Mike Williams
Subject: Clumpy star field
Date: 2 Jun 2005 03:07:40
Message: <U8MJRJARqqnCFwr2@econym.demon.co.uk>
See "'Artistic' Starfield" in povray.binaries.images.

This code produces an image that's identical to the last image that I
posted, but I've removed an inefficiency that I discovered when I was
making the code more presentable, and it renders twice as fast.



// ==================================================================  
//
// Clumpy Star field
// Author: Mike Williams
// Date: 1-Jun-2005
//
// The basic trick is that the stars are scattered randomly
// across the field of view, but some of them are obscured by
// dark nebulae which leave small clumps of stars and gas cloud
// visible through the holes.
//
// This sort of thing sometimes happens with real star patterns.
//
// ==================================================================

#version 3.6;
global_settings {assumed_gamma 1.0}
camera {location  <0,0,-10> look_at <0,0,0> angle 50}

// no light_source necessary

// ==================================================================

#declare Ang=30;                 // Adjust if the camera angle changes
#declare RR=seed(1234);          // Gives different star patterns
#declare NebulaRot = <-15,7,0>;  // Gives different nebula patterns

// The colour of the gas clouds
sky_sphere {
  pigment {
   bozo
    colour_map {
      [ 0.1 rgb <0.05,0.05,0.2>]
      [ 0.9 rgb <0.2,0.05,0.05>]
    }
  warp {turbulence 1}
  scale 0.3
  rotate NebulaRot
  }
} 

// A layer of 5000 spherical stars at distance 104
#declare N=0;
union {
  #while (N<5000)
    sphere {104*z, 0.2*rand(RR)
      rotate <Ang*2*rand(RR)-Ang,Ang*2*rand(RR)-Ang,0>}
    #declare N=N+1;
  #end
  pigment {rgb 1.5}
  finish {ambient 1}
}

// A dark nebula that obscures the spherical stars
sphere {0,102
  pigment {
    leopard
    colour_map {
      [0.1 rgbt <0,0,0,0.0>]
      [0.4 rgbt <0,0,0.0,1.0>]
    }
    warp {turbulence 0.8 omega 0.7}
    scale 15
    rotate NebulaRot
  }
  finish {ambient 1}
}

// A layer of smaller spherical stars at distance 100
#declare N=0;
union {
  #while (N<50000)
    sphere {100*z, 0.05*rand(RR)
      rotate <Ang*2*rand(RR)-Ang,Ang*2*rand(RR)-Ang,0>}
    #declare N=N+1;
  #end
  pigment {rgb 1.5}
  finish {ambient 1}
}

// A dark nebula that lets some light through the dark bits
// The pattern is the same as the first nebula, but it lets more
// light shine through, so we get just the small stars
// in the dark parts
sphere {0,98 pigment {
  leopard
  colour_map {
    [0.1 rgbt <0,0,0,0.15>]
    [0.4 rgbt <0,0,0,1.0>]
    }
  warp {turbulence 0.8 omega 0.7}
  scale 15
  rotate NebulaRot
  }
 finish {ambient 1}
}


Post a reply to this message

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