|
|
Okay, in the attached screenshot there is a horizontal axis that
represents the saturation axis of the HSL color model. The left box is
pure gray. The right box is pure red. The other boxes are 1/6, 2/6, 3/6,
4/6, and 5/6 saturation. The left-most and right-most boxes are 1/2 the
width of the other boxes.
Does this make sense?
On 1/20/2020 12:40 AM, Mike Horvath wrote:
> Kind of hate newsgroups sometimes, meh.
>
> Anyway, by offset scale I mean:
>
> |-0-|---1--|---2--|---3--|---4--|---5--|-6-|
>
> Notice how the beginning and end sections are 1/2 length.
>
> Better yet I should draw a diagram explaining the above. Which I will
> start working on now.
>
>
>
>
> On 1/20/2020 12:20 AM, Mike Horvath wrote:
>> I have created the attached scene.
>>
>> It works well, except the pigment function needs to be offset at the
>> beginning and end of the gradients "CSolid_HSLSphere_Saturation" and
>> "CSolid_HSLSphere_Lightness". The end result is supposed to look like
>> this:
>>
>> https://commons.wikimedia.org/wiki/File:HSLSphere.svg
>>
>> Can someone clue me in on how to do this? Thanks.
>>
>>
>> Michael
>
Post a reply to this message
Attachments:
Download 'saturation_gradient.png' (190 KB)
Preview of image 'saturation_gradient.png'
|
|
|
|
Mike Horvath <mik### [at] gmailcom> wrote:
> I have created the attached scene.
>
> It works well, except the pigment function needs to be offset at the
> beginning and end of the gradients "CSolid_HSLSphere_Saturation" and
> "CSolid_HSLSphere_Lightness". The end result is supposed to look like this:
>
> https://commons.wikimedia.org/wiki/File:HSLSphere.svg
>
> Can someone clue me in on how to do this? Thanks.
Hi Mike
Perhaps the code below will help you advance.
--
Tor Olav
http://subcube.com
https://github.com/t-o-k
// ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7
#version 3.7;
global_settings { assumed_gamma 1.0 }
#include "functions.inc"
// ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7
#declare AngleFn = function { f_th(x, 0, z) + pi };
#declare D = 2*pi/6;
#declare H = D/2;
#declare SectorFn =
function(s) {
0
+ select(s - (0*D ), 0, select(s - (1*D - H), 0, 0))
+ select(s - (1*D - H), 0, select(s - (2*D - H), 1, 0))
+ select(s - (2*D - H), 0, select(s - (3*D - H), 2, 0))
+ select(s - (3*D - H), 0, select(s - (4*D - H), 3, 0))
+ select(s - (4*D - H), 0, select(s - (5*D - H), 4, 0))
+ select(s - (5*D - H), 0, select(s - (6*D - H), 5, 0))
+ select(s - (6*D - H), 0, select(s - (6*D ), 6, 0))
}
;
#declare Colors =
array[7] {
color rgb <1, 0, 0>, // Rd
color rgb <1, 0, 1>, // Mg
color rgb <0, 0, 1>, // Bu
color rgb <0, 1, 1>, // Cy
color rgb <0, 1, 0>, // Gn
color rgb <1, 1, 0>, // Ye
color rgb <1, 0, 0> // Rd
}
;
#declare C = 1/6;
#declare G = C/2;
#declare SectorPigment =
pigment {
function { SectorFn(AngleFn(x, y, z))*C }
color_map {
[ 0*C Colors[0] ]
[ 1*C - G Colors[0] ]
[ 1*C - G Colors[1] ]
[ 2*C - G Colors[1] ]
[ 2*C - G Colors[2] ]
[ 3*C - G Colors[2] ]
[ 3*C - G Colors[3] ]
[ 4*C - G Colors[3] ]
[ 4*C - G Colors[4] ]
[ 5*C - G Colors[4] ]
[ 5*C - G Colors[5] ]
[ 6*C - G Colors[5] ]
[ 6*C - G Colors[6] ]
[ 6*C Colors[6] ]
}
}
// ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7
#declare Rmaj = 9;
#declare Rmin = 1;
torus {
Rmaj, Rmin
pigment { SectorPigment }
}
// ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7
#declare R = 7;
#declare RND = seed(7352);
#for (N, 0, 1000)
#declare X = R*(1 - 2*rand(RND));
#declare Z = R*(1 - 2*rand(RND));
#if (f_r(X, 0, Z) < R)
#declare Angle = AngleFn(X, 0, Z);
#declare Sector = SectorFn(Angle);
sphere {
<X, 0, Z>, 0.2
pigment { Colors[Sector] }
}
#end // if
#end // for
// ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7
camera {
location 24*y
look_at 0*y
}
light_source {
100*<-1, 3, 2>
color rgb <1, 1, 1>
}
// ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7
Post a reply to this message
|
|