--- ray/src/rt/normal.c 1989/06/07 08:35:14 1.3 +++ ray/src/rt/normal.c 1990/10/15 20:39:35 1.7 @@ -70,9 +70,9 @@ double omega; /* light source size */ if (ldot > FTINY && np->rdiff > FTINY) { /* - * Compute and add diffuse component to returned color. - * The diffuse component will always be modified by the - * color of the material. + * Compute and add diffuse reflected component to returned + * color. The diffuse reflected component will always be + * modified by the color of the material. */ copycolor(ctmp, np->mcolor); dtmp = ldot * omega * np->rdiff / PI; @@ -107,7 +107,8 @@ double omega; /* light source size */ } if (ldot < -FTINY && np->tspec > FTINY && np->alpha2 > FTINY) { /* - * Compute specular transmission. + * Compute specular transmission. Specular transmission + * is unaffected by material color. */ /* roughness + source */ dtmp = np->alpha2 + omega/(2.0*PI); @@ -115,9 +116,8 @@ double omega; /* light source size */ dtmp = exp((DOT(np->pr->rdir,ldir)-1.)/dtmp)/(2.*PI)/dtmp; /* worth using? */ if (dtmp > FTINY) { - copycolor(ctmp, np->mcolor); dtmp *= np->tspec * omega; - scalecolor(ctmp, dtmp); + setcolor(ctmp, dtmp, dtmp, dtmp); addcolor(cval, ctmp); } } @@ -129,8 +129,6 @@ register OBJREC *m; register RAY *r; { NORMDAT nd; - double ldot; - double omega; double dtmp; COLOR ctmp; register int i; @@ -156,6 +154,7 @@ register RAY *r; raytexture(r, m->omod); nd.pdot = raynormal(nd.pnorm, r); /* perturb normal */ multcolor(nd.mcolor, r->pcol); /* modify material color */ + r->rt = r->rot; /* default ray length */ /* get specular component */ nd.rspec = m->oargs.farg[3]; @@ -200,6 +199,8 @@ register RAY *r; rayvalue(&lr); scalecolor(lr.rcol, nd.tspec); addcolor(r->rcol, lr.rcol); + if (nd.tspec > .5) + r->rt = r->rot + lr.rt; } } if (r->crtype & SHADOW) /* the rest is shadow */