ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/test/renders/aniso.cal
Revision: 1.1
Committed: Sat Nov 17 22:09:12 2018 UTC (6 years, 5 months ago) by greg
Branch: MAIN
Log Message:
Created rendering tests

File Contents

# User Rev Content
1 greg 1.1 { RCSid $Id$ }
2     { Ward-Geisler-Moroder-Duer anisotropic BSDF model }
3    
4     { Final 5 real arguments are alpha_x and alpha_y roughnesses and Up vector }
5    
6     ax = arg(AC-4); { ax is roughness in Up orientation }
7     ay = arg(AC-3);
8    
9     Up(i) = arg(AC-3+i); { up vector does not need to be normalized }
10     Vux = cross(1,Up,N);
11     Vuy = cross(2,Up,N);
12     Vuz = cross(3,Up,N);
13     vnorm = 1/sqrt(Vux*Vux + Vuy*Vuy + Vuz*Vuz);
14     Vnx = Vux*vnorm;
15     Vny = Vuy*vnorm;
16     Vnz = Vuz*vnorm;
17     Vn(i) = select(i, Vnx, Vny, Vnz);
18     Unx = cross(1,N,Vn);
19     Uny = cross(2,N,Vn);
20     Unz = cross(3,N,Vn);
21     { Transform vectors, normalized (dx,dy,dz) away from surf }
22     surf_dx(dx,dy,dz) = dx*Unx + dy*Uny + dz*Unz;
23     surf_dy(dx,dy,dz) = dx*Vnx + dy*Vny + dz*Vnz;
24     surf_dz(dx,dy,dz) = dx*Nx + dy*Ny + dz*Nz;
25    
26     inc_dx = surf_dx(-Dx,-Dy,-Dz);
27     inc_dy = surf_dy(-Dx,-Dy,-Dz);
28     inc_dz = Rdot;
29    
30     arefl(hx,hy,hz) = exp(-(hx*hx/(ax*ax) + hy*hy/(ay*ay))/(hz*hz)) *
31     (hx*hx + hy*hy + hz*hz) /
32     (PI*ax*ay*hz*hz*hz*hz);
33    
34     axmit(hx,hy,hz) = exp(-(hx*hx/(ax*ax) + hy*hy/(ay*ay))/(hz*hz)) /
35     (4*PI*ax*ay);
36    
37     dobsdf(sdx,sdy,sdz) = if(sdz, arefl(inc_dx+sdx, inc_dy+sdy, inc_dz+sdz),
38     axmit(inc_dx+sdx, inc_dy+sdy, inc_dz-sdz) / sqrt(-sdz*inc_dz) );
39    
40     absdf(ox,oy,oz) = dobsdf(surf_dx(ox,oy,oz), surf_dy(ox,oy,oz), surf_dz(ox,oy,oz));