ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/cv/bsdf2rad.cal
Revision: 2.6
Committed: Tue Apr 11 18:26:55 2017 UTC (7 years ago) by greg
Branch: MAIN
CVS Tags: rad5R4, rad5R2, rad5R3, rad5R1, HEAD
Changes since 2.5: +3 -3 lines
Log Message:
Fixed BSDF material orientation for back side

File Contents

# Content
1 { RCSid $Id: bsdf2rad.cal,v 2.5 2017/04/11 02:34:10 greg Exp $ }
2 {
3 Calculation of false color scale for bsdf2rad.
4
5 Greg Ward April 2017
6 }
7 { Compute lines of latitude and longitude }
8 LATSTEP : 15*DEGREE;
9 LONGSTEP : 30*DEGREE; { must divide evenly into 90 degrees }
10 LATWIDTH : 0.7*DEGREE;
11 LONGWIDTH : 1.*DEGREE;
12
13 mylong = atan2(Ny,Nx);
14
15 latlong = if(LATWIDTH-mod(Acos(Nz)+LATWIDTH/2,LATSTEP), .05,
16 if(LONGWIDTH-mod(mylong+LONGWIDTH/2,90*DEGREE), .02,
17 if(LONGWIDTH-mod(mylong+LONGWIDTH/2,LONGSTEP), .3, 1)));
18
19 { Compute up vector corresponding to sphere position }
20 ur2 = Nx*Nx + Ny*Ny;
21 upx = Nx*Ny*(Nz - 1);
22 upy = if(ur2 - FTINY, Nx*Nx + Ny*Ny*Nz, Nz);
23 upz = -Ny*ur2;
24
25 interp_arr2`(i,x,f):(i+1-x)*f(i)+(x-i)*f(i+1);
26 interp_arr`(x,f):if(x-1,if(f(0)-x,interp_arr2(floor(x),x,f),f(f(0))),f(1));
27
28 def_redp(i):select(i,0.18848,0.05468174,
29 0.00103547,8.311144e-08,7.449763e-06,0.0004390987,0.001367254,
30 0.003076,0.01376382,0.06170773,0.1739422,0.2881156,0.3299725,
31 0.3552663,0.372552,0.3921184,0.4363976,0.6102754,0.7757267,
32 0.9087369,1,1,0.9863);
33 sca_red(x):interp_arr(x/0.0454545+1,def_redp);
34
35 def_grnp(i):select(i,0.0009766,2.35501e-05,
36 0.0008966244,0.0264977,0.1256843,0.2865799,0.4247083,0.4739468,
37 0.4402732,0.3671876,0.2629843,0.1725325,0.1206819,0.07316644,
38 0.03761026,0.01612362,0.004773749,6.830967e-06,0.00803605,
39 0.1008085,0.3106831,0.6447838,0.9707);
40 sca_grn(x):interp_arr(x/0.0454545+1,def_grnp);
41
42 def_blup(i):select(i,0.2666,0.3638662,0.4770437,
43 0.5131397,0.5363797,0.5193677,0.4085123,0.1702815,0.05314236,
44 0.05194055,0.08564082,0.09881395,0.08324373,0.06072902,
45 0.0391076,0.02315354,0.01284458,0.005184709,0.001691774,
46 2.432735e-05,1.212949e-05,0.006659406,0.02539);
47 sca_blu(x):interp_arr(x/0.0454545+1,def_blup);
48
49 { BSDF scale is based on distance from the origin }
50
51 dist_orig = sqrt(Px*Px + Py*Py + Pz*Pz);
52 bsdf_red = sca_red(dist_orig);
53 bsdf_grn = sca_grn(dist_orig);
54 bsdf_blu = sca_blu(dist_orig);