70 |
|
|
71 |
|
if (ldot > FTINY && np->rdiff > FTINY) { |
72 |
|
/* |
73 |
< |
* Compute and add diffuse component to returned color. |
74 |
< |
* The diffuse component will always be modified by the |
75 |
< |
* color of the material. |
73 |
> |
* Compute and add diffuse reflected component to returned |
74 |
> |
* color. The diffuse reflected component will always be |
75 |
> |
* modified by the color of the material. |
76 |
|
*/ |
77 |
|
copycolor(ctmp, np->mcolor); |
78 |
|
dtmp = ldot * omega * np->rdiff / PI; |
107 |
|
} |
108 |
|
if (ldot < -FTINY && np->tspec > FTINY && np->alpha2 > FTINY) { |
109 |
|
/* |
110 |
< |
* Compute specular transmission. |
110 |
> |
* Compute specular transmission. Specular transmission |
111 |
> |
* is unaffected 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) { |
118 |
– |
copycolor(ctmp, np->mcolor); |
119 |
|
dtmp *= np->tspec * omega; |
120 |
< |
scalecolor(ctmp, dtmp); |
120 |
> |
setcolor(ctmp, dtmp, dtmp, dtmp); |
121 |
|
addcolor(cval, ctmp); |
122 |
|
} |
123 |
|
} |
156 |
|
raytexture(r, m->omod); |
157 |
|
nd.pdot = raynormal(nd.pnorm, r); /* perturb normal */ |
158 |
|
multcolor(nd.mcolor, r->pcol); /* modify material color */ |
159 |
+ |
r->rt = r->rot; /* default ray length */ |
160 |
|
/* get specular component */ |
161 |
|
nd.rspec = m->oargs.farg[3]; |
162 |
|
|
183 |
|
rayvalue(&lr); |
184 |
|
multcolor(lr.rcol, nd.scolor); |
185 |
|
addcolor(r->rcol, lr.rcol); |
186 |
+ |
if (nd.rspec > 0.5 && m->omod == OVOID) |
187 |
+ |
r->rt = r->rot + lr.rt; |
188 |
|
} |
189 |
|
} |
190 |
|
} |
203 |
|
rayvalue(&lr); |
204 |
|
scalecolor(lr.rcol, nd.tspec); |
205 |
|
addcolor(r->rcol, lr.rcol); |
206 |
+ |
if (nd.tspec > .5) |
207 |
+ |
r->rt = r->rot + lr.rt; |
208 |
|
} |
209 |
|
} |
210 |
|
if (r->crtype & SHADOW) /* the rest is shadow */ |