ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/cal/cal/LaFortune.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     { LaFortune reflectance model with N lobes }
3    
4     { Sample parameters (change these) }
5     rho_d : 0.136465483630983;
6     rho_s(i) : select(i, 0.144594472775860);
7     Cx(i) : select(i, -0.605122636448704);
8     Cy(i) : select(i, -0.664960041454502);
9     Cz(i) : select(i, 0.586571000768196);
10     n(i) : select(i, 29.629194300125050);
11     NL : n(0);
12    
13     { Useful functions }
14     max(a,b) : if(a-b, a, b);
15     abs(x) : if(x, x, -x);
16     noneg(x) : if(x, x, 0);
17    
18     { Normalization factor based on parameters }
19     snf(i) : (n(i)+2)/(2*PI*max(abs(Cx(i)),max(abs(Cy(i)),abs(Cz(i))))^n(i));
20    
21     { CHANGE THE FOLOWING TO MATCH NL }
22     snfk(i) : select(i, snf(1));
23    
24     { Note that we assume i and o vectors are normalized, both pointing away }
25    
26     sum(i,dx,dy,dz) : if(.5-i, 0, sum(i-1) +
27     rho_s(i)*snfk(i)*noneg(Cx(i)*dx + Cy(i)*dy + Cz(i)*dz)^n(i));
28    
29     lafortune(ix,iy,iz,ox,oy,oz) : if( -iz*oz, 0, rho_d/PI + sum(NL,ix*ox,iy*oy,iz*oz) );