| 34 |
|
* 8 red grn blu rspec u-rough v-rough trans tspec |
| 35 |
|
*/ |
| 36 |
|
|
| 37 |
+ |
#define BSPEC(m) (6.0) /* specularity parameter b */ |
| 38 |
+ |
|
| 39 |
|
/* specularity flags */ |
| 40 |
|
#define SP_REFL 01 /* has reflected specular component */ |
| 41 |
|
#define SP_TRAN 02 /* has transmitted specular */ |
| 198 |
|
else |
| 199 |
|
setcolor(nd.scolor, 1.0, 1.0, 1.0); |
| 200 |
|
scalecolor(nd.scolor, nd.rspec); |
| 201 |
+ |
/* improved model */ |
| 202 |
+ |
dtmp = exp(-BSPEC(m)*nd.pdot); |
| 203 |
+ |
for (i = 0; i < 3; i++) |
| 204 |
+ |
colval(nd.scolor,i) += (1.0-colval(nd.scolor,i))*dtmp; |
| 205 |
+ |
nd.rspec += (1.0-nd.rspec)*dtmp; |
| 206 |
|
/* check threshold */ |
| 207 |
|
if (specthresh > FTINY && |
| 208 |
|
(specthresh >= 1.-FTINY || |
| 209 |
< |
specthresh > nd.rspec)) |
| 209 |
> |
specthresh + .05 - .1*frandom() > nd.rspec)) |
| 210 |
|
nd.specfl |= SP_RBLT; |
| 211 |
|
/* compute refl. direction */ |
| 212 |
|
for (i = 0; i < 3; i++) |
| 225 |
|
/* check threshold */ |
| 226 |
|
if (specthresh > FTINY && |
| 227 |
|
(specthresh >= 1.-FTINY || |
| 228 |
< |
specthresh > nd.tspec)) |
| 228 |
> |
specthresh + .05 - .1*frandom() > nd.tspec)) |
| 229 |
|
nd.specfl |= SP_TBLT; |
| 230 |
|
if (DOT(r->pert,r->pert) <= FTINY*FTINY) { |
| 231 |
|
VCOPY(nd.prdir, r->rdir); |