| 34 |
|
* 8 red grn blu rspec u-rough v-rough trans tspec |
| 35 |
|
*/ |
| 36 |
|
|
| 37 |
– |
#define BSPEC(m) (6.0) /* specularity parameter b */ |
| 38 |
– |
|
| 37 |
|
/* specularity flags */ |
| 38 |
|
#define SP_REFL 01 /* has reflected specular component */ |
| 39 |
|
#define SP_TRAN 02 /* has transmitted specular */ |
| 196 |
|
else |
| 197 |
|
setcolor(nd.scolor, 1.0, 1.0, 1.0); |
| 198 |
|
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; |
| 199 |
|
/* check threshold */ |
| 200 |
|
if (specthresh > FTINY && |
| 201 |
< |
((specthresh >= 1.-FTINY || |
| 202 |
< |
specthresh + (.05 - .1*frandom()) > nd.rspec))) |
| 201 |
> |
(specthresh >= 1.-FTINY || |
| 202 |
> |
specthresh > nd.rspec)) |
| 203 |
|
nd.specfl |= SP_RBLT; |
| 204 |
|
/* compute refl. direction */ |
| 205 |
|
for (i = 0; i < 3; i++) |
| 217 |
|
nd.specfl |= SP_TRAN; |
| 218 |
|
/* check threshold */ |
| 219 |
|
if (specthresh > FTINY && |
| 220 |
< |
((specthresh >= 1.-FTINY || |
| 221 |
< |
specthresh + |
| 229 |
< |
(.05 - .1*frandom()) > nd.tspec))) |
| 220 |
> |
(specthresh >= 1.-FTINY || |
| 221 |
> |
specthresh > nd.tspec)) |
| 222 |
|
nd.specfl |= SP_TBLT; |
| 223 |
|
if (DOT(r->pert,r->pert) <= FTINY*FTINY) { |
| 224 |
|
VCOPY(nd.prdir, r->rdir); |