ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/cal/cal/WalterBTDF.cal
Revision: 1.2
Committed: Wed Mar 19 19:06:20 2014 UTC (10 years, 1 month ago) by greg
Branch: MAIN
CVS Tags: rad5R4, rad5R2, rad4R2P2, rad5R0, rad5R1, rad4R2, rad4R2P1, rad5R3, HEAD
Changes since 1.1: +8 -6 lines
Log Message:
Created BSDF version of Walter et al.

File Contents

# Content
1 { RCSid $Id: WalterBTDF.cal,v 1.1 2014/03/18 16:16:37 greg Exp $ }
2 {
3 Isotropic 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 noneg(x) : if(x, x, 0);
16
17 { Lobe calculation }
18 G(x) : 2/(1 + sqrt(1 + s(alpha)*(1-s(x))/s(x)));
19 F(w) : f0 + (1-f0)*(1-w)^5;
20 D(htn) : s(alpha)/PI/s( s(htn)*(s(alpha)-1) + 1 );
21
22 lobe3(wiht,woht,win,won,htn) : abs(wiht*woht/(win*won)) *
23 s(sigma_o)*(1-F(wiht))*D(htn)*G(win)*G(won) /
24 s(sigma_i*wiht + sigma_o*woht);
25
26 lobe2(ix,iy,iz,ox,oy,oz,htx,hty,htz,nf) : lobe3((ix*htx+iy*hty+iz*htz)*nf,
27 (ox*htx+oy*hty+oz*htz)*nf, iz, oz, htz*nf);
28
29 lobe1(ix,iy,iz,ox,oy,oz,htx,hty,htz) : lobe2(ix,iy,iz,ox,oy,oz,htx,hty,htz,
30 1/sqrt(s(htx)+s(hty)+s(htz)));
31
32 { Final function call - transmission only! }
33 { vectors normalized, pointing away from surface }
34 walter(ix,iy,iz,ox,oy,oz) : if(iz*oz, 0,
35 ksint*noneg(lobe1(ix,iy,iz,ox,oy,oz,
36 -sigma_i*ix-sigma_o*ox,
37 -sigma_i*iy-sigma_o*oy,
38 -sigma_i*iz-sigma_o*oz)) );