-c option in genskyvec

Hello all,

As the titles suggests my question concerns the -c option in genskyvec. The documentation for genskyvec states the following:

The −c option may be used to specify a color for the sky. The gray value should equal 1 for proper energy balance. The default sky color is −c 0.960 1.004 1.118 .

I’ve ran the following checks to see its impact on irradiance in the DC method:
A) with the default −c 0.960 1.004 1.118 option, and
B) with the custom - c 0.421 0.267 0.306 option, the sum of which is approximately 1.

A) I used gendaylit command with -O 1 option to consider the entire solar spectrum:
gendaylit 11 25 15:30 -m -15 -a 49.43 -o -7.75 -W 0 200 -O 1 > sky.sky
genskyvec -m 1 -c 0.960 1.004 1.118 < sky.sky > sky.vec

My assumption was that my reference point outside would yield the same irradiance as specified in the -W option, so, approximately 200 W/m². However, the sum of the irradiance in RGB channels was 607 W/m².

B) I repeated step A with the custom -c option in genskyvec.
gendaylit 11 25 15:30 -m -15 -a 49.43 -o -7.75 -W 0 200 -O 1 > sky.sky
genskyvec -m 1 -c 0.421 0.267 0.306 < sky.sky > sky.vec
The reference point yield 196 W/m².

Note: I have tried the same iterations with -O 0 in gendaylit but could not yield the expected irradiance.

I have seen some posts discuss -c option of genskyvec before Rfluxmtx -x and -y input options - #9 by zha. However, I find that even using −c 1 1 1 will overestimate the irradiance (591 W/m²).

In conclusion, it appears that the sum of RGB in -c option of genskyvec must be equal to 1 in order to achieve correct irradiance in the simulation provided that gendaylit considers the entire solar spectrum. In this sense, why is −c 0.960 1.004 1.118 used in the default option? And how, at all, these number are computed?

Best regards,
Rita

The sum of RGB coefficients should not be 1.0. Rather, the formula “0.265R + 0.670G + 0.065*B” should be close to 1.0. Also, the conversion for watts to lumens is held to 179.0 lm/watt in Radiance, which is set based on a specific equal-energy white range.

Hope this helps!
-Greg

Hi Greg,

thank you for the answer! In the example, I am considering RGB as irradiance containers and I am not looking into conversion to photometric values. If I am only interested in irradiance, how can I define -c option of genskyvec to keep the energy balance i.e. 200 W/m² in and 200 W/m² out?

Best regards,
Rita

Hi Rita,
the -O1 option you’re giving to gendaylit makes sure the output is irradiance, rather than illuminance, which is the default. So you’re all good, as long as the weighted RGB average is 1.0, as Greg explained.
If you like, you can use the Jaloxa Colour Picker for setting the colour of your sky.
http://www.jaloxa.eu/resources/radiance/colour_picker.shtml
In the Results tab, you can find the Normalised RGB values, which you can use directly with the genskyvec -c option.
I personally always use a grey sky (-c 1 1 1) for my simulations. This avoids having to fiddle with the RGB coefficients. Unless you render images, the output is the same.
Cheers
Axel

Hi Axel,

thank you for answering my post. I am working with the measured SPDs of different skies. How can I convert the measured SPD data to the normalized RGB values that are correct for use in genskyvec?

Best,
Rita

Well, it’s a little bit complicated, but the basic idea is that you need to multiply your SPD by the CIE x, y, and z standard observer sensitivity function to compute the X, Y, and Z values. Here is the C-shell script I use, which hopefully you can adapt to your purpose. This one takes reflectance values and an optional illuminant spectrum and multiplies those together, but if you leave off the illuminant, it uses “equal-energy white” which means that you can compute the XYZ coordinates of a light source with the same method:

#!/bin/csh -f
#
# Compute CIE chromaticities from spectral reflectance data
#
if ( $#argv < 1 ) goto userr
set cal = ~/cal
if ( $argv[1] == "-i" ) then
        if ( $#argv < 3 ) goto userr
        shift argv
        set illum=$argv[1]
        shift argv
        foreach r ( $argv[*] )
                tabfunc -i rf < $r > /tmp/rf$$.cal
                rcalc -f $cal/cieresp.cal -f /tmp/rf$$.cal \
                        -e 'r=rf($1);ty=$2*triy($1)' \
                        -e '$1=ty;$2=$2*r*trix($1);$3=r*ty' \
                        -e '$4=$2*r*triz($1)' \
                        -e 'cond=if($1-359,831-$1,-1)' \
                        $illum | total -m >> /tmp/rc$$.dat
        end
        rm -f /tmp/rf$$.cal
else
        foreach r ( $argv[*] )
                rcalc -f $cal/cieresp.cal -e 'ty=triy($1);$1=ty' \
                -e '$2=$2*trix($1);$3=$2*ty;$4=$2*triz($1)' \
                -e 'cond=if($1-359,831-$1,-1)' $r \
                        | total -m >> /tmp/rc$$.dat
        end
endif
rcalc -e 'X=$2/$1;Y=$3/$1;Z=$4/$1' \
        -e 'x=X/(X+Y+Z);y=Y/(X+Y+Z);u=4*X/(X+15*Y+3*Z);v=9*Y/(X+15*Y+3*Z)' \
        -o $cal/color.fmt /tmp/rc$$.dat
rm -f /tmp/rc$$.dat
exit 0
userr:
echo "Usage: $0 [-i illum.dat] refl.dat .."
exit 1

Once you have the XYZ, you can convert to Radiance’s RGB coefficients using the xyz_rgb.cal function like so:

rcalc -f xyz_rgb.cal -e '$1=R($1,$2,$3);$2=G($1,$2,$3);$3=B($1,$2,$3)'

(Replace the single quotes above with double quotes if you are under Windows.)
Then, just feed the output of the script to the input of the above command, or cut and paste.

-Greg

P.S. Spreadsheet programs like Excel also work very easily for this type of calculation.