Sun Color

Dear Group

Does anyone here know how to alter or adjust gensky's sun color? I guess what I am looking for is a color that is warmer that the color that I am achieving now. This is for asthetic purposes but I want a solution that is physically accurate. I have tried altering the day and time of day to achieve this but it seems that only the angle, height, and intensity of the sunlight is changed and not the color. I don't mind hard coding it in the application if it necessasary if it isn't too messy. Any suggestions?

Marcus

Hi Marcus,

This can be done with an appropriate insertion of rcalc in your Radiance command. In the scene file, you would modify your gensky line to read:

!gensky 6 21 12 | rcalc -p -i sunlight.fmt \
  -e 'sr=1.035*si;sg=1.003*si;sb=0.826*si' \
  -o 'void light solar 0 0 3 ${sr} ${sg} ${sb}'

The color for the sun is converted from the CIE (x,y) chromaticity for standard illuminant B, which is (0.3485,0.3517). The file "sunlight.fmt" must contain the following:

void light solar
0
3 ${si} ${si} ${si}

You'll need the latest version of rcalc (3.6.1 release), as previous versions did not have the -p option.

Hope this works for you.
-Greg

···

From: "Marcus Jacobs" <[email protected]>
Date: January 6, 2005 8:00:39 AM PST

Dear Group

Does anyone here know how to alter or adjust gensky's sun color? I guess what I am looking for is a color that is warmer that the color that I am achieving now. This is for asthetic purposes but I want a solution that is physically accurate. I have tried altering the day and time of day to achieve this but it seems that only the angle, height, and intensity of the sunlight is changed and not the color. I don't mind hard coding it in the application if it necessasary if it isn't too messy. Any suggestions?

Marcus

Here is tcl code to convert the sun color from a blackbody temperature "T" to Radiance RGB:

···

_______________________________________________

# input =

proc Kelvin_to_sun_RGB {T YL solar_radiance} {

# converts a color temperature of degrees Kelvin into RGB
# given: color temp. T and the luminance YL of the source

# convert the blackbody temperature T into "RGB"
# Both fits have R^2= 1.000 over the range from 2000K
# to 11000K. Both look ill behaved above 11000K

set x [expr 0.8405 - 2.1783*pow(10,-4) *$T \
       + 3.5254*pow(10,-8) *$T*$T \
       - 2.7046*pow(10,-12)*$T*$T*$T \
       + 7.9696*pow(10,-17)*$T*$T*$T*$T]

set y [expr 0.30587 + 1.3655*pow(10,-4) *$T \
        - 5.6154*pow(10,-8) *$T*$T \
        + 8.9484*pow(10,-12)*$T*$T*$T \
        - 6.5352*pow(10,-16)*$T*$T*$T*$T \
        + 1.8158*pow(10,-20)*$T*$T*$T*$T*$T]

set z [expr 1.00000000 -$x-$y]

set X [expr $x*$YL/$y]
set Z [expr $z*$YL/$y]
# X, YL, Z are the spectral tristimulus values

# the following formulae assume the monitor alignments given in the book :
# "procedural elements for computer graphics" by David F. Rogers, 1985 McGraw-Hill; pp. 397

set R [expr 2.739*$X - 1.145*$YL - 0.424*$Z]
set G [expr -1.119*$X + 2.029*$YL + 0.033*$Z]
set B [expr 0.138 *$X - 0.333*$YL + 1.105*$Z]
if {$B<0} {set B 0.0}

set k1 [expr (0.3*$R+0.59*$G+0.11*$B)]
# fact*k1=solar$radiance; correct RGB to actual values given in "void light solar"
# from the gensky output
set fact [expr $solar_radiance/$k1]
set R [expr $R*$fact]; set G [expr $G*$fact]; set B [expr $B*$fact]
return "$R $G $B"

}

_______________________________________________________________________

Martin Moeck, Penn State

-----Original Message-----
From: Marcus Jacobs [mailto:[email protected]]
Sent: Thu 1/6/2005 11:00 AM
To: [email protected]
Cc:
Subject: [Radiance-general] Sun Color
Dear Group

Does anyone here know how to alter or adjust gensky's sun color? I guess
what I am looking for is a color that is warmer that the color that I am
achieving now. This is for asthetic purposes but I want a solution that is
physically accurate. I have tried altering the day and time of day to
achieve this but it seems that only the angle, height, and intensity of the
sunlight is changed and not the color. I don't mind hard coding it in the
application if it necessasary if it isn't too messy. Any suggestions?

Marcus

_______________________________________________
Radiance-general mailing list
[email protected]
http://www.radiance-online.org/mailman/listinfo/radiance-general

Thanks Martin and Greg for the help for my question about the sun color.

I have done some light research on of the sun's color temperature. I think Martin's may be the method that I would prefer in converting a color temperature and luminance of the sun to the RGB used with the light primative. I have had some problems running the script. In a comment line it states:

converts a color temperature of degrees Kelvin into RGB given: color temp. T and the luminance YL of the source

My problem is that this script takes three variables (T, YL, and solar_radiance) but the comment only mentions two variables (T and YL). What is the solar_radiance and how does it differ from the luminance of the source (the source I am assuming is the sun)? Also, what are the units of measurement for the 3 variables? Do you have an example for this?

Thanks

Marcus Jacobs

I modified the script.Use it as follows:

# generate a radiance sun: gensky 3 21 8
...
void light solar
0
0
3 5.18e+006 5.18e+006 5.18e+006
...
YL=179*(5.18e+006 *.265+5.18e+006 *.67+5.18e+006*.0648)= 927034556

proc Kelvin_to_sun_RGB {T YL} {

# converts a color temperature of degrees Kelvin into RGB
# given: color temp. T and the luminance YL of the source
# convert the blackbody temperature T into "RGB"
# Both fits have R^2= 1.000 over the range from 2000K
# to 11000K. Both look ill behaved above 11000K
set x [expr 0.8405 - 2.17834e-04 *$T \
                   + 3.52544e-08 *$T*$T \
                   - 2.7046e-12*$T*$T*$T \
                   + 7.9696e-17*$T*$T*$T*$T]
set y [expr 0.30587 + 1.3655e-4 *$T \
                    - 5.6154e-8 *$T*$T \
                    + 8.9484e-12*$T*$T*$T \
                    - 6.5352e-16*$T*$T*$T*$T \
                    + 1.8158e-20*$T*$T*$T*$T*$T]

set z [expr 1.0-$x-$y]
set X [expr $x*$YL/$y]
set Z [expr $z*$YL/$y]
# X, YL, Z are the spectral tristimulus values
# the following formulae assume the monitor alignments given in the book :
# "procedural elements for computer graphics" by David F. Rogers, 1985 McGraw-Hill; pp. 397
set R [expr 2.739*$X - 1.145*$YL - 0.424*$Z]
set G [expr -1.119*$X + 2.029*$YL + 0.033*$Z]
set B [expr 0.138 *$X - 0.333*$YL + 1.105*$Z]
if {$B<0} {set B 0.0}
return "$R $G $B"
}

···

__________________________________
Kelvin_to_sun_RGB 2100.0 $YL
...
# a sun with a color temperature of 2100 K and a luminance of YL
void light solar
0 0 3
2017646607 601412803 19892974
...

The script does not work for very low sun angles, as the sun changes to pink orange, which cannot be represented by a blackbody. Use some filter colors from Lee or Rosco for that.

Martin Moeck

  -----Original Message-----
  From: Marcus Jacobs [mailto:[email protected]]
  Sent: Fri 1/7/2005 8:10 PM
  To: [email protected]
  Cc:
  Subject: [Radiance-general] RE: Sun Color
  
  Thanks Martin and Greg for the help for my question about the sun color.
  
  I have done some light research on of the sun's color temperature. I think
  Martin's may be the method that I would prefer in converting a color
  temperature and luminance of the sun to the RGB used with the light
  primative. I have had some problems running the script. In a comment line it
  states:
  
  converts a color temperature of degrees Kelvin into RGB given: color temp. T
  and the luminance YL of the source
  
  My problem is that this script takes three variables (T, YL, and
  solar_radiance) but the comment only mentions two variables (T and YL). What
  is the solar_radiance and how does it differ from the luminance of the
  source (the source I am assuming is the sun)? Also, what are the units of
  measurement for the 3 variables? Do you have an example for this?
  
  Thanks
  
  Marcus Jacobs
  
  _______________________________________________
  Radiance-general mailing list
  [email protected]
  http://www.radiance-online.org/mailman/listinfo/radiance-general