--- ray/src/rt/glass.c 1989/02/02 10:41:24 1.1 +++ ray/src/rt/glass.c 1991/05/07 17:45:51 1.6 @@ -60,6 +60,7 @@ register RAY *r; if (r->rod < 0.0) /* reorient if necessary */ flipsurface(r); + r->rt = r->rot; /* default ray length */ /* get modifiers */ raytexture(r, m->omod); pdot = raynormal(pnorm, r); @@ -80,13 +81,18 @@ register RAY *r; colval(trans,i) = (1.0-r1)*(1.0-r1)*d / (1.0 - r1*r1*d*d); } /* transmitted ray */ - if (rayorigin(&p, r, TRANS, intens(trans)) == 0) { - VCOPY(p.rdir, r->rdir); + if (rayorigin(&p, r, TRANS, bright(trans)) == 0) { + for (i = 0; i < 3; i++) /* perturb direction */ + p.rdir[i] = r->rdir[i] - r->pert[i]/RINDEX; + normalize(p.rdir); rayvalue(&p); multcolor(p.rcol, r->pcol); /* modify */ multcolor(p.rcol, trans); addcolor(r->rcol, p.rcol); + if (bright(p.rcol) > .5) + r->rt = r->rot + p.rt; } + if (r->crtype & SHADOW) /* skip reflected ray */ return; /* compute reflectance */ @@ -96,7 +102,7 @@ register RAY *r; colval(refl,i) = r1 * (1.0 + (1.0-2.0*r1)*d) / (1.0 - r1*r1*d); } /* reflected ray */ - if (rayorigin(&p, r, REFLECTED, intens(refl)) == 0) { + if (rayorigin(&p, r, REFLECTED, bright(refl)) == 0) { for (i = 0; i < 3; i++) p.rdir[i] = r->rdir[i] + 2.0*pdot*pnorm[i]; rayvalue(&p);