1 |
greg |
1.1 |
{ RCSid $Id$ } |
2 |
|
|
{ |
3 |
|
|
Approximated triple-glazing model using BRTDfunc. |
4 |
|
|
|
5 |
|
|
void BRTDfunc glaze3 |
6 |
|
|
10 |
7 |
|
|
sr_red sr_grn sr_blu |
8 |
|
|
st_red st_grn st_blu |
9 |
|
|
0 0 0 |
10 |
|
|
glass3.cal |
11 |
|
|
0 |
12 |
|
|
18 0 0 0 0 0 0 0 0 0 |
13 |
|
|
rfspc gfspc bfspc |
14 |
|
|
rbspc gbspc bbspc |
15 |
|
|
rtspc gtspc btspc |
16 |
|
|
|
17 |
|
|
where: |
18 |
|
|
rfspc, gfspc, bfspc - front specular RGB at normal |
19 |
|
|
rbspc, gbspc, bbspc - back specular RGB at normal |
20 |
|
|
rtspc, gtspc, btspc - transmitted RGB at normal |
21 |
|
|
|
22 |
|
|
You can use the first 9 arguments to get diffuse components, |
23 |
|
|
but the glazing model won't work very well if you do. |
24 |
|
|
Also, if the transmission plus reflection on either side |
25 |
|
|
adds up to greater than 1.0, you will be violating physics. |
26 |
|
|
|
27 |
|
|
G.Ward for LBNL |
28 |
|
|
} |
29 |
|
|
Rexp : -2.5; { exponent found to work well for Fresnel } |
30 |
|
|
|
31 |
|
|
Tsr = CrP*arg(16); |
32 |
|
|
Tsg = CgP*arg(17); |
33 |
|
|
Tsb = CbP*arg(18); |
34 |
|
|
{ specular flux transfer, front } |
35 |
|
|
Sfr = arg(10) + Tsr; |
36 |
|
|
Sfg = arg(11) + Tsg; |
37 |
|
|
Sfb = arg(12) + Tsb; |
38 |
|
|
{ specular flux transfer, back } |
39 |
|
|
Sbr = arg(13) + Tsr; |
40 |
|
|
Sbg = arg(14) + Tsg; |
41 |
|
|
Sbb = arg(15) + Tsb; |
42 |
|
|
{ Fresnel reflection estimator for triple-glazing } |
43 |
|
|
FresR = exp(Rexp*abs(RdotP)) - exp(Rexp); |
44 |
|
|
specAdj(s) = s + (1-s)*FresR; |
45 |
|
|
{ Specular reflection, front & back } |
46 |
|
|
sr_red = specAdj(if(Rdot, arg(10) , arg(13))); |
47 |
|
|
sr_grn = specAdj(if(Rdot, arg(11) , arg(14))); |
48 |
|
|
sr_blu = specAdj(if(Rdot, arg(12) , arg(15))); |
49 |
|
|
{ Specular transmission } |
50 |
|
|
st_red = if(Rdot, Sfr, Sbr) - sr_red; |
51 |
|
|
st_grn = if(Rdot, Sfg, Sbg) - sr_grn; |
52 |
|
|
st_blu = if(Rdot, Sfb, Sbb) - sr_blu; |