POV-Ray : Newsgroups : povray.general : Too many layers? : Re: Solution? Server Time
12 Aug 2024 11:17:12 EDT (-0400)
  Re: Solution?  
From: Ron Parker
Date: 22 Feb 1999 13:58:36
Message: <36d1a8dc.0@news.povray.org>
On Sat, 20 Feb 1999 17:11:33 -0800, Ken <tyl### [at] pacbellnet> wrote:
>Anthony Bennett wrote:
>> 
>> Thanks for your code, Mr. Parker, but can't one control the ammount of times a
>> pigment warps? It just seems a bit extra tedious to have to modify the background
>> to cover the extra stars instead of just pasting them on top. Thanks, though, the
>> stars are much more within my understanding now. The previous ones were
>> plagerized from some tutorial. I never understood them.
>
>  Per your request here I am. As Mr. Parker is the one who seems
>to have the better insight as to how to control this I am going to
>defer to Mr. Parker to answer this question for you. It's not that
>I am unwilling to help you. It is because I too would have to take
>the time to figure out what Mr. Parker has done and then decide the
>best approach to change it so it suit your needs. It might be easy
>or it might take me a week and I think Mr. Parker can save us both
>a lot of time.
>
> Mr. Parker it's your spotlight...

Thanks, Mr. Tyler.  Please, y'all, call me Ron.

I did see this post earlier, but I had to cogitate a bit on the proper 
solution.  Here, then, is the result of much ferocious cogitation.

This gives you a "field" of stars 6 across and 5 down, centered at the 
origin.  Dimensions are 5.5*XRepeat in the x direction and 9*YRepeat in the y 
direction. A little thought will show that to be the correct layout for the 
current US flag, though not perhaps the correct proportions.  It does require 
StarRadius <= XRepeat/2, but that shouldn't be an undue burden.  Figuring out 
what's going on here is left as an exercise for the reader, or for Ken if he 
should decide to figure out what I've done.  

Remember, this is still just a pigment.  You'll want to put it in a texture
and layer it over your flag-without-stars texture (or use a clever 
combination of gradients and boxed patterns to do the whole flag as a
single-layer pigment.)

//------------ Begin POV code
#declare StarRadius = .25;
#declare XRepeat = 1.0;
#declare YRepeat = 0.5;

#declare Starpoint = pigment {
  radial
  color_map {
    [.45 rgbt 1]
    [.45 rgb  1]
    [.55 rgb  1]
    [.55 rgbt 1]
  }
  translate StarRadius*x
}

#declare Whitestar = pigment {
  radial
  pigment_map {
    [.1 Starpoint rotate 72*0*y ]
    [.1 Starpoint rotate 72*1*y ]
    [.3 Starpoint rotate 72*1*y ]
    [.3 Starpoint rotate 72*2*y ]
    [.5 Starpoint rotate 72*2*y ]
    [.5 Starpoint rotate 72*3*y ]
    [.7 Starpoint rotate 72*3*y ]
    [.7 Starpoint rotate 72*4*y ]
    [.9 Starpoint rotate 72*4*y ]
    [.9 Starpoint rotate 72*0*y ]
  }
  rotate <90,0,90>
  translate <XRepeat/2,YRepeat/2,0>
  warp {repeat XRepeat*x}
  warp {repeat YRepeat*y offset XRepeat/2*x}
  translate -YRepeat/2*y
}
     
#declare Starfield=pigment {
  boxed
  pigment_map {
    [.00001 color rgbt 1]
    [.00001 Whitestar 
           scale <1/(XRepeat*2.75),1/(YRepeat*4.5),1>
    ]
  }
  scale <XRepeat*2.75, YRepeat*4.5, 1>
}                                
//------------ End POV code


Post a reply to this message

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