ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/rt/pmapmat.c
(Generate patch)

Comparing ray/src/rt/pmapmat.c (file contents):
Revision 2.5 by greg, Thu May 21 05:54:54 2015 UTC vs.
Revision 2.14 by rschregle, Fri Feb 2 19:47:55 2018 UTC

# Line 1 | Line 1
1 + #ifndef lint
2 + static const char RCSid[] = "$Id$";
3 + #endif
4   /*
5     ==================================================================
6     Photon map support routines for scattering by materials.
# Line 8 | Line 11
11     supported by the Swiss National Science Foundation (SNSF, #147053)
12     ==================================================================
13    
11   $Id$
14   */
15  
16  
# Line 104 | Line 106 | void photonRay (const RAY *rayIn, RAY *rayOut,
106   {
107     rayorigin(rayOut, rayOutType, rayIn, NULL);
108    
109 <   /* Transfer flux */
110 <   copycolor(rayOut -> rcol, rayIn -> rcol);
111 <  
112 <   /* Copy caustic flag & direction for transferred rays */
113 <   if (rayOutType == PMAP_XFER) {
114 <      /* rayOut -> rtype |= rayIn -> rtype & SPECULAR; */
115 <      rayOut -> rtype |= rayIn -> rtype;
116 <      VCOPY(rayOut -> rdir, rayIn -> rdir);
117 <   }
118 <   else if (fluxAtten) {
119 <      /* Attenuate and normalise flux for scattered rays */
120 <      multcolor(rayOut -> rcol, fluxAtten);
121 <      colorNorm(rayOut -> rcol);
122 <   }
109 >   if (rayIn) {
110 >      /* Transfer flux */
111 >      copycolor(rayOut -> rcol, rayIn -> rcol);
112 >      
113 >      /* Copy caustic flag & direction for transferred rays */
114 >      if (rayOutType == PMAP_XFER) {
115 >         /* rayOut -> rtype |= rayIn -> rtype & SPECULAR; */
116 >         rayOut -> rtype |= rayIn -> rtype;
117 >         VCOPY(rayOut -> rdir, rayIn -> rdir);
118 >      }
119 >      else if (fluxAtten) {
120 >         /* Attenuate and normalise flux for scattered rays */
121 >         multcolor(rayOut -> rcol, fluxAtten);
122 >         colorNorm(rayOut -> rcol);
123 >      }
124  
125 <   /* Propagate index of emitting light source */
126 <   rayOut -> rsrc = rayIn -> rsrc;
125 >      /* Propagate index of emitting light source */
126 >      rayOut -> rsrc = rayIn -> rsrc;
127 >      
128 >      /* Update maximum photon path distance */
129 >      rayOut -> rmax = rayIn -> rmax - rayIn -> rot;
130 >   }
131   }
132  
133  
# Line 130 | Line 137 | static void addPhotons (const RAY *r)
137   {
138     if (!r -> rlvl)
139        /* Add direct photon map at primary hitpoint */
140 <      addPhoton(directPmap, r);
140 >      newPhoton(directPmap, r);
141     else {
142        /* Add global or precomputed photon map at indirect hitpoint */
143 <      addPhoton(preCompPmap ? preCompPmap : globalPmap, r);
143 >      newPhoton(preCompPmap ? preCompPmap : globalPmap, r);
144  
145        /* Store caustic photon if specular flag set */
146        if (PMAP_CAUSTICRAY(r))
147 <         addPhoton(causticPmap, r);
147 >         newPhoton(causticPmap, r);
148          
149        /* Store in contribution photon map */
150 <      addPhoton(contribPmap, r);
150 >      newPhoton(contribPmap, r);
151     }
152   }
153  
# Line 976 | Line 983 | static int aliasPhotonScatter (OBJREC *mat, RAY *rayIn
983    
984     /* Straight replacement? */
985     if (!mat -> oargs.nsargs) {
986 <      mat = objptr(mat -> omod);
987 <      photonScatter [mat -> otype] (mat, rayIn);
986 >      /* Skip void modifier! */
987 >      if (mat -> omod != OVOID) {  
988 >         mat = objptr(mat -> omod);
989 >         photonScatter [mat -> otype] (mat, rayIn);
990 >      }
991        
992        return 0;
993     }
# Line 1248 | Line 1258 | static int mx_dataPhotonScatter (OBJREC *mat, RAY *ray
1258     if (errno)
1259        objerror(mat, WARNING, "compute error");
1260     else {
1261 <      mat = objptr(mod [pmapRandom(rouletteState) < coef ? 0 : 1]);
1262 <      photonScatter [mat -> otype] (mat, rayIn);
1261 >      OBJECT mxMod = mod [pmapRandom(rouletteState) < coef ? 0 : 1];
1262 >      
1263 >      if (mxMod != OVOID) {
1264 >         mat = objptr(mxMod);
1265 >         photonScatter [mat -> otype] (mat, rayIn);
1266 >      }
1267 >      else {
1268 >         /* Transfer ray if no modifier */
1269 >         RAY rayOut;
1270 >        
1271 >         photonRay(rayIn, &rayOut, PMAP_XFER, NULL);
1272 >         tracePhoton(&rayOut);      
1273 >      }            
1274     }
1275    
1276     return 0;
# Line 1301 | Line 1322 | static int mx_pdataPhotonScatter (OBJREC *mat, RAY *ra
1322     if (errno)
1323        objerror(mat, WARNING, "compute error");
1324     else {
1325 <      mat = objptr(mod [pmapRandom(rouletteState) < coef ? 0 : 1]);
1326 <      photonScatter [mat -> otype] (mat, rayIn);
1325 >      OBJECT mxMod = mod [pmapRandom(rouletteState) < coef ? 0 : 1];
1326 >      
1327 >      if (mxMod != OVOID) {
1328 >         mat = objptr(mxMod);
1329 >         photonScatter [mat -> otype] (mat, rayIn);
1330 >      }
1331 >      else {
1332 >         /* Transfer ray if no modifier */
1333 >         RAY rayOut;
1334 >        
1335 >         photonRay(rayIn, &rayOut, PMAP_XFER, NULL);
1336 >         tracePhoton(&rayOut);      
1337 >      }      
1338     }  
1339    
1340     return 0;
# Line 1341 | Line 1373 | static int mx_funcPhotonScatter (OBJREC *mat, RAY *ray
1373     if (errno)
1374        objerror(mat, WARNING, "compute error");
1375     else {        
1376 <      mat = objptr(mod [pmapRandom(rouletteState) < coef ? 0 : 1]);
1377 <      photonScatter [mat -> otype] (mat, rayIn);
1376 >      OBJECT mxMod = mod [pmapRandom(rouletteState) < coef ? 0 : 1];
1377 >      
1378 >      if (mxMod != OVOID) {
1379 >         mat = objptr(mxMod);
1380 >         photonScatter [mat -> otype] (mat, rayIn);
1381 >      }
1382 >      else {
1383 >         /* Transfer ray if no modifier */
1384 >         RAY rayOut;
1385 >        
1386 >         photonRay(rayIn, &rayOut, PMAP_XFER, NULL);
1387 >         tracePhoton(&rayOut);      
1388 >      }
1389     }
1390    
1391     return 0;
# Line 1374 | Line 1417 | static int pattexPhotonScatter (OBJREC *mat, RAY *rayI
1417  
1418  
1419  
1377 #if 0
1378   static int bsdfPhotonScatter (OBJREC *mat, RAY *rayIn)
1379   /* Generate new photon ray for BSDF modifier and recurse. */
1380   {
1381      int      hitFront;
1382      SDError  err;
1383      FVECT        upvec;
1384      MFUNC        *mf;
1385      BSDFDAT   nd;
1386      RAY      rayOut;
1387
1388      /* Following code adapted from m_bsdf() */
1389      /* Check arguments */
1390      if (mat -> oargs.nsargs < 6 || mat -> oargs.nfargs > 9 ||
1391          mat -> oargs.nfargs % 3)
1392         objerror(mat, USER, "bad # arguments");
1393        
1394      hitFront = (rayIn -> rod > 0);
1395
1396      /* Load cal file */
1397      mf = getfunc(mat, 5, 0x1d, 1);
1398      
1399      /* Get thickness */
1400      nd.thick = evalue(mf -> ep [0]);
1401      if ((-FTINY <= nd.thick) & (nd.thick <= FTINY))
1402         nd.thick = .0;
1403        
1404      if (nd.thick != .0 || (!hitFront && !backvis)) {
1405         /* Proxy geometry present, so use it instead and transfer ray */
1406         photonRay(rayIn, &rayOut, PMAP_XFER, NULL);
1407         tracePhoton(&rayOut);
1408        
1409         return 0;
1410      }
1411
1412      /* Get BSDF data */
1413      nd.sd = loadBSDF(mat -> oargs.sarg [1]);
1414      
1415      /* Diffuse reflectance */
1416      if (hitFront) {
1417         if (mat -> oargs.nfargs < 3)
1418            setcolor(nd.rdiff, .0, .0, .0);
1419         else setcolor(nd.rdiff, mat -> oargs.farg [0], mat -> oargs.farg [1],
1420                       mat -> oargs.farg [2]);
1421      }    
1422      else if (mat -> oargs.nfargs < 6) {
1423         /* Check for absorbing backside */
1424         if (!backvis && !nd.sd -> rb && !nd.sd -> tf) {
1425            SDfreeCache(nd.sd);                    
1426            return 0;
1427         }
1428        
1429         setcolor(nd.rdiff, .0, .0, .0);
1430      }
1431      else setcolor(nd.rdiff, mat -> oargs.farg [3], mat -> oargs.farg [4],
1432                    mat -> oargs.farg [5]);
1433
1434      /* Diffuse transmittance */
1435      if (mat -> oargs.nfargs < 9)
1436         setcolor(nd.tdiff, .0, .0, .0);
1437      else setcolor(nd.tdiff, mat -> oargs.farg [6], mat -> oargs.farg [7],
1438                    mat -> oargs.farg [8]);
1439                  
1440      nd.mp = mat;
1441      nd.pr = rayIn;
1442      
1443      /* Get modifiers */
1444      raytexture(rayIn, mat -> omod);
1445      
1446      /* Modify diffuse values */
1447      multcolor(nd.rdiff, rayIn -> pcol);
1448      multcolor(nd.tdiff, rayIn -> pcol);
1449        
1450      /* Get up vector & xform to world coords */
1451      upvec [0] = evalue(mf -> ep [1]);
1452      upvec [1] = evalue(mf -> ep [2]);
1453      upvec [2] = evalue(mf -> ep [3]);
1454      
1455      if (mf -> fxp != &unitxf) {
1456         multv3(upvec, upvec, mf -> fxp -> xfm);
1457         nd.thick *= mf -> fxp -> sca;
1458      }
1459      
1460      if (rayIn -> rox) {
1461         multv3(upvec, upvec, rayIn -> rox -> f.xfm);
1462         nd.thick *= rayIn -> rox -> f.sca;
1463      }
1464      
1465      /* Perturb normal */
1466      raynormal(nd.pnorm, rayIn);
1467      
1468      /* Xform incident dir to local BSDF coords */
1469      err = SDcompXform(nd.toloc, nd.pnorm, upvec);
1470      
1471      if (!err) {
1472         nd.vray [0] = -rayIn -> rdir [0];
1473         nd.vray [1] = -rayIn -> rdir [1];
1474         nd.vray [2] = -rayIn -> rdir [2];
1475         err = SDmapDir(nd.vray, nd.toloc, nd.vray);
1476      }
1477      
1478      if (!err)
1479         err = SDinvXform(nd.fromloc, nd.toloc);
1480        
1481      if (err) {
1482         objerror(mat, WARNING, "Illegal orientation vector");
1483         return 0;
1484      }
1485      
1486      /* Determine BSDF resolution */
1487      err = SDsizeBSDF(nd.sr_vpsa, nd.vray, NULL, SDqueryMin + SDqueryMax, nd.sd);
1488      
1489      if (err)
1490         objerror(mat, USER, transSDError(err));
1491        
1492      nd.sr_vpsa [0] = sqrt(nd.sr_vpsa [0]);
1493      nd.sr_vpsa [1] = sqrt(nd.sr_vpsa [1]);
1494
1495      /* Orient perturbed normal towards incident side */
1496      if (!hitFront) {                  
1497         nd.pnorm [0] = -nd.pnorm [0];
1498         nd.pnorm [1] = -nd.pnorm [1];
1499         nd.pnorm [2] = -nd.pnorm [2];
1500      }
1501      
1502      /* Following code adapted from SDsampBSDF() */
1503      {
1504         SDSpectralDF   *rdf, *tdf;
1505         SDValue        bsdfVal;
1506         double         xi, rhoDiff = 0;
1507         float          coef [SDmaxCh];
1508         int            i, j, n, nr;
1509         SDComponent       *sdc;
1510         const SDCDst   **cdarr = NULL;
1511        
1512         /* Get diffuse albedo (?) */
1513         if (hitFront) {
1514            bsdfVal = nd.sd -> rLambFront;
1515            rdf = nd.sd -> rf;
1516            tdf = nd.sd -> tf ? nd.sd -> tf : nd.sd -> tb;
1517         }
1518         else {
1519            bsdfVal = nd.sd -> rLambBack;
1520            rdf = nd.sd -> rb;
1521            tdf = nd.sd -> tb ? nd.sd -> tb : nd.sd -> tf;
1522         }
1523        
1524         rhoDiff = bsdfVal.cieY;
1525         bsdfVal.cieY += nd.sd -> tLamb.cieY;
1526        
1527         /* Allocate non-diffuse sampling */
1528         i = nr = rdf ? rdf -> ncomp : 0;
1529         j = tdf ? tdf -> ncomp : 0;
1530         n = i + j;
1531        
1532         if (n > 0 && !(cdarr = (const SDCDst**)malloc(n * sizeof(SDCDst*))))
1533            objerror(mat, USER, transSDError(SDEmemory));
1534            
1535         while (j-- > 0) {
1536            /* Sum up non-diffuse transmittance */
1537            cdarr [i + j] = (*tdf -> comp [j].func -> getCDist)(nd.vray, &tdf -> comp [j]);
1538            
1539            if (!cdarr [i + j])
1540               cdarr [i + j] = &SDemptyCD;
1541            else bsdfVal.cieY += cdarr [i + j] -> cTotal;
1542         }
1543        
1544         while (i-- > 0) {
1545            /* Sum up non-diffuse reflectance */
1546            cdarr [i] = (*rdf -> comp [i].func -> getCDist)(nd.vray, &rdf -> comp [i]);
1547            
1548            if (!cdarr [i])
1549               cdarr [i] = &SDemptyCD;
1550            else bsdfVal.cieY += cdarr [i] -> cTotal;
1551         }
1552        
1553         if (bsdfVal.cieY <= FTINY) {
1554            /* Don't bother sampling, just absorb photon */
1555            if (cdarr)
1556               free(cdarr);
1557            return 0;
1558         }      
1559        
1560         /* Insert direct and indirect photon hits if diffuse component */
1561         if (rhoDiff > FTINY || nd.sd -> tLamb.cieY > FTINY)
1562            addPhotons(rayIn);  
1563            
1564         xi = pmapRandom(rouletteState);
1565        
1566         if ((xi -= rhoDiff) <= 0) {
1567            /* Diffuse reflection */
1568            photonRay(rayIn, &rayOut, PMAP_DIFFREFL, nd.rdiff);
1569            diffPhotonScatter(nd.pnorm, &rayOut);
1570         }
1571         else if ((xi -= nd.sd -> tLamb.cieY) <= 0) {
1572            /* Diffuse transmission */
1573            flipsurface(rayIn);
1574            photonRay(rayIn, &rayOut, PMAP_DIFFTRANS, nd.tdiff);
1575            bsdfVal.spec = nd.sd -> tLamb.spec;
1576            diffPhotonScatter(nd.pnorm, &rayOut);
1577         }
1578         else {
1579            int rayOutType;
1580            COLOR bsdfRGB;
1581              
1582            /* Non-diffuse CDF inversion (?) */
1583            for (i = 0; i < n && (xi -= cdarr [i] -> cTotal) > 0; i++);
1584            
1585            if (i >= n) {
1586               /* Absorbed -- photon went Deer Hunter */
1587               if (cdarr)
1588                  free(cdarr);
1589               return 0;
1590            }
1591
1592            if (i < nr) {
1593               /* Non-diffuse reflection */
1594               sdc = &rdf -> comp [i];
1595               rayOutType = PMAP_SPECREFL;
1596            }
1597            else {
1598               /* Non-diffuse transmission */
1599               sdc = &tdf -> comp [i - nr];
1600               rayOutType = PMAP_SPECTRANS;
1601            }
1602            
1603            /* Generate non-diff sample dir */
1604            VCOPY(rayOut.rdir, nd.vray);
1605            err = (*sdc -> func -> sampCDist)
1606                  (rayOut.rdir, pmapRandom(scatterState), cdarr [i]);              
1607            if (err)
1608               objerror(mat, USER, transSDError(SDEinternal));
1609
1610            /* Get colour */
1611            j = (*sdc -> func -> getBSDFs)(coef, rayOut.rdir, nd.vray, sdc);
1612            
1613            if (j <= 0) {
1614               sprintf(SDerrorDetail, "BSDF \"%s\" sampling value error",
1615                       nd.sd -> name);
1616               objerror(mat, USER, transSDError(SDEinternal));
1617            }
1618            
1619            bsdfVal.spec = sdc -> cspec [0];
1620            rhoDiff = coef [0];
1621            
1622            while (--j) {
1623               c_cmix(&bsdfVal.spec, rhoDiff, &bsdfVal.spec, coef [j],
1624                      &sdc -> cspec [j]);
1625               rhoDiff += coef [j];
1626            }
1627            
1628            /* ? */
1629            c_ccvt(&bsdfVal.spec, C_CSXY + C_CSSPEC);
1630            ccy2rgb(&bsdfVal.spec, bsdfVal.cieY, bsdfRGB);
1631            
1632            /* Xform outgoing dir to world coords */
1633            if ((err = SDmapDir(rayOut.rdir, nd.fromloc, rayOut.rdir))) {
1634               objerror(mat, USER, transSDError(err));
1635               return 0;
1636            }
1637            
1638            photonRay(rayIn, &rayOut, rayOutType, bsdfRGB);
1639         }
1640        
1641         if (cdarr)
1642            free(cdarr);
1643      }
1644                          
1645      /* Clean up BSDF */
1646      SDfreeCache(nd.sd);
1647
1648      tracePhoton(&rayOut);
1649      return 0;
1650   }
1651 #else
1652
1420   /*
1421 +   ==================================================================
1422     The following code is
1423     (c) Lucerne University of Applied Sciences and Arts,
1424     supported by the Swiss National Science Foundation (SNSF, #147053)
1425 +   ==================================================================
1426   */  
1427  
1428   static int bsdfPhotonScatter (OBJREC *mat, RAY *rayIn)
# Line 1667 | Line 1436 | static int bsdfPhotonScatter (OBJREC *mat, RAY *rayIn)
1436     BSDFDAT      nd;
1437     RAY      rayOut;
1438     COLOR    bsdfRGB;
1439 +   int      transmitted;
1440     double   prDiff, ptDiff, prDiffSD, ptDiffSD, prSpecSD, ptSpecSD,
1441 <            albedo, xi, xi2;
1442 <   const double patAlb = colorAvg(rayIn -> pcol);
1441 >            albedo, xi;
1442 >   const double patAlb = bright(rayIn -> pcol);
1443    
1444     /* Following code adapted from m_bsdf() */
1445     /* Check arguments */
# Line 1686 | Line 1456 | static int bsdfPhotonScatter (OBJREC *mat, RAY *rayIn)
1456          nd.thick = evalue(mf -> ep [0]);
1457          if ((-FTINY <= nd.thick) & (nd.thick <= FTINY))
1458                  nd.thick = .0;
1689                
1690   if (nd.thick != .0 || (!hitFront && !backvis)) {
1691      /* Proxy geometry present, so use it instead and transfer ray */
1692      photonRay(rayIn, &rayOut, PMAP_XFER, NULL);
1693      tracePhoton(&rayOut);
1694      
1695      return 0;
1696   }
1459  
1460     /* Get BSDF data */
1461     nd.sd = loadBSDF(mat -> oargs.sarg [1]);
# Line 1807 | Line 1569 | static int bsdfPhotonScatter (OBJREC *mat, RAY *rayIn)
1569     if (prDiff + ptDiff + prDiffSD + ptDiffSD > FTINY)
1570        addPhotons(rayIn);        
1571  
1572 <   xi = xi2 = pmapRandom(rouletteState);
1572 >   xi = pmapRandom(rouletteState);
1573        
1574     if (xi > albedo)
1575        /* Absorbtion */
1576        return 0;
1577    
1578 +   transmitted = 0;
1579 +
1580     if ((xi -= prDiff) <= 0) {
1581        /* Diffuse reflection (extra component in material def) */
1582        photonRay(rayIn, &rayOut, PMAP_DIFFREFL, nd.rdiff);
# Line 1822 | Line 1586 | static int bsdfPhotonScatter (OBJREC *mat, RAY *rayIn)
1586     else if ((xi -= ptDiff) <= 0) {
1587        /* Diffuse transmission (extra component in material def) */
1588        flipsurface(rayIn);
1589 +      nd.thick = -nd.thick;
1590        photonRay(rayIn, &rayOut, PMAP_DIFFTRANS, nd.tdiff);
1591 <      diffPhotonScatter(nd.pnorm, &rayOut);      
1591 >      diffPhotonScatter(nd.pnorm, &rayOut);
1592 >      transmitted = 1;
1593     }
1594 <  
1594 >  
1595     else {   /* Sample SDF */
1596        if ((xi -= prDiffSD) <= 0) {
1597           /* Diffuse SDF reflection (constant component) */
1598 <         if ((err = SDsampBSDF(&bsdfVal, nd.vray, xi2,
1598 >         if ((err = SDsampBSDF(&bsdfVal, nd.vray, pmapRandom(scatterState),
1599                                 SDsampDf | SDsampR, nd.sd)))
1600              objerror(mat, USER, transSDError(err));
1601          
# Line 1841 | Line 1607 | static int bsdfPhotonScatter (OBJREC *mat, RAY *rayIn)
1607  
1608        else if ((xi -= ptDiffSD) <= 0) {
1609           /* Diffuse SDF transmission (constant component) */
1610 <         if ((err = SDsampBSDF(&bsdfVal, nd.vray, xi2,
1610 >         if ((err = SDsampBSDF(&bsdfVal, nd.vray, pmapRandom(scatterState),
1611                                 SDsampDf | SDsampT, nd.sd)))
1612              objerror(mat, USER, transSDError(err));
1613          
# Line 1850 | Line 1616 | static int bsdfPhotonScatter (OBJREC *mat, RAY *rayIn)
1616           multcolor(bsdfRGB, rayIn -> pcol);
1617           addcolor(bsdfRGB, nd.tdiff);      
1618           flipsurface(rayIn);  /* Necessary? */
1619 +         nd.thick = -nd.thick;
1620           photonRay(rayIn, &rayOut, PMAP_DIFFTRANS, bsdfRGB);
1621 +         transmitted = 1;
1622        }
1623  
1624        else if ((xi -= prSpecSD) <= 0) {
1625           /* Non-diffuse ("specular") SDF reflection */
1626 <         if ((err = SDsampBSDF(&bsdfVal, nd.vray, xi2,
1626 >         if ((err = SDsampBSDF(&bsdfVal, nd.vray, pmapRandom(scatterState),
1627                                 SDsampSp | SDsampR, nd.sd)))
1628              objerror(mat, USER, transSDError(err));
1629          
# Line 1865 | Line 1633 | static int bsdfPhotonScatter (OBJREC *mat, RAY *rayIn)
1633        
1634        else {
1635           /* Non-diffuse ("specular") SDF transmission */
1636 <         if ((err = SDsampBSDF(&bsdfVal, nd.vray, xi2,
1636 >         if ((err = SDsampBSDF(&bsdfVal, nd.vray, pmapRandom(scatterState),
1637                                 SDsampSp | SDsampT, nd.sd)))
1638              objerror(mat, USER, transSDError(err));
1639  
# Line 1873 | Line 1641 | static int bsdfPhotonScatter (OBJREC *mat, RAY *rayIn)
1641           ccy2rgb(&bsdfVal.spec, bsdfVal.cieY, bsdfRGB);
1642           multcolor(bsdfRGB, rayIn -> pcol);
1643           flipsurface(rayIn);  /* Necessary? */
1644 +         nd.thick = -nd.thick;
1645           photonRay(rayIn, &rayOut, PMAP_SPECTRANS, bsdfRGB);
1646 +         transmitted = 1;
1647        }      
1648        
1649        /* Xform outgoing dir to world coords */
# Line 1886 | Line 1656 | static int bsdfPhotonScatter (OBJREC *mat, RAY *rayIn)
1656     /* Clean up */
1657     SDfreeCache(nd.sd);
1658  
1659 +   /* Need to offset ray origin to get past detail geometry? */
1660 +   if (transmitted && nd.thick != 0)
1661 +      VSUM(rayOut.rorg, rayOut.rorg, rayIn -> ron, -nd.thick);
1662 +
1663     tracePhoton(&rayOut);
1664     return 0;
1665   }
1892 #endif
1666  
1667  
1668  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines