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

File Contents

# User Rev Content
1 greg 1.2 { RCSid $Id: Ashikhmin.cal,v 1.1 2014/03/24 20:51:16 greg Exp $ }
2 greg 1.1 {
3     Ashikhmin-Shirley BRDF model
4    
5     Includes Schlick estimate of Fresnel fraction,
6     but unlike Radiance material, does not remove
7     this from diffuse component.
8     }
9     { Parameters (change these) }
10     MF : 30;
11     lcorr(r,g,b) : MF*(.265*r + .670*g + .065*b);
12     rho_d : lcorr(0.0039510616569, 0.0036905000484, 0.0027494885161);
13     rho_s : lcorr(0.0090625419097, 0.0083144131101, 0.0060292909118);
14     f0 : 0.9999999990000;
15     nu : 962.839595;
16     nv : 72.3236783;
17     { Lobe calculation }
18     abs(x) : if(x, x, -x);
19     Schlick(odoth) : f0 + (1-f0)*(1-odoth)^5;
20     lobe2(iz,oz,hx,hy,hz,odoth) : Schlick(odoth)*sqrt((nu+1)*(nv+1)) /
21     (8*PI*max(abs(iz),abs(oz))*odoth) *
22     abs(hz)^((hx*hx*nu + hy*hy*nv)/(1-hz*hz));
23     lobe1(iz,ox,oy,oz,hx,hy,hz,nf) :
24     lobe2(iz,oz,hx*nf,hy*nf,hz*nf,(ox*hx+oy*hy+oz*hz)*nf);
25     lobe(iz,ox,oy,oz,hx,hy,hz) : lobe1(iz,ox,oy,oz,hx,hy,hz,
26     1/sqrt(hx*hx+hy*hy+hz*hz));
27    
28     ashikhmin(ix,iy,iz,ox,oy,oz) : if( -iz*oz, 0,
29     rho_d/PI + rho_s*lobe(iz,ox,oy,oz,ix+ox,iy+oy,iz+oz) );