ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/cal/cal/WalterBTDF.cal
Revision: 1.1
Committed: Tue Mar 18 16:16:37 2014 UTC (10 years, 1 month ago) by greg
Branch: MAIN
Log Message:
Added implementations of Walter et al.'s BTDF model and LaFortune BRDF

File Contents

# User Rev Content
1 greg 1.1 { RCSid $Id$ }
2     {
3     BTDF model by Walter et al.
4     }
5     { Model parameters (change these) }
6     ksint : 0.126221381019119;
7     sigma_i : 1.434228082595141;
8     sigma_o : 1.656368055960319;
9     f0 : 0.2;
10     alpha : 0.149990535073450;
11    
12     { Useful functions }
13     s(x) : x*x;
14     abs(x) : if(x, x, -x);
15     G(x) : 2/(1 + sqrt(1 + s(alpha)*(1-s(x))/s(x)));
16     F(w) : f0 + (1-f0)*(1-w)^5;
17     D(htn) : s(alpha)/PI/s( s(htn)*(s(alpha)-1) + 1 );
18    
19     { Lobe calculation }
20     lobe3(wiht,woht,win,won,htn) : abs(wiht)*abs(woht)/(abs(win)*abs(won)) *
21     s(sigma_o)*(1-F(wiht))*D(htn)*G(win)*G(won) /
22     s(sigma_i*wiht + sigma_o*woht);
23    
24     lobe2(ix,iy,iz,ox,oy,oz,htx,hty,htz,nf) : lobe3((ix*htx+iy*hty+iz*htz)*nf,
25     (ox*htx+oy*hty+oz*htz)*nf, iz, oz, htz*nf);
26    
27     lobe1(ix,iy,iz,ox,oy,oz,htx,hty,htz) : lobe2(ix,iy,iz,ox,oy,oz,htx,hty,htz,
28     1/sqrt(s(htx)+s(hty)+s(htz)));
29    
30     { Final function call - transmission only! }
31     { vectors normalized, pointing away from surface }
32     walter(ix,iy,iz,ox,oy,oz) : if(iz*oz, 0,
33     ksint * lobe1(ix,iy,iz,ox,oy,oz,
34     -sigma_i*ix-sigma_o*ox,
35     -sigma_i*iy-sigma_o*oy,
36     -sigma_i*iz-sigma_o*oz) );