--- ray/src/rt/rayinit.cal 2003/03/11 19:29:05 2.14 +++ ray/src/rt/rayinit.cal 2018/01/18 19:43:43 2.17 @@ -1,4 +1,4 @@ -{ RCSid $Id: rayinit.cal,v 2.14 2003/03/11 19:29:05 greg Exp $ } +{ RCSid $Id: rayinit.cal,v 2.17 2018/01/18 19:43:43 greg Exp $ } { Initialization file for Radiance. @@ -21,7 +21,7 @@ Lu, Lv - local (u,v) coordinates - For brdf functions, the following are also available: + For *func & *data materials, the following are also available: NxP, NyP, NzP - perturbed surface normal RdotP - perturbed ray dot product @@ -41,7 +41,7 @@ sin(x), cos(x), tan(x), asin(x), acos(x), - atan(x), atan2(y,x) - standard trig functions + atan(x), atan2(y,x) - standard trig functions (radians) floor(x), ceil(x) - g.l.b. & l.u.b. @@ -51,8 +51,6 @@ rand(x) - pseudo-random function (0 to 1) - hermite(p0,p1,r0,r1,t) - 1-dimensional hermite polynomial - noise3(x,y,z), noise3x(x,y,z), noise3y(x,y,z), noise3z(x,y,z) - noise function with gradient (-1 to 1) @@ -123,6 +121,11 @@ cross(i,v1,v2) : select(i, v1(2)*v2(3) - v1(3)*v2(2), fade(near_val,far_val,dist) : far_val + if (16-dist, (near_val-far_val)/(1+dist*dist), 0); +hermite(p0,p1,r0,r1,t) : p0 * ((2*t-3)*t*t+1) + + p1 * (-2*t+3)*t*t + + r0 * (((t-2)*t+1)*t) + + r1 * ((t-1)*t*t); + bezier(p1, p2, p3, p4, t) : p1 * (1+t*(-3+t*(3-t))) + p2 * 3*t*(1+t*(-2+t)) + p3 * 3*t*t*(1-t) + @@ -147,21 +150,21 @@ turbulencez(x,y,z,s) : if( s-1.01, 0, { Normal distribution from uniform range (0,1) } -un2`P(t) : t - (2.515517+t*(.802853+t*.010328))/ +un2`P.(t) : t - (2.515517+t*(.802853+t*.010328))/ (1+t*(1.432788+t*(.189269+t*.001308))) ; -un1`P(p) : un2`P(sqrt(-2*log(p))) ; +un1`P.(p) : un2`P.(sqrt(-2*log(p))) ; -unif2norm(p) : if( .5-p, -un1`P(p), un1`P(1-p) ) ; +unif2norm(p) : if( .5-p, -un1`P.(p), un1`P.(1-p) ) ; nrand(x) = unif2norm(rand(x)); { Local (u,v) coordinates for planar surfaces } -crosslen`P = Nx*Nx + Ny*Ny; +crosslen`P. = Nx*Nx + Ny*Ny; { U is distance from projected Z-axis } -U = if( crosslen`P - FTINY, - (Py*Nx - Px*Ny)/crosslen`P, +U = if( crosslen`P. - FTINY, + (Py*Nx - Px*Ny)/crosslen`P., Px); { V is defined so that N = U x V } -V = if( crosslen`P - FTINY, - Pz - Nz*(Px*Nx + Py*Ny)/crosslen`P, +V = if( crosslen`P. - FTINY, + Pz - Nz*(Px*Nx + Py*Ny)/crosslen`P., Py);