# defining an uniform sky, rgb weighted light sources

I am having problems to understand the definition of a sky source either using glow or light modifiers.

I want to model a uniform 10.000lx (horizontal) illuminance sky. To do so, I can either define a hemispherical light source with luminance = 10.000/pi, or use the gensky command. Modifying the source with either light or glow, plus the gensky command, give me three alternatives to define the environment. Still, the only way that gives me the expected results (10.000lx when measuring in the origin) is using the light-modified source. Both glow skies (defined manually or generated using gensky) give me 5235lx, setting ab to 1. If I am not applying the multipliers for the primaries to the set the rgb values of my glow material, I get very close to the expected 10.000lx, but I do not understand why there is a difference in the rgb values for glow and light. Also, the gensky example does not work as expected. So I am pretty sure that there is an obvious mistake, most probably related to my understanding of the light and source modifiers.

Luminance for the source = 10.000 / pi = 3183
Radiance corresponding to that: 3183 / 179 = 17.78

1) light modifier, source
to define the light modifier's rgb radiance triplet, I multiply the luminance 17.78
by .265, .67, .065 for its rgb components and get:

void light sky_light
0
3 4.7117 11.9126 1.1557

applying this to a source, I can get the expected readings from rtrace:

#echo "0 0 .01 0 0 1" | rtrace -h -x 1 -I -ab 4 sky.oct | \
rcalc -e '\$1=47.4*\$1+120*\$2+11.6*\$3'
10469.3751

2) glow modifier, source
to define the glow, I simply take the radiance of 17.8 for r, g, b without applying the multipliers and get
the expected value from rtrace with ab 1:

#echo "0 0 .01 0 0 1" | rtrace -h -x 1 -I -ab 1 sky.oct | \
rcalc -e '\$1=47.4*\$1+120*\$2+11.6*\$3'
rtrace: warning - no light sources found
9998.45491

BUT when using the weighted rgb radiance as in the light source definition (4.7117, 11.9126, 1.1557),
I get this:

#echo "0 0 .01 0 0 1" | rtrace -h -x 1 -I -ab 1 sky.oct | \
rcalc -e '\$1=47.4*\$1+120*\$2+11.6*\$3'
rtrace: warning - no light sources found
5234.70623

So obviously this is not the way to go.

3) So I try what happens if I call gensky with the -B option, to use a given horizontal illuminance

!gensky 4 21 +10:00 -u -B 55.87 -r 0

(55.87 is simply 10.000lx/179)

As all luminances are equal in the uniform sky, this should work. BTW, even for an uniform sky with given
brightness, I have to give a time - which does not make sense, as the time is ignored.

Using this sky, a rtrace call gives me, again, a much lower horizontal illuminance then expected:

#echo "0 0 .01 0 0 1" | rtrace -h -x 1 -I -ab 1 sky.oct | \
rcalc -e '\$1=47.4*\$1+120*\$2+11.6*\$3'
rtrace: warning - no light sources found
5225.65173

So it is evident that I misunderstand something related to the rgb-weighted radiance, still I do not understand what is wrong. Especially the 3rd alternative seams to be close to the standard useage szenario, but as I have never used the -B option of gensky before, chances are that I got it wrong. So if anyone having more routine in these calculations could give me a hint, I might have the opportunity to get some more insight into the secrets of radiance before the year ends

Thank you, and have a nice new year celebration wherever you are,

Lars.