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.15 by rschregle, Tue Mar 20 19:55:33 2018 UTC vs.
Revision 2.16 by rschregle, Mon Jun 11 12:46:51 2018 UTC

# Line 1447 | Line 1447 | static int bsdfPhotonScatter (OBJREC *mat, RAY *rayIn)
1447         mat -> oargs.nfargs % 3)
1448        objerror(mat, USER, "bad # arguments");
1449        
1450 <        hitFront = (rayIn -> rod > 0);
1450 >   hitFront = (rayIn -> rod > 0);
1451  
1452 <        /* Load cal file */
1453 <        mf = getfunc(mat, 5, 0x1d, 1);
1454 <        
1455 <        /* Get thickness */
1456 <        nd.thick = evalue(mf -> ep [0]);
1457 <        if ((-FTINY <= nd.thick) & (nd.thick <= FTINY))
1458 <                nd.thick = .0;
1452 >   /* Load cal file */
1453 >   mf = getfunc(mat, 5, 0x1d, 1);
1454  
1455 +   /* Get thickness */
1456 +   nd.thick = evalue(mf -> ep [0]);
1457 +   if ((-FTINY <= nd.thick) & (nd.thick <= FTINY))
1458 +      nd.thick = .0;
1459 +
1460     /* Get BSDF data */
1461     nd.sd = loadBSDF(mat -> oargs.sarg [1]);
1462    
# Line 1479 | Line 1479 | static int bsdfPhotonScatter (OBJREC *mat, RAY *rayIn)
1479     else setcolor(nd.rdiff, mat -> oargs.farg [3], mat -> oargs.farg [4],
1480                   mat -> oargs.farg [5]);
1481  
1482 <        /* Extra diffuse transmittance from material def */
1483 <        if (mat -> oargs.nfargs < 9)
1484 <           setcolor(nd.tdiff, .0, .0, .0);
1482 >   /* Extra diffuse transmittance from material def */
1483 >   if (mat -> oargs.nfargs < 9)
1484 >      setcolor(nd.tdiff, .0, .0, .0);
1485     else setcolor(nd.tdiff, mat -> oargs.farg [6], mat -> oargs.farg [7],
1486                   mat -> oargs.farg [8]);
1487                
1488     nd.mp = mat;
1489     nd.pr = rayIn;
1490 <        
1490 >
1491     /* Get modifiers */
1492     raytexture(rayIn, mat -> omod);
1493    
1494     /* Modify diffuse values */
1495     multcolor(nd.rdiff, rayIn -> pcol);
1496     multcolor(nd.tdiff, rayIn -> pcol);
1497 <                
1497 >
1498     /* Get up vector & xform to world coords */
1499     upvec [0] = evalue(mf -> ep [1]);
1500     upvec [1] = evalue(mf -> ep [2]);
# Line 1541 | Line 1541 | static int bsdfPhotonScatter (OBJREC *mat, RAY *rayIn)
1541     nd.sr_vpsa [1] = sqrt(nd.sr_vpsa [1]);
1542  
1543     /* Orient perturbed normal towards incident side */
1544 <   if (!hitFront) {                    
1544 >   if (!hitFront) {
1545        nd.pnorm [0] = -nd.pnorm [0];
1546        nd.pnorm [1] = -nd.pnorm [1];
1547        nd.pnorm [2] = -nd.pnorm [2];
# Line 1585 | Line 1585 | static int bsdfPhotonScatter (OBJREC *mat, RAY *rayIn)
1585    
1586     else if ((xi -= ptDiff) <= 0) {
1587        /* Diffuse transmission (extra component in material def) */
1588      flipsurface(rayIn);
1589      nd.thick = -nd.thick;
1588        photonRay(rayIn, &rayOut, PMAP_DIFFTRANS, nd.tdiff);
1589        diffPhotonScatter(nd.pnorm, &rayOut);
1590        transmitted = 1;
# Line 1615 | Line 1613 | static int bsdfPhotonScatter (OBJREC *mat, RAY *rayIn)
1613           ccy2rgb(&bsdfVal.spec, bsdfVal.cieY, bsdfRGB);
1614           multcolor(bsdfRGB, rayIn -> pcol);
1615           addcolor(bsdfRGB, nd.tdiff);      
1618         flipsurface(rayIn);  /* Necessary? */
1619         nd.thick = -nd.thick;
1616           photonRay(rayIn, &rayOut, PMAP_DIFFTRANS, bsdfRGB);
1617           transmitted = 1;
1618        }
# Line 1640 | Line 1636 | static int bsdfPhotonScatter (OBJREC *mat, RAY *rayIn)
1636           /* Apply pattern to spectral component */
1637           ccy2rgb(&bsdfVal.spec, bsdfVal.cieY, bsdfRGB);
1638           multcolor(bsdfRGB, rayIn -> pcol);
1643         flipsurface(rayIn);  /* Necessary? */
1644         nd.thick = -nd.thick;
1639           photonRay(rayIn, &rayOut, PMAP_SPECTRANS, bsdfRGB);
1640           transmitted = 1;
1641        }      
# Line 1656 | Line 1650 | static int bsdfPhotonScatter (OBJREC *mat, RAY *rayIn)
1650     /* Clean up */
1651     SDfreeCache(nd.sd);
1652  
1653 <   /* Need to offset ray origin to get past detail geometry? */
1653 >   /* Offset outgoing photon origin by thickness to bypass proxy geometry */
1654     if (transmitted && nd.thick != 0)
1655        VSUM(rayOut.rorg, rayOut.rorg, rayIn -> ron, -nd.thick);
1656  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines