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

Comparing ray/src/cv/bsdf2rad.c (file contents):
Revision 2.21 by greg, Mon Apr 10 15:44:19 2017 UTC vs.
Revision 2.23 by greg, Tue Apr 11 03:47:23 2017 UTC

# Line 26 | Line 26 | double overall_max = .0;               /* overall maximum BSDF valu
26  
27   char    ourTempDir[TEMPLEN] = "";       /* our temporary directory */
28  
29 const FVECT     Yaxis = {0., 1., 0.};
30
29   const char      frpref[] = "frefl";
30   const char      ftpref[] = "ftrans";
31   const char      brpref[] = "brefl";
# Line 373 | Line 371 | static int
371   put_BSDFs(void)
372   {
373          const double    scalef = bsdf_rad/(log10(overall_max) - min_log10);
374 <        FVECT           ivec, sorg;
374 >        FVECT           ivec, sorg, upv;
375          RREAL           vMtx[3][3];
376          char            *fname;
377          char            cmdbuf[256];
# Line 385 | Line 383 | put_BSDFs(void)
383                          NINCIDENT);
384  
385          printf("\nvoid glow arrow_glow\n0\n0\n4 1 0 1 0\n");
386 <        printf("\nvoid mixfunc arrow_mat\n4 arrow_glow void 0.5 .\n0\n0\n");
386 >        printf("\nvoid mixfunc arrow_mat\n4 arrow_glow void 0.25 .\n0\n0\n");
387  
388          if (front_comp & SDsampR)                       /* front reflection */
389                  for (i = 0; i < NINCIDENT; i++) {
# Line 393 | Line 391 | put_BSDFs(void)
391                          put_mirror_arrow(ivec, 1);
392                          cvt_sposition(sorg, ivec, 1);
393                          ivec[0] = -ivec[0]; ivec[1] = -ivec[1]; /* normal */
394 +                        upv[0] = ivec[0]*ivec[1]*(ivec[2] - 1.);
395 +                        upv[1] = ivec[0]*ivec[0] + ivec[1]*ivec[1]*ivec[2];
396 +                        upv[2] = -ivec[1]*(ivec[0]*ivec[0] + ivec[1]*ivec[1]);
397                          sprintf(xfargs, "-s %f -t %f %f %f", bsdf_rad,
398                                          sorg[0], sorg[1], sorg[2]);
399                          nxfa = 6;
# Line 400 | Line 401 | put_BSDFs(void)
401                          printf("%d bsdf_red bsdf_grn bsdf_blu bsdf2rad.cal\n\t%s\n0\n0\n",
402                                          4+nxfa, xfargs);
403                          printf("\nscale_pat glow scale_mat\n0\n0\n4 1 1 1 0\n");
404 <                        SDcompXform(vMtx, ivec, Yaxis);
404 >                        if (SDcompXform(vMtx, ivec, upv) != SDEnone)
405 >                                continue;
406                          nxfa = addrot(xfargs, vMtx[0], vMtx[1], vMtx[2]);
407                          sprintf(xfargs+strlen(xfargs), " -s %f -t %f %f %f",
408                                          scalef, sorg[0], sorg[1], sorg[2]);
# Line 418 | Line 420 | put_BSDFs(void)
420                          put_trans_arrow(ivec, 1);
421                          cvt_sposition(sorg, ivec, 1);
422                          ivec[0] = -ivec[0]; ivec[1] = -ivec[1]; /* normal */
423 +                        upv[0] = ivec[0]*ivec[1]*(ivec[2] - 1.);
424 +                        upv[1] = ivec[0]*ivec[0] + ivec[1]*ivec[1]*ivec[2];
425 +                        upv[2] = -ivec[1]*(ivec[0]*ivec[0] + ivec[1]*ivec[1]);
426                          sprintf(xfargs, "-s %f -t %f %f %f", bsdf_rad,
427                                          sorg[0], sorg[1], sorg[2]);
428                          nxfa = 6;
# Line 425 | Line 430 | put_BSDFs(void)
430                          printf("%d bsdf_red bsdf_grn bsdf_blu bsdf2rad.cal\n\t%s\n0\n0\n",
431                                          4+nxfa, xfargs);
432                          printf("\nscale_pat glow scale_mat\n0\n0\n4 1 1 1 0\n");
433 <                        SDcompXform(vMtx, ivec, Yaxis);
433 >                        if (SDcompXform(vMtx, ivec, upv) != SDEnone)
434 >                                continue;
435                          nxfa = addrot(xfargs, vMtx[0], vMtx[1], vMtx[2]);
436                          sprintf(xfargs+strlen(xfargs), " -s %f -t %f %f %f",
437                                          scalef, sorg[0], sorg[1], sorg[2]);
# Line 443 | Line 449 | put_BSDFs(void)
449                          put_mirror_arrow(ivec, -1);
450                          cvt_sposition(sorg, ivec, -1);
451                          ivec[0] = -ivec[0]; ivec[1] = -ivec[1]; /* normal */
452 +                        upv[0] = ivec[0]*ivec[1]*(ivec[2] - 1.);
453 +                        upv[1] = ivec[0]*ivec[0] + ivec[1]*ivec[1]*ivec[2];
454 +                        upv[2] = -ivec[1]*(ivec[0]*ivec[0] + ivec[1]*ivec[1]);
455                          sprintf(xfargs, "-s %f -t %f %f %f", bsdf_rad,
456                                          sorg[0], sorg[1], sorg[2]);
457                          nxfa = 6;
# Line 450 | Line 459 | put_BSDFs(void)
459                          printf("%d bsdf_red bsdf_grn bsdf_blu bsdf2rad.cal\n\t%s\n0\n0\n",
460                                          4+nxfa, xfargs);
461                          printf("\nscale_pat glow scale_mat\n0\n0\n4 1 1 1 0\n");
462 <                        SDcompXform(vMtx, ivec, Yaxis);
462 >                        if (SDcompXform(vMtx, ivec, upv) != SDEnone)
463 >                                continue;
464                          nxfa = addrot(xfargs, vMtx[0], vMtx[1], vMtx[2]);
465                          sprintf(xfargs+strlen(xfargs), " -s %f -t %f %f %f",
466                                          scalef, sorg[0], sorg[1], sorg[2]);
# Line 468 | Line 478 | put_BSDFs(void)
478                          put_trans_arrow(ivec, -1);
479                          cvt_sposition(sorg, ivec, -1);
480                          ivec[0] = -ivec[0]; ivec[1] = -ivec[1]; /* normal */
481 +                        upv[0] = ivec[0]*ivec[1]*(ivec[2] - 1.);
482 +                        upv[1] = ivec[0]*ivec[0] + ivec[1]*ivec[1]*ivec[2];
483 +                        upv[2] = -ivec[1]*(ivec[0]*ivec[0] + ivec[1]*ivec[1]);
484                          sprintf(xfargs, "-s %f -t %f %f %f", bsdf_rad,
485                                          sorg[0], sorg[1], sorg[2]);
486                          nxfa = 6;
# Line 475 | Line 488 | put_BSDFs(void)
488                          printf("%d bsdf_red bsdf_grn bsdf_blu bsdf2rad.cal\n\t%s\n0\n0\n",
489                                          4+nxfa, xfargs);
490                          printf("\nscale_pat glow scale_mat\n0\n0\n4 1 1 1 0\n");
491 <                        SDcompXform(vMtx, ivec, Yaxis);
491 >                        if (SDcompXform(vMtx, ivec, upv) != SDEnone)
492 >                                continue;
493                          nxfa = addrot(xfargs, vMtx[0], vMtx[1], vMtx[2]);
494                          sprintf(xfargs+strlen(xfargs), " -s %f -t %f %f %f",
495                                          scalef, sorg[0], sorg[1], sorg[2]);
# Line 518 | Line 532 | put_matBSDF(const char *XMLfile)
532                  break;
533          }
534          printf("\n# Actual BSDF material for rendering the hemispheres\n");
535 <        printf("\nvoid BSDF BSDFmat\n6 0 \"%s%s\" 0 1 0 .\n0\n0\n",
535 >        printf("\nvoid BSDF BSDFmat\n6 0 \"%s%s\" upx upy upz bsdf2rad.cal\n0\n0\n",
536                          curdir, XMLfile);
537          printf("\nvoid plastic black\n0\n0\n5 0 0 0 0 0\n");
538          printf("\nvoid mixfunc %s\n4 BSDFmat black latlong bsdf2rad.cal\n0\n0\n",

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines