ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/gen/perezlum_c.cal
Revision: 1.1
Committed: Sat Sep 1 16:42:39 2018 UTC (5 years, 8 months ago) by greg
Branch: MAIN
CVS Tags: rad5R4, rad5R2, rad5R3, HEAD
Log Message:
Added missing file from last commit

File Contents

# User Rev Content
1 greg 1.1 { RCSid $Id: perezlum.cal,v 1.2 2018/01/12 23:48:09 greg Exp $ }
2    
3     {
4     All-weather Angular Sky Luminance Distribution . Modiefied for colored sky. Model by Aicha Diakite (TU-Berlin), implementation by J. Wienold (EPFL)
5    
6     Additional arguments required for calculation of skybright:
7    
8     A1 - diffus normalization
9     A2 - ground brightness
10     A3,A4,A5,A6,A7 - coefficients for the Perez model
11     A8,A9,A10 - sun direction
12     A11 - perez parameter epsilon
13     A12-A22 - locus values
14     }
15    
16     A11 = arg(11);
17     A12 = arg(12);
18     A13 = arg(13);
19     A14 = arg(14);
20     A15 = arg(15);
21     A16 = arg(16);
22     A17 = arg(17);
23     A18 = arg(18);
24     A19 = arg(19);
25     A20 = arg(20);
26     A21 = arg(21);
27     A22 = arg(22);
28    
29     al= -180.956;
30     be= 78.648;
31    
32    
33    
34    
35     skybright_r = 2.5693*X_CIE-1.1668*lum-0.3984*Z_CIE;
36     skybright_g = -1.0221*X_CIE+1.9783*lum+0.0438*Z_CIE;
37     skybright_b =-0.0747*X_CIE-0.2519*lum+1.1772*Z_CIE;
38    
39    
40    
41     X_CIE=lum*xd/yd;
42     Z_CIE=lum*(1-xd-yd)/yd;
43    
44    
45     yd=A20*xd*xd+A21*xd+A22;
46    
47     xd = if((cct-7000),xd2,xd1);
48    
49     xd1 = A12/(cct*cct*cct) +A13/(cct*cct) +A14/cct + A15;
50    
51     xd2 = A16/(cct*cct*cct) +A17/(cct*cct) +A18/cct + A19;
52    
53     cct = if((1.065-A11),6191,1000000/(al+be*(log10(lum))));
54    
55    
56    
57    
58     lum = skybright ;
59    
60     skybright = wmean((Dz+1.01)^10, intersky, (Dz+1.01)^-10, A2 );
61    
62     wmean(a, x, b, y) = (a*x+b*y)/(a+b);
63    
64     intersky = if( (Dz-0.01),
65     A1 * (1 + A3*Exp(A4/Dz) ) * ( 1 + A5*Exp(A6*gamma) + A7*cosgamma*cosgamma ),
66     A1 * (1 + A3*Exp(A4/0.01) ) * ( 1 + A5*Exp(A6*gamma) + A7*cosgamma*cosgamma ) );
67    
68    
69    
70    
71     cosgamma = Dx*A8 + Dy*A9 + Dz*A10;
72    
73     gamma = Acos(cosgamma); { angle from sun to this point in sky }
74    
75     zt = Acos(A10); { angle from zenith to sun }
76    
77     eta = Acos(Dz); { angle from zenith to this point in sky }