--- ray/src/rt/pmapamb.c 2015/05/08 13:20:23 2.2 +++ ray/src/rt/pmapamb.c 2015/08/18 18:45:55 2.6 @@ -1,3 +1,6 @@ +#ifndef lint +static const char RCSid[] = "$Id: pmapamb.c,v 2.6 2015/08/18 18:45:55 greg Exp $"; +#endif /* ================================================================== Photon map interface to RADIANCE ambient calculation @@ -8,7 +11,7 @@ supported by the Swiss National Science Foundation (SNSF, #147053) ================================================================== - $Id: pmapamb.c,v 2.2 2015/05/08 13:20:23 rschregle Exp $ + $Id: pmapamb.c,v 2.6 2015/08/18 18:45:55 greg Exp $ */ @@ -58,8 +61,9 @@ int ambPmapCaustic (COLOR aval, RAY *r, int rdepth) /* Handle precedence in case of multiple photon maps: contrib > caustic */ PhotonMap *pmap = contribPhotonMapping ? contribPmap : causticPmap; - /* Get caustic photon density estimate only at primary rays */ - if (pmap && !rdepth) { + /* Get caustic photon density estimate at primary rays or when + * filling in ambient rays that have no global photon map to use */ + if (pmap && (!rdepth || !globalPmap & !contribPmap & !preCompPmap)) { /* Temporarily factor ambient value into ray coefficient * (required for contribution photon map) */ copycolor(rcoef, r -> rcoef);