91 |
|
/* worth using? */ |
92 |
|
if (dtmp > FTINY) { |
93 |
|
copycolor(ctmp, np->scolor); |
94 |
< |
dtmp *= omega; |
94 |
> |
dtmp *= omega / np->pdot; |
95 |
|
scalecolor(ctmp, dtmp); |
96 |
|
addcolor(cval, ctmp); |
97 |
|
} |
108 |
|
if (ldot < -FTINY && np->tspec > FTINY && np->alpha2 > FTINY) { |
109 |
|
/* |
110 |
|
* Compute specular transmission. Specular transmission |
111 |
< |
* is unaffected by material color. |
111 |
> |
* is always modified by material color. |
112 |
|
*/ |
113 |
|
/* roughness + source */ |
114 |
|
dtmp = np->alpha2 + omega/(2.0*PI); |
116 |
|
dtmp = exp((DOT(np->pr->rdir,ldir)-1.)/dtmp)/(2.*PI)/dtmp; |
117 |
|
/* worth using? */ |
118 |
|
if (dtmp > FTINY) { |
119 |
< |
dtmp *= np->tspec * omega; |
120 |
< |
setcolor(ctmp, dtmp, dtmp, dtmp); |
119 |
> |
copycolor(ctmp, np->mcolor); |
120 |
> |
dtmp *= np->tspec * omega / np->pdot; |
121 |
> |
scalecolor(ctmp, dtmp); |
122 |
|
addcolor(cval, ctmp); |
123 |
|
} |
124 |
|
} |
155 |
|
/* get modifiers */ |
156 |
|
raytexture(r, m->omod); |
157 |
|
nd.pdot = raynormal(nd.pnorm, r); /* perturb normal */ |
158 |
+ |
if (nd.pdot < .001) |
159 |
+ |
nd.pdot = .001; /* non-zero for dirnorm() */ |
160 |
|
multcolor(nd.mcolor, r->pcol); /* modify material color */ |
161 |
|
transtest = 0; |
162 |
|
/* get specular component */ |
241 |
|
scalecolor(ctmp, nd.tdiff); |
242 |
|
else |
243 |
|
scalecolor(ctmp, nd.trans); |
244 |
< |
multcolor(ctmp, nd.mcolor); |
244 |
> |
multcolor(ctmp, nd.mcolor); /* modified by color */ |
245 |
|
addcolor(r->rcol, ctmp); |
246 |
|
flipsurface(r); |
247 |
|
} |