ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/cal/cal/LaFortune.cal
Revision: 1.2
Committed: Tue Mar 18 19:03:41 2014 UTC (10 years ago) by greg
Branch: MAIN
CVS Tags: rad5R2, rad4R2P2, rad5R0, rad5R1, rad4R2, rad4R2P1
Changes since 1.1: +14 -13 lines
Log Message:
Added second lobe and tested

File Contents

# Content
1 { RCSid $Id: LaFortune.cal,v 1.1 2014/03/18 16:16:37 greg Exp $ }
2 { LaFortune reflectance model with N lobes }
3
4 { Sample parameters (change these) }
5 rho_d : 0.017615787130711;
6 rho_s : 0.654729812719232;
7 Cx(i) : select(i, -0.75, -0.78);
8 Cy(i) : select(i, -0.91, -.81);
9 Cz(i) : select(i, .75, .83);
10 n(i) : select(i, 30, 15);
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), snf(2));
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,dx,dy,dz) +
27 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,
30 rho_d/PI + rho_s*sum(NL,ix*ox,iy*oy,iz*oz) );