3 |
|
{ |
4 |
|
Initialization file for Radiance. |
5 |
|
|
6 |
– |
4/14/86 |
7 |
– |
} |
8 |
– |
|
9 |
– |
{ |
6 |
|
The following are predefined: |
7 |
|
|
8 |
|
Dx, Dy, Dz - ray direction |
91 |
|
|
92 |
|
noop(v) = v; |
93 |
|
clip(v) = bound(0,v,1); |
94 |
< |
noneg(v) = max(0,v); |
95 |
< |
red(r,g,b) = r; |
96 |
< |
green(r,g,b) = g; |
97 |
< |
blue(r,g,b) = b; |
94 |
> |
noneg(v) = if(v,v,0); |
95 |
> |
red(r,g,b) = if(r,r,0); |
96 |
> |
green(r,g,b) = if(g,g,0); |
97 |
> |
blue(r,g,b) = if(b,b,0); |
98 |
|
grey(r,g,b) = .3*r + .59*g + .11*b; |
99 |
|
clip_r(r,g,b) = bound(0,r,1); |
100 |
|
clip_g(r,g,b) = bound(0,g,1); |
130 |
|
turbulencec(x,y,z,s) = if( s-1.01, 0, |
131 |
|
sgn(noise3(x/s,y/s,z/s))*noise3c(x/s,y/s,z/s) + |
132 |
|
turbulencec(x,y,z,2*s) ); |
133 |
+ |
|
134 |
+ |
{ Normal distribution from uniform range (0,1) } |
135 |
+ |
|
136 |
+ |
un2`private(t) : t - (2.515517+t*(.802853+t*.010328))/ |
137 |
+ |
(1+t*(1.432788+t*(.189269+t*.001308))) ; |
138 |
+ |
un1`private(p) : un2`private(sqrt(log(1/p/p))) ; |
139 |
+ |
|
140 |
+ |
unif2norm(p) : if( .5-p, un1`private(p), -un1`private(1-p) ) ; |
141 |
+ |
|
142 |
+ |
nrand(x) = unif2norm(rand(x)); |
143 |
+ |
|
144 |
+ |
{ Local (u,v) coordinates for planar surfaces } |
145 |
+ |
crosslen`private = Nx*Nx + Ny*Ny; |
146 |
+ |
{ U is distance from origin in XY-plane } |
147 |
+ |
U = if( crosslen`private - FTINY, |
148 |
+ |
(Py*Nx - Px*Ny)/crosslen`private, |
149 |
+ |
Px); |
150 |
+ |
{ V is defined so that N = U x V } |
151 |
+ |
V = if( crosslen`private - FTINY, |
152 |
+ |
Pz - Nz*(Px*Nx + Py*Ny)/crosslen`private, |
153 |
+ |
Py); |