--- ray/src/rt/rayinit.cal 1998/10/19 15:45:30 2.12 +++ ray/src/rt/rayinit.cal 2018/01/18 19:43:43 2.17 @@ -1,5 +1,4 @@ -{ SCCSid "$SunId$ LBL" } - +{ RCSid $Id: rayinit.cal,v 2.17 2018/01/18 19:43:43 greg Exp $ } { Initialization file for Radiance. @@ -18,8 +17,12 @@ Kx, Ky, Kz - world k unit vector arg(n) - real arguments, arg(0) is count - For brdf functions, the following are also available: + For mesh objects, the following are available: + Lu, Lv - local (u,v) coordinates + + For *func & *data materials, the following are also available: + NxP, NyP, NzP - perturbed surface normal RdotP - perturbed ray dot product CrP, CgP, CbP - perturbed material color @@ -38,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. @@ -48,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) @@ -88,6 +89,7 @@ FTINY : 1e-7; and(a,b) : if( a, b, a ); or(a,b) : if( a, a, b ); not(a) : if( a, -1, 1 ); +xor(a,b) : if( a, not(b), b ); abs(x) : if( x, x, -x ); sgn(x) : if( x, 1, if(-x, -1, 0) ); sq(x) : x*x; @@ -119,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) + @@ -143,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);