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

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