#declare expdense = density{
spherical
density_map{
[ 0 rgb 0.000136 ]
[ 0.01 rgb 0.000151 ]
[ 0.02 rgb 0.000168 ]
[ 0.03 rgb 0.000187 ]
[ 0.04 rgb 0.000208 ]
[ 0.05 rgb 0.000231 ]
[ 0.06 rgb 0.000256 ]
[ 0.07 rgb 0.000285 ]
[ 0.08 rgb 0.000316 ]
[ 0.09 rgb 0.000352 ]
[ 0.1 rgb 0.000391 ]
[ 0.11 rgb 0.000434 ]
[ 0.12 rgb 0.000482 ]
[ 0.13 rgb 0.000536 ]
[ 0.14 rgb 0.000596 ]
[ 0.15 rgb 0.000662 ]
[ 0.16 rgb 0.000735 ]
[ 0.17 rgb 0.000817 ]
[ 0.18 rgb 0.000908 ]
[ 0.19 rgb 0.001009 ]
[ 0.2 rgb 0.001121 ]
[ 0.21 rgb 0.001246 ]
[ 0.22 rgb 0.001384 ]
[ 0.23 rgb 0.001538 ]
[ 0.24 rgb 0.001709 ]
[ 0.25 rgb 0.001899 ]
[ 0.26 rgb 0.002110 ]
[ 0.27 rgb 0.002345 ]
[ 0.28 rgb 0.002606 ]
[ 0.29 rgb 0.002896 ]
[ 0.3 rgb 0.003218 ]
[ 0.31 rgb 0.003576 ]
[ 0.32 rgb 0.003975 ]
[ 0.33 rgb 0.004417 ]
[ 0.34 rgb 0.004909 ]
[ 0.35 rgb 0.005456 ]
[ 0.36 rgb 0.006064 ]
[ 0.37 rgb 0.006740 ]
[ 0.38 rgb 0.007492 ]
[ 0.39 rgb 0.008328 ]
[ 0.4 rgb 0.009257 ]
[ 0.41 rgb 0.010291 ]
[ 0.42 rgb 0.011441 ]
[ 0.43 rgb 0.012721 ]
[ 0.44 rgb 0.014144 ]
[ 0.45 rgb 0.015728 ]
[ 0.46 rgb 0.017491 ]
[ 0.47 rgb 0.019453 ]
[ 0.48 rgb 0.021638 ]
[ 0.49 rgb 0.024070 ]
[ 0.5 rgb 0.026780 ]
[ 0.51 rgb 0.029800 ]
[ 0.52 rgb 0.033165 ]
[ 0.53 rgb 0.036918 ]
[ 0.54 rgb 0.041103 ]
[ 0.55 rgb 0.045773 ]
[ 0.56 rgb 0.050986 ]
[ 0.57 rgb 0.056810 ]
[ 0.58 rgb 0.063318 ]
[ 0.59 rgb 0.070596 ]
[ 0.6 rgb 0.078741 ]
[ 0.61 rgb 0.087865 ]
[ 0.62 rgb 0.098092 ]
[ 0.63 rgb 0.109569 ]
[ 0.64 rgb 0.122461 ]
[ 0.65 rgb 0.136962 ]
[ 0.66 rgb 0.153294 ]
[ 0.67 rgb 0.171715 ]
[ 0.68 rgb 0.192529 ]
[ 0.69 rgb 0.216089 ]
[ 0.7 rgb 0.242814 ]
[ 0.71 rgb 0.273197 ]
[ 0.72 rgb 0.307828 ]
[ 0.73 rgb 0.347413 ]
[ 0.74 rgb 0.392803 ]
[ 0.75 rgb 0.445032 ]
[ 0.76 rgb 0.505365 ]
[ 0.77 rgb 0.575360 ]
[ 0.78 rgb 0.656955 ]
[ 0.79 rgb 0.752583 ]
[ 0.8 rgb 0.865323 ]
[ 0.81 rgb 0.999115 ]
[ 0.82 rgb 1.159058 ]
[ 0.83 rgb 1.351824 ]
[ 0.84 rgb 1.586259 ]
[ 0.85 rgb 1.874249 ]
[ 0.86 rgb 2.232002 ]
[ 0.87 rgb 2.681964 ]
[ 0.88 rgb 3.255762 ]
[ 0.89 rgb 3.998776 ]
[ 0.9 rgb 4.977439 ]
[ 0.91 rgb 6.291126 ]
[ 0.92 rgb 8.092027 ]
[ 0.93 rgb 10.619262 ]
[ 0.94 rgb 14.259199 ]
[ 0.95 rgb 19.655478 ]
[ 0.96 rgb 27.916803 ]
[ 0.97 rgb 41.024283 ]
[ 0.98 rgb 62.663313 ]
[ 0.99 rgb 100.000000 ]
[ 1 rgb 100.000000 ]
}scale 1.6}
#macro star (luminosity,tlx,tly,tlz) //0.8~Sun, 1.3~class O, 0.5~barely visible
//main sequence only
//tl = translate
#if (test)
sphere{<tlx,tly,tlz>,(pow(luminosity,2)/1.6) texture{
pigment{color rgb <(1/luminosity),1,luminosity>}
finish{ambient (pow(luminosity,3))}
}
}
#else
light_source {<tlx,tly,tlz> color rgb 10*(pow(luminosity,3))*<(1/luminosity),1,luminosity>
fade_distance 10*pow(luminosity,3) fade_power 1 } //starlight that acts on everything else
union{ //Separate union+translate is required for light_group--why?? (Hence hackish translate through #macro.)
light_group{ //light on star's media only
light_source {<0,0,0> color rgb (pow(luminosity,3))*<(1/luminosity),1,luminosity> }
#if (luminosity < 1) //not visible anyway if color is already washed out
light_source {<0,0,0> color rgb 10*(pow(luminosity,3))*<(1/luminosity),1,luminosity>
fade_distance .01*pow(luminosity,3) fade_power 3 } //Creates small-star center w/rgb <1
#end
sphere {<0,0,0>,1 texture{pigment{color rgbt 1}} //Star media
hollow no_shadow
interior {
media {
scattering {1, rgb 1}
density {expdense}
}
}
scale pow(luminosity,2)/1.6}
global_lights off}
translate <tlx,tly,tlz>}
sphere {<tlx,tly,tlz>,(pow(luminosity,2)/1.6)+.001 texture{pigment{color rgbt 1} //Hackish nearly-invisible
finish{ambient 0 reflection 0 diffuse 0} } hollow no_shadow} //sphere gets (mostly) rid of media bubble artifact
#end
#end