POV-Ray : Newsgroups : povray.binaries.images : nebula (72k jpeg) : Re: nebula (72k jpeg) Server Time
1 Aug 2024 22:15:43 EDT (-0400)
  Re: nebula (72k jpeg)  
From: stbenge
Date: 19 Jun 2008 23:06:33
Message: <485b1eb9@news.povray.org>
Roman Reiner wrote:
> Oops, my bad! Actually i wanted to know how you created the nebula itself. That
> would be step 2 then?
> 
> I'm asking because i have some experience with making nebulas in Photoshop and i
> have no problems doing starfields, grain and bloom, but the nebulas itself
> although handpainted never looked as good as in your image. Assuming that you
> made the nebula with produrals too this is quite impressive.
> 
> I hope you can give me some info on this, and sorry again for asking for the
> wrong thing ;)
> 
> Regards Roman

Hi Roman,

Here is the code for the nebula and a few stars. This was rendered over 
an image of a star field, the code for which I have left out. Making a 
star field yourself isn't too hard (though it requires some tweaking to 
look right), and you can place the resulting image behind the nebula 
scene with Rune's illusion.inc file. The density pattern is kept simple 
to reduce render times. Adding turbulence and/or density maps to it can 
make the render times skyrocket. Also, notice how I kept the whole scene 
very small, unit-wise. Media at larger sizes tends to have strange 
artifacts for some reason.

#declare R=seed(005);

camera{
  right x*4/3 up y*1
  location<0,0,-20>
  look_at 0
  angle 10
}

// a macro star object
#macro bright_star(bsrgb)
disc{0,z,1
  pigment{
   pigment_pattern{
    cylindrical rotate x*90
    poly_wave 32
   }
   pigment_map{
    [0 rgb 0 transmit 1]
    [1 rgb bsrgb*2]
   }
   scale 2
  }
  finish{ambient 1 diffuse 0}
  scale .03
  hollow
}
#end
// a few stars placed behind and in front of the nebula
#declare V=0;
#while(V<100)
  object{
   bright_star(<rand(R),rand(R),rand(R)>+1) scale .2+rand(R)*5
   translate<-4+rand(R)*8,-2+rand(R)*4,1.01+rand(R)*2>
  }
  #if(rand(R)>.75)
   object{
    bright_star(<rand(R),rand(R),rand(R)>+1) scale .2+rand(R)*5
    translate<-4+rand(R)*8,-2+rand(R)*4,-1.01-rand(R)*2>
   }
  #end
  #declare V=V+1;
#end

// a light illuminating the nebula
light_source{<2,2.8,0>,10 fade_power 2 fade_distance 1}

// the nebula
box{
  <-3,-2,-1>,<3,2,1>
  pigment{rgbt 1}
  interior{
   media{
    // the overall media density
    #declare thick=40;
    scattering{5,<1,.7,.3>*thick}
    absorption thick-<1,.7,.3>*thick/4
    // change intervals to 1 for testing purposes
    intervals 5
    density{
     granite
     poly_wave 1.5
     translate z*23
     scale 8
     color_map{
      [0 rgb 1]
      [.05 rgb .025]
      [.125 rgb .0025]
      [.5 rgb 0]
     }
    }
   }
  }
  hollow
}

Sam


Post a reply to this message

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