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.22 by greg, Tue Apr 11 02:21:37 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 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 >                        SDcompXform(vMtx, ivec, upv);
405                          nxfa = addrot(xfargs, vMtx[0], vMtx[1], vMtx[2]);
406                          sprintf(xfargs+strlen(xfargs), " -s %f -t %f %f %f",
407                                          scalef, sorg[0], sorg[1], sorg[2]);
# Line 418 | Line 419 | put_BSDFs(void)
419                          put_trans_arrow(ivec, 1);
420                          cvt_sposition(sorg, ivec, 1);
421                          ivec[0] = -ivec[0]; ivec[1] = -ivec[1]; /* normal */
422 +                        upv[0] = ivec[0]*ivec[1]*(ivec[2] - 1.);
423 +                        upv[1] = ivec[0]*ivec[0] + ivec[1]*ivec[1]*ivec[2];
424 +                        upv[2] = -ivec[1]*(ivec[0]*ivec[0] + ivec[1]*ivec[1]);
425                          sprintf(xfargs, "-s %f -t %f %f %f", bsdf_rad,
426                                          sorg[0], sorg[1], sorg[2]);
427                          nxfa = 6;
# Line 425 | Line 429 | put_BSDFs(void)
429                          printf("%d bsdf_red bsdf_grn bsdf_blu bsdf2rad.cal\n\t%s\n0\n0\n",
430                                          4+nxfa, xfargs);
431                          printf("\nscale_pat glow scale_mat\n0\n0\n4 1 1 1 0\n");
432 <                        SDcompXform(vMtx, ivec, Yaxis);
432 >                        SDcompXform(vMtx, ivec, upv);
433                          nxfa = addrot(xfargs, vMtx[0], vMtx[1], vMtx[2]);
434                          sprintf(xfargs+strlen(xfargs), " -s %f -t %f %f %f",
435                                          scalef, sorg[0], sorg[1], sorg[2]);
# Line 443 | Line 447 | put_BSDFs(void)
447                          put_mirror_arrow(ivec, -1);
448                          cvt_sposition(sorg, ivec, -1);
449                          ivec[0] = -ivec[0]; ivec[1] = -ivec[1]; /* normal */
450 +                        upv[0] = ivec[0]*ivec[1]*(ivec[2] - 1.);
451 +                        upv[1] = ivec[0]*ivec[0] + ivec[1]*ivec[1]*ivec[2];
452 +                        upv[2] = -ivec[1]*(ivec[0]*ivec[0] + ivec[1]*ivec[1]);
453                          sprintf(xfargs, "-s %f -t %f %f %f", bsdf_rad,
454                                          sorg[0], sorg[1], sorg[2]);
455                          nxfa = 6;
# Line 450 | Line 457 | put_BSDFs(void)
457                          printf("%d bsdf_red bsdf_grn bsdf_blu bsdf2rad.cal\n\t%s\n0\n0\n",
458                                          4+nxfa, xfargs);
459                          printf("\nscale_pat glow scale_mat\n0\n0\n4 1 1 1 0\n");
460 <                        SDcompXform(vMtx, ivec, Yaxis);
460 >                        SDcompXform(vMtx, ivec, upv);
461                          nxfa = addrot(xfargs, vMtx[0], vMtx[1], vMtx[2]);
462                          sprintf(xfargs+strlen(xfargs), " -s %f -t %f %f %f",
463                                          scalef, sorg[0], sorg[1], sorg[2]);
# Line 468 | Line 475 | put_BSDFs(void)
475                          put_trans_arrow(ivec, -1);
476                          cvt_sposition(sorg, ivec, -1);
477                          ivec[0] = -ivec[0]; ivec[1] = -ivec[1]; /* normal */
478 +                        upv[0] = ivec[0]*ivec[1]*(ivec[2] - 1.);
479 +                        upv[1] = ivec[0]*ivec[0] + ivec[1]*ivec[1]*ivec[2];
480 +                        upv[2] = -ivec[1]*(ivec[0]*ivec[0] + ivec[1]*ivec[1]);
481                          sprintf(xfargs, "-s %f -t %f %f %f", bsdf_rad,
482                                          sorg[0], sorg[1], sorg[2]);
483                          nxfa = 6;
# Line 475 | Line 485 | put_BSDFs(void)
485                          printf("%d bsdf_red bsdf_grn bsdf_blu bsdf2rad.cal\n\t%s\n0\n0\n",
486                                          4+nxfa, xfargs);
487                          printf("\nscale_pat glow scale_mat\n0\n0\n4 1 1 1 0\n");
488 <                        SDcompXform(vMtx, ivec, Yaxis);
488 >                        SDcompXform(vMtx, ivec, upv);
489                          nxfa = addrot(xfargs, vMtx[0], vMtx[1], vMtx[2]);
490                          sprintf(xfargs+strlen(xfargs), " -s %f -t %f %f %f",
491                                          scalef, sorg[0], sorg[1], sorg[2]);
# Line 518 | Line 528 | put_matBSDF(const char *XMLfile)
528                  break;
529          }
530          printf("\n# Actual BSDF material for rendering the hemispheres\n");
531 <        printf("\nvoid BSDF BSDFmat\n6 0 \"%s%s\" 0 1 0 .\n0\n0\n",
531 >        printf("\nvoid BSDF BSDFmat\n6 0 \"%s%s\" upx upy upz bsdf2rad.cal\n0\n0\n",
532                          curdir, XMLfile);
533          printf("\nvoid plastic black\n0\n0\n5 0 0 0 0 0\n");
534          printf("\nvoid mixfunc %s\n4 BSDFmat black latlong bsdf2rad.cal\n0\n0\n",

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines