[Radiance-general] Sun Color

Martin Moeck MMoeck at engr.psu.edu
Thu Jan 6 21:04:08 CET 2005


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:marcdevon at hotmail.com]
Sent:	Thu 1/6/2005 11:00 AM
To:	radiance-general at radiance-online.org
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
Radiance-general at radiance-online.org
http://www.radiance-online.org/mailman/listinfo/radiance-general



-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/ms-tnef
Size: 3789 bytes
Desc: not available
Url : http://radiance-online.org/pipermail/radiance-general/attachments/20050106/881de31d/attachment.bin


More information about the Radiance-general mailing list