--- ray/src/rt/dielectric.c 1989/02/02 10:41:21 1.1 +++ ray/src/rt/dielectric.c 1990/05/30 19:56:58 1.4 @@ -57,7 +57,7 @@ register RAY *r; double cos1, cos2, nratio; COLOR mcolor; double mabsorp; - double refl, trans; + double refl, trans, transbright; FVECT dnorm; double d1, d2; RAY p; @@ -92,7 +92,7 @@ register RAY *r; else setcolor(mcolor, 1.0, 1.0, 1.0); } - mabsorp = intens(mcolor); + mabsorp = bright(mcolor); d2 = 1.0 - nratio*nratio*(1.0 - cos1*cos1); /* compute cos theta2 */ @@ -115,6 +115,7 @@ register RAY *r; refl /= 2.0; trans = 1.0 - refl; + transbright = -FTINY; if (rayorigin(&p, r, REFRACTED, mabsorp*trans) == 0) { @@ -135,6 +136,8 @@ register RAY *r; multcolor(mcolor, r->pcol); /* modify */ scalecolor(p.rcol, trans); addcolor(r->rcol, p.rcol); + transbright = bright(p.rcol); + r->rt = r->rot + p.rt; } } } @@ -150,6 +153,8 @@ register RAY *r; scalecolor(p.rcol, refl); /* color contribution */ addcolor(r->rcol, p.rcol); + if (bright(p.rcol) > transbright) + r->rt = r->rot + p.rt; } multcolor(r->rcol, mcolor); /* multiply by transmittance */ @@ -253,7 +258,7 @@ double tr; /* trace source ray */ normalize(sray.rdir); rayvalue(&sray); - if (intens(sray.rcol) <= FTINY) /* missed it */ + if (bright(sray.rcol) <= FTINY) /* missed it */ continue; /*