--- ray/src/common/tonemap.c 2006/06/07 17:52:03 3.27 +++ ray/src/common/tonemap.c 2006/08/09 16:26:54 3.28 @@ -1,5 +1,5 @@ #ifndef lint -static const char RCSid[] = "$Id: tonemap.c,v 3.27 2006/06/07 17:52:03 schorsch Exp $"; +static const char RCSid[] = "$Id: tonemap.c,v 3.28 2006/08/09 16:26:54 greg Exp $"; #endif /* * Tone mapping functions. @@ -458,10 +458,12 @@ double gamval if (gamval < MINGAM) gamval = tms->mongam; d = log(expmult/tms->inpsf); - for (i = tms->mbrmax-tms->mbrmin+1; i--; ) - tms->lumap[i] = 256. * exp( + for (i = tms->mbrmax-tms->mbrmin+1; i--; ) { + double val = 256. * exp( ( d + (tms->mbrmin+i)*(1./TM_BRTSCALE) ) - / gamval ); + / gamval); + tms->lumap[i] = val >= (double)0xffff ? 0xffff : (int)val; + } returnOK; }