POV-Ray : Newsgroups : povray.general : Feature request: stars texture : Re: Feature request: stars texture Server Time
1 Aug 2024 00:18:26 EDT (-0400)
  Re: Feature request: stars texture  
From: Slime
Date: 29 May 2006 01:13:01
Message: <447a82dd$1@news.povray.org>
Try this out:


// Slime's Star Pigment Macro

#macro StarSubPigment(StarSize, StarFrequency)
 crackle
 form <1,0,0>

 #local Cutoff = StarSize * StarFrequency;
 color_map {
  [Cutoff rgb 1]
  [Cutoff rgb 0]
 }

 scale 1/StarFrequency
#end

// minsize, maxsize = size range of stars (some stars will always be smaller
due to nature of crackle pattern)
// starfrequency = how many stars
// variationfrequency = how quickly their size changes
#macro StarPigment(MinSize, MaxSize, StarFrequency, VariationFrequency)

 #local NumSizeSteps = 8;

 pigment
 {
  pigment_pattern
  {
   bozo
   color_map {[0 rgb 0][1 rgb 1]}
   scale 1/VariationFrequency
  }

  pigment_map
  {
   #local StepNum = 0;
   #while (StepNum < NumSizeSteps)
    #local SizeAmnt = (StepNum + .5) / NumSizeSteps;
    #local PreSize = MinSize + (StepNum / NumSizeSteps) * (MaxSize -
MinSize);
    #local PostSize = MinSize + ((StepNum + 1) / NumSizeSteps) * (MaxSize -
MinSize);
    [SizeAmnt
     StarSubPigment(PreSize, StarFrequency)
    ]
    [SizeAmnt
     StarSubPigment(PostSize, StarFrequency)
    ]
    #local StepNum = StepNum + 1;
   #end
  }
 }
#end

sky_sphere {
 StarPigment(
  .0004, // min star size
  .003,  // max star size
  50,    // star density (higher = more)
  10     // variation frequency (higher = star size changes more over nearby
parts of the sky)
 )
}


 - Slime
 [ http://www.slimeland.com/ ]


Post a reply to this message

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