POV-Ray : Newsgroups : povray.advanced-users : How to change number based on star type? Server Time
23 Nov 2024 20:52:38 EST (-0500)
  How to change number based on star type? (Message 1 to 5 of 5)  
From: worldbuilder
Subject: How to change number based on star type?
Date: 7 Oct 2011 14:00:01
Message: <web.4e8f3ceb633f49a6b8f6b920@news.povray.org>
I'm trying to make a star object whose radius changes based on spectral class
and subtype. For example, I want an M9 star to have about 0.2 for a radius and a
G2 star to have about 1. I can already make it change based on subtype but I
want to also take into account the spectral type. Is there any way to do this?

camera {
  location  <0.0, 2.0, -5.0>
  look_at   <0.0, 0.0,  0.0>
  right     x*image_width/image_height
}


#declare SubtypeSeed = seed(1337); //1m 50 1337!!!1
#declare GenerateSubtype = rand(SubtypeSeed)*10;
#declare O = rgb <0.6,0.8,0.95>;
#declare B = rgb <0.7,0.75,0.9>;
#declare A = rgb <0.9,0.9,0.99>;
#declare F = rgb <0.9,0.8,0.55>;
#declare G = rgb <0.8,0.7,0.35>;
#declare K = rgb <0.8,0.5,0.15>;
#declare M = rgb <0.8,0.1,0.05>;
#declare SpectralClass = G;
#declare Subtype = 9; //0-9, 0 being the brightest and 9 being the faintest or
tell POV to generate one with GenerateSubtype
#declare SubtypeConvert = 10-Subtype;
#declare ColorMult = SpectralClass+(SpectralClass*SubtypeConvert);
#declare dwarf = 1;
#declare giant = 3;
#declare Startype = dwarf; //dwarf or giant
#declare BaseSize = (SubtypeConvert/2)+1*Startype;


sphere {
  <0, 0, 0>
  BaseSize
  hollow
  pigment { rgbt 1 }
  interior {
  media {

   absorption rgb 1
  emission ColorMult
  density {
    spherical
  }
}
   }


 }


Post a reply to this message

From: Christian Froeschlin
Subject: Re: How to change number based on star type?
Date: 7 Oct 2011 15:07:32
Message: <4e8f4df4@news.povray.org>
worldbuilder wrote:

> I'm trying to make a star object whose radius changes based on
> spectral class and subtype. For example, I want an M9 star to have
> about 0.2 for a radius and a G2 star to have about 1. I can already
> make it change based on subtype but I want to also take into account
> the spectral type. Is there any way to do this?

I think you'd save yourself some trouble if you separate the
spectral class id from the spectral class color:

#declare O = 0;
#declare B = 1;
#declare A = 2;
#declare F = 3;
#declare G = 4;
#declare K = 5;
#declare M = 6;

#declare SPECTRAL_COLORS = array[7]
{
   rgb <0.6,0.8,0.95>,
   rgb <0.7,0.75,0.9>,
   ...
}

...

#declare SpectralClass = G;

#declare SpectralColor = SPECTRAL_COLORS[SpectralClass];


Then you can more easily make calculations based on SpectralClass.

You might also wish to have a look at the "lightsys" macros
that provide, among other things, a macro to calculate emission
color based on blackbody temperature.


Post a reply to this message

From: Alain
Subject: Re: How to change number based on star type?
Date: 7 Oct 2011 15:58:00
Message: <4e8f59c8@news.povray.org>

> I'm trying to make a star object whose radius changes based on spectral class
> and subtype. For example, I want an M9 star to have about 0.2 for a radius and a
> G2 star to have about 1. I can already make it change based on subtype but I
> want to also take into account the spectral type. Is there any way to do this?
>
> camera {
>    location<0.0, 2.0, -5.0>
>    look_at<0.0, 0.0,  0.0>
>    right     x*image_width/image_height
> }
>
>
> #declare SubtypeSeed = seed(1337); //1m 50 1337!!!1
> #declare GenerateSubtype = rand(SubtypeSeed)*10;
> #declare O = rgb<0.6,0.8,0.95>;
> #declare B = rgb<0.7,0.75,0.9>;
> #declare A = rgb<0.9,0.9,0.99>;
> #declare F = rgb<0.9,0.8,0.55>;
> #declare G = rgb<0.8,0.7,0.35>;
> #declare K = rgb<0.8,0.5,0.15>;
> #declare M = rgb<0.8,0.1,0.05>;
> #declare SpectralClass = G;
> #declare Subtype = 9; //0-9, 0 being the brightest and 9 being the faintest or
> tell POV to generate one with GenerateSubtype
> #declare SubtypeConvert = 10-Subtype;
> #declare ColorMult = SpectralClass+(SpectralClass*SubtypeConvert);
> #declare dwarf = 1;
> #declare giant = 3;
> #declare Startype = dwarf; //dwarf or giant
> #declare BaseSize = (SubtypeConvert/2)+1*Startype;
>
>
> sphere {
>    <0, 0, 0>
>    BaseSize
>    hollow
>    pigment { rgbt 1 }
>    interior {
>    media {
>
>     absorption rgb 1
>    emission ColorMult
>    density {
>      spherical
>    }
> }
>     }
>
>
>   }
>
>
>
>

You forgot the "N" class, dark red to brown.
It should have an rgb value around rgb<0.75, 0.06, 0.01>

I agree with Christian, use an array for your colours. You can also use 
one for the base size of the various classes.

As for the startype, you should also have medium and super-giant.
#declare Average = 2;
#declare SuperGiant = 5;

Why use ...1*Startype ?

Using
#declare BaseSize = (SubtypeConvert/2)+Startype;
Is just as good.


Post a reply to this message

From: worldbuilder
Subject: Re: How to change number based on star type?
Date: 8 Oct 2011 12:10:00
Message: <web.4e907516c2ae1aeae743ecc00@news.povray.org>
I found a better way to make a star. It still doesn't change size based on
spectral class, but I decided to give up on that part. Instead of using spectral
classes and subtypes it uses brightness. The colors are still determined by
spectral types though, which are #defined at the beginning of the file and
called by each star. Brightness and spectral class are #defined before each
star. If a star doesn't have the spectral class and brightness defined before
its definition starts then it's a clone of the star before it.

//These are all the possible star colors
#declare MStarColor = rgb <0.9,0.4,0.1>;
#declare KStarColor = rgb <0.9,0.6,0.1>;
#declare GStarColor = rgb <0.9,0.7,0.1>;
#declare FStarColor = rgb <0.9,0.7,0.4>;
#declare AStarColor = rgb <0.7,0.8,0.9>;
#declare BStarColor = rgb <0.6,0.7,0.9>;
#declare OStarColor = rgb <0.4,0.5,0.9>;

camera {
  location  <0.0, 2.0, -5.0>
  look_at   <0.0, 0.0,  0.0>
  right     x*image_width/image_height
}



#declare Brightness = 5; //1-5
#declare StarColor = OStarColor; // MStarColor, KStarColor, GStarColor,
FStarColor, AStarColor, BStarColor, OStarColor
#declare StarMedia = (StarColor*2)*(Brightness*2);
sphere {
<0,0,0>
Brightness/2-(Brightness/4)
hollow
pigment { rgbt 1 }
interior { media { emission StarMedia
absorption rgb Brightness*2
density { spherical
warp {
turbulence 0.01*Brightness
lambda 4
omega 0.6
}
}
}
}
}


Post a reply to this message

From: Alain
Subject: Re: How to change number based on star type?
Date: 11 Oct 2011 13:40:23
Message: <4e947f87@news.povray.org>

> I found a better way to make a star. It still doesn't change size based on
> spectral class, but I decided to give up on that part. Instead of using spectral
> classes and subtypes it uses brightness. The colors are still determined by
> spectral types though, which are #defined at the beginning of the file and
> called by each star. Brightness and spectral class are #defined before each
> star. If a star doesn't have the spectral class and brightness defined before
> its definition starts then it's a clone of the star before it.
>
> //These are all the possible star colors
> #declare MStarColor = rgb<0.9,0.4,0.1>;
> #declare KStarColor = rgb<0.9,0.6,0.1>;
> #declare GStarColor = rgb<0.9,0.7,0.1>;
> #declare FStarColor = rgb<0.9,0.7,0.4>;
> #declare AStarColor = rgb<0.7,0.8,0.9>;
> #declare BStarColor = rgb<0.6,0.7,0.9>;
> #declare OStarColor = rgb<0.4,0.5,0.9>;
>
> camera {
>    location<0.0, 2.0, -5.0>
>    look_at<0.0, 0.0,  0.0>
>    right     x*image_width/image_height
> }
>
>
>
> #declare Brightness = 5; //1-5
> #declare StarColor = OStarColor; // MStarColor, KStarColor, GStarColor,
> FStarColor, AStarColor, BStarColor, OStarColor
> #declare StarMedia = (StarColor*2)*(Brightness*2);
> sphere {
> <0,0,0>
> Brightness/2-(Brightness/4)
> hollow
> pigment { rgbt 1 }
> interior { media { emission StarMedia
> absorption rgb Brightness*2
> density { spherical
> warp {
> turbulence 0.01*Brightness
> lambda 4
> omega 0.6
> }
> }
> }
> }
> }
>
>
>

It's probably a beter aproach. Anyway, unless prety close, you only see 
a point whatever the effective star's dimention. What you DO see, is 
it's brightness and colour.

For stars on the main sequance, the dimention follow a continuous path. 
Type O are big and bright, while type M and N are small and dim.

The giants generaly tend to get somewhat bigger from type O to type N. 
Most are type A to M. O stars on the main sequance are only slightly 
smaller than giant O stars.

Most dwarf stars are type F (white dwarf) to N (brown drawf), also of 
roughly equivalent size and smaler than "normal" N types.

A spctral type graph makes a rough mirrored "Z" shape.

For the larger stars, you stand /much/ farther than for the small ones, 
so, it tend to negate the actual size variations.

Do the math...
x/2-x/4 = x/2-(x/4) = (x/2)-(x/4) = x/4
Giving:
Brightness/2 - Brightness/4 = Brightness/4.

For the colour, I propose the use of a spline as follow:
#declare Spl_Class = spline{0, <0.7,0.1,0.03>, 1,MStarColor, 
2,KStarColor, 3,GStarColor, 4,FStarColor, 5,AStarColor, 6,BStarColor, 
7,OStarColor}

And use:
#declare StarColor = Spl_Class(Class);

to set your star's colour. "Class" can take intermediate values. So, for 
a G4 star, you use 3-0.4 or 2.6.


Post a reply to this message

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