POV-Ray : Newsgroups : povray.advanced-users : How to change number based on star type? : Re: How to change number based on star type? Server Time
26 Jun 2024 04:37:59 EDT (-0400)
  Re: How to change number based on star type?  
From: Alain
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

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