ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/cal/cal/LaFortune.cal
Revision: 1.3
Committed: Mon Jun 10 13:56:52 2019 UTC (4 years, 11 months ago) by greg
Branch: MAIN
CVS Tags: rad5R4, rad5R3, HEAD
Changes since 1.2: +1 -2 lines
Log Message:
Added max() and min() as .cal library functions

File Contents

# Content
1 { RCSid $Id: LaFortune.cal,v 1.2 2014/03/18 19:03:41 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 abs(x) : if(x, x, -x);
15 noneg(x) : if(x, x, 0);
16
17 { Normalization factor based on parameters }
18 snf(i) : (n(i)+2)/(2*PI*max(abs(Cx(i)),max(abs(Cy(i)),abs(Cz(i))))^n(i));
19
20 { CHANGE THE FOLOWING TO MATCH NL }
21 snfk(i) : select(i, snf(1), snf(2));
22
23 { Note that we assume i and o vectors are normalized, both pointing away }
24
25 sum(i,dx,dy,dz) : if(.5-i, 0, sum(i-1,dx,dy,dz) +
26 snfk(i)*noneg(Cx(i)*dx + Cy(i)*dy + Cz(i)*dz)^n(i));
27
28 lafortune(ix,iy,iz,ox,oy,oz) : if( -iz*oz, 0,
29 rho_d/PI + rho_s*sum(NL,ix*ox,iy*oy,iz*oz) );