--- ray/src/gen/mkillum2.c 2007/12/06 19:40:43 2.25 +++ ray/src/gen/mkillum2.c 2007/12/13 07:03:37 2.28 @@ -1,5 +1,5 @@ #ifndef lint -static const char RCSid[] = "$Id: mkillum2.c,v 2.25 2007/12/06 19:40:43 greg Exp $"; +static const char RCSid[] = "$Id: mkillum2.c,v 2.28 2007/12/13 07:03:37 greg Exp $"; #endif /* * Routines to do the actual calculation for mkillum @@ -139,8 +139,7 @@ srcsamps( /* sample sources from this surface positi if (i < 0) continue; /* must not be important */ sr.rno = i; - d = getBSDF_incrad(il->sd, i); - d = 1.0/(PI*d*d); + d = 1.0/getBSDF_incohm(il->sd, i); } else { if (v[2] >= -FTINY) continue; /* only sample transmission */ @@ -151,7 +150,7 @@ srcsamps( /* sample sources from this surface positi j = d*nazi + 0.5; if (j >= nazi) j = 0; sr.rno = i*nazi + j; - d = nalt*nazi/PI; + d = nalt*nazi/PI * -v[2]; } d *= si.dom; /* solid angle correction */ scalecolor(sr.rcoef, d); @@ -393,6 +392,8 @@ my_face( /* make an illum face */ nalt = sqrt(il->sd->nout/PI) + .5; nazi = PI*nalt + .5; redistribute(il->sd, nalt, nazi, u, v, fa->norm, xfm); + if (!il->sampdens) + il->sampdens = nalt*nazi/PI + .999; } /* write out the face and its distribution */ if (average(il, distarr, n)) { @@ -586,6 +587,8 @@ my_ring( /* make an illum ring */ nalt = sqrt(il->sd->nout/PI) + .5; nazi = PI*nalt + .5; redistribute(il->sd, nalt, nazi, u, v, co->ad, xfm); + if (!il->sampdens) + il->sampdens = nalt*nazi/PI + .999; } /* write out the ring and its distribution */ if (average(il, distarr, n)) {