--- ray/src/rt/aniso.c 1992/02/21 14:50:23 2.10 +++ ray/src/rt/aniso.c 1992/05/14 11:32:09 2.15 @@ -121,7 +121,7 @@ double omega; /* light source size */ /* worth using? */ if (dtmp > FTINY) { copycolor(ctmp, np->scolor); - dtmp *= omega / np->pdot; + dtmp *= omega * sqrt(ldot/np->pdot); scalecolor(ctmp, dtmp); addcolor(cval, ctmp); } @@ -146,7 +146,7 @@ double omega; /* light source size */ /* worth using? */ if (dtmp > FTINY) { copycolor(ctmp, np->mcolor); - dtmp *= np->tspec * omega / np->pdot; + dtmp *= np->tspec * omega * sqrt(ldot/np->pdot); scalecolor(ctmp, dtmp); addcolor(cval, ctmp); } @@ -205,8 +205,8 @@ register RAY *r; nd.rspec += (1.0-nd.rspec)*dtmp; /* check threshold */ if (specthresh > FTINY && - ((specthresh >= 1.-FTINY || - specthresh + (.05 - .1*frandom()) > nd.rspec))) + (specthresh >= 1.-FTINY || + specthresh + .05 - .1*frandom() > nd.rspec)) nd.specfl |= SP_RBLT; /* compute refl. direction */ for (i = 0; i < 3; i++) @@ -224,9 +224,8 @@ register RAY *r; nd.specfl |= SP_TRAN; /* check threshold */ if (specthresh > FTINY && - ((specthresh >= 1.-FTINY || - specthresh + - (.05 - .1*frandom()) > nd.tspec))) + (specthresh >= 1.-FTINY || + specthresh + .05 - .1*frandom() > nd.tspec)) nd.specfl |= SP_TBLT; if (DOT(r->pert,r->pert) <= FTINY*FTINY) { VCOPY(nd.prdir, r->rdir); @@ -246,7 +245,8 @@ register RAY *r; /* diffuse reflection */ nd.rdiff = 1.0 - nd.trans - nd.rspec; - if (r->ro->otype == OBJ_FACE || r->ro->otype == OBJ_RING) + if (r->ro != NULL && (r->ro->otype == OBJ_FACE || + r->ro->otype == OBJ_RING)) nd.specfl |= SP_FLAT; getacoords(r, &nd); /* set up coordinates */