ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/rt/rayinit.cal
(Generate patch)

Comparing ray/src/rt/rayinit.cal (file contents):
Revision 2.13 by greg, Sat Feb 22 02:07:29 2003 UTC vs.
Revision 2.18 by greg, Fri Nov 30 18:43:57 2018 UTC

# Line 1 | Line 1
1 < { RCSid: $Id$ }
1 > { RCSid $Id$ }
2   {
3          Initialization file for Radiance.
4  
# Line 17 | Line 17
17          Kx, Ky, Kz                      - world k unit vector
18          arg(n)                          - real arguments, arg(0) is count
19  
20 <        For brdf functions, the following are also available:
20 >        For mesh objects, the following are available:
21  
22 +        Lu, Lv                          - local (u,v) coordinates
23 +
24 +        For *func & *data materials, the following are also available:
25 +
26          NxP, NyP, NzP                   - perturbed surface normal
27          RdotP                           - perturbed ray dot product
28          CrP, CgP, CbP                   - perturbed material color
# Line 37 | Line 41
41  
42          sin(x), cos(x), tan(x),
43          asin(x), acos(x),
44 <        atan(x), atan2(y,x)             - standard trig functions
44 >        atan(x), atan2(y,x)             - standard trig functions (radians)
45  
46          floor(x), ceil(x)               - g.l.b. & l.u.b.
47  
# Line 47 | Line 51
51  
52          rand(x)                         - pseudo-random function (0 to 1)
53  
50        hermite(p0,p1,r0,r1,t)          - 1-dimensional hermite polynomial
51
54          noise3(x,y,z), noise3x(x,y,z),
55          noise3y(x,y,z), noise3z(x,y,z)  - noise function with gradient (-1 to 1)
56  
# Line 119 | Line 121 | cross(i,v1,v2) : select(i,     v1(2)*v2(3) - v1(3)*v2(2),
121   fade(near_val,far_val,dist) : far_val +
122                  if (16-dist, (near_val-far_val)/(1+dist*dist), 0);
123  
124 + hermite(p0,p1,r0,r1,t) :        p0 * ((2*t-3)*t*t+1) +
125 +                                p1 * (-2*t+3)*t*t +
126 +                                r0 * (((t-2)*t+1)*t) +
127 +                                r1 * ((t-1)*t*t);
128 +
129   bezier(p1, p2, p3, p4, t) :     p1 * (1+t*(-3+t*(3-t))) +
130                                  p2 * 3*t*(1+t*(-2+t)) +
131                                  p3 * 3*t*t*(1-t) +
# Line 143 | Line 150 | turbulencez(x,y,z,s) : if( s-1.01, 0,
150  
151                          { Normal distribution from uniform range (0,1) }
152  
153 < un2`P(t) : t - (2.515517+t*(.802853+t*.010328))/
153 > un2`P.(t) : t - (2.515517+t*(.802853+t*.010328))/
154                  (1+t*(1.432788+t*(.189269+t*.001308))) ;
155 < un1`P(p) : un2`P(sqrt(-2*log(p))) ;
155 > un1`P.(p) : un2`P.(sqrt(-2*log(p))) ;
156  
157 < unif2norm(p) : if( .5-p, -un1`P(p), un1`P(1-p) ) ;
157 > unif2norm(p) : if( .5-p, -un1`P.(p), un1`P.(1-p) ) ;
158  
159   nrand(x) = unif2norm(rand(x));
160  
161                          { Local (u,v) coordinates for planar surfaces }
162 < crosslen`P = Nx*Nx + Ny*Ny;
162 > crosslen`P. = Nx*Nx + Ny*Ny;
163                          { U is distance from projected Z-axis }
164 < U = if( crosslen`P - FTINY,
165 <                (Py*Nx - Px*Ny)/crosslen`P,
164 > U = if( crosslen`P. - FTINY,
165 >                (Py*Nx - Px*Ny)/crosslen`P.,
166                  Px);
167                          { V is defined so that N = U x V }
168 < V = if( crosslen`P - FTINY,
169 <                Pz - Nz*(Px*Nx + Py*Ny)/crosslen`P,
168 > V = if( crosslen`P. - FTINY,
169 >                Pz - Nz*(Px*Nx + Py*Ny)/crosslen`P.,
170                  Py);
171 +
172 +                        { Local hemisphere direction for *func & *data types }
173 +                        { last 3 real args = unnormalized up-vector }
174 + Vux`P. = arg(AC-1)*NzP - arg(AC)*NyP;
175 + Vuy`P. = arg(AC)*NxP - arg(AC-2)*NzP;
176 + Vuz`P. = arg(AC-2)*NyP - arg(AC-1)*NxP;
177 + vnorm`P. = 1/sqrt(Vux`P.*Vux`P. + Vuy`P.*Vuy`P. + Vuz`P.*Vuz`P.);
178 + Vnx`P. = Vux`P.*vnorm`P.;
179 + Vny`P. = Vuy`P.*vnorm`P.;
180 + Vnz`P. = Vuz`P.*vnorm`P.;
181 + Unx`P. = NyP*Vnz`P. - NzP*Vny`P.;
182 + Uny`P. = NzP*Vnx`P. - NxP*Vnz`P.;
183 + Unz`P. = NxP*Vny`P. - NyP*Vnx`P.;
184 +                        { Transform vectors, normalized (dx,dy,dz) away from surf }
185 + Ldx(dx,dy,dz) = dx*Unx`P. + dy*Uny`P. + dz*Unz`P.;
186 + Ldy(dx,dy,dz) = dx*Vnx`P. + dy*Vny`P. + dz*Vnz`P.;
187 + Ldz(dx,dy,dz) = dx*NxP + dy*NyP + dz*NzP;
188 +                        { Incident vector transformed to our coords }
189 + Idx = Ldx(-Dx,-Dy,-Dz);
190 + Idy = Ldy(-Dx,-Dy,-Dz);
191 + Idz = RdotP;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines