--- ray/src/rt/pmapamb.c 2015/02/24 19:39:26 2.1 +++ ray/src/rt/pmapamb.c 2015/05/27 17:05:13 2.4 @@ -4,10 +4,11 @@ Roland Schregle (roland.schregle@{hslu.ch, gmail.com}) (c) Fraunhofer Institute for Solar Energy Systems, - Lucerne University of Applied Sciences & Arts + (c) Lucerne University of Applied Sciences and Arts, + supported by the Swiss National Science Foundation (SNSF, #147053) ================================================================== - $Id: pmapamb.c,v 2.1 2015/02/24 19:39:26 greg Exp $ + $Id: pmapamb.c,v 2.4 2015/05/27 17:05:13 greg Exp $ */ @@ -57,8 +58,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);