|
|
"Gail Shaw" <initialsurname@sentech sa dot com> wrote:
> "Orchid XP v3" <voi### [at] devnull> wrote in message
> news:44ea1dc9$1@news.povray.org...
>
> > I suspected as much.
> >
> > I wrote a generator somewhere which is guaranteed to provide maximum
> > saturation colours... but it's not what you'd call "short".
>
> Wouldn't this work?
>
> CHSL2RGB(rgb <rand(rnd)*360,1,0.5>)
> where CHSL2RGB is the function in colors.inc that converts a colour from
> Hue, Saturation, Lightness colour space into rgb
You need to #indlude "colors.inc" for these colour functions ...
CHSV2RGB(<rand(rnd)*360,1,1>) will work too, but the *2RGB macros are quite
slow. It's very easy to write a macro which gives almost the same output,
but runs much faster. I thought I'd paste in the code I just wrote to play
with this ...
// --- code starts ---
#declare UseBuiltIn = on;
#declare Spread2ndary = on;
#declare RandomBlocks = off;
#if (UseBuiltIn)
#include "colors.inc"
#else
#macro MinV(V) (min(V.x,V.y,V.z)) #end
#macro MaxV(V) (max(V.x,V.y,V.z)) #end
#macro SatV(V) ((V-MinV(V)+0.0001)/(MaxV(V)-MinV(V)+0.0001)) #end
#end
#if (RandomBlocks)
#declare Rnd = seed(7865);
#end
union {
#declare Y = 0; #while (Y < 40)
#declare X = 0; #while (X < 40)
#if (RandomBlocks)
#declare F = rand(Rnd);
#else
#declare F = ((X/40)+Y)/40;
#end
#if (Spread2ndary)
#declare F = F + 0.035*sin(6*pi*F);
#end
#if (UseBuiltIn)
#declare C = CHSV2RGB(<360*F,1,1>);
#else
#declare C = rgb SatV(vaxis_rotate(x, 1, 360*F));
#end
box {
<X,Y,0>,<X,Y,0>+1
pigment { colour C }
finish { ambient 1 diffuse 0 }
}
#if (!RandomBlocks)
sphere { <5*(C.x-1.1), (X/40)+Y, 0>, 1/30 pigment { rgb x } finish {
ambient 1 diffuse 0 } }
sphere { <5*(C.y-1.1), (X/40)+Y, 0>, 1/30 pigment { rgb y } finish {
ambient 1 diffuse 0 } }
sphere { <5*(C.z-1.1), (X/40)+Y, 0>, 1/30 pigment { rgb z } finish {
ambient 1 diffuse 0 } }
#end
#declare X = X + 1; #end
#declare Y = Y + 1; #end
translate <-20,-20,40>
}
// --- code ends ---
Bye for now,
Mike Andrews.
Post a reply to this message
|
|