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

Comparing ray/src/cv/bsdfinterp.c (file contents):
Revision 2.17 by greg, Wed Feb 19 05:16:06 2014 UTC vs.
Revision 2.22 by greg, Wed Sep 8 01:05:57 2021 UTC

# Line 108 | Line 108 | on_edge(const MIGRATION *ej, const FVECT ivec)
108                  return(0);
109  
110          cos_c = DOT(ej->rbfv[0]->invec, ej->rbfv[1]->invec);
111 <
112 <        return(cos_c - cos_aplusb < .001);
111 >        return(cos_c - cos_aplusb < .0002);
112   }
113  
114   /* Determine if we are inside the given triangle */
# Line 215 | Line 214 | get_interp(MIGRATION *miga[3], FVECT invec)
214                      for (miga[0] = rbf->ejl; miga[0] != NULL;
215                                          miga[0] = nextedge(rbf,miga[0]))
216                          if (opp_rbf(rbf,miga[0]) == rbf->next) {
217 <                                double  nf = 1. - rbf->invec[2]*rbf->invec[2];
217 >                                double  nf = 1. -
218 >                                        rbf->next->invec[2]*rbf->next->invec[2];
219                                  if (nf > FTINY) {       /* rotate to match */
220                                          nf = sqrt((1.-invec[2]*invec[2])/nf);
221 <                                        invec[0] = nf*rbf->invec[0];
222 <                                        invec[1] = nf*rbf->invec[1];
221 >                                        invec[0] = nf*rbf->next->invec[0];
222 >                                        invec[1] = nf*rbf->next->invec[1];
223                                  }
224 <                                return(0);
224 >                                return(0);      /* rotational symmetry */
225                          }
226                      break;
227                  }
# Line 279 | Line 279 | advect_rbf(const FVECT invec, int lobe_lim)
279          VCOPY(sivec, invec);                    /* find triangle/edge */
280          sym = get_interp(miga, sivec);
281          if (sym < 0)                            /* can't interpolate? */
282 <                return(NULL);
282 >                return(def_rbf_spec(invec));
283          if (miga[1] == NULL) {                  /* advect along edge? */
284                  rbf = e_advect_rbf(miga[0], sivec, lobe_lim);
285                  if (single_plane_incident)
# Line 342 | Line 342 | tryagain:
342              const RBFVAL        *rbf0i = &miga[0]->rbfv[0]->rbfa[i];
343              const float         w0i = rbf0i->peak;
344              const double        rad0i = R2ANG(rbf0i->crad);
345 +            C_COLOR             cc0;
346              ovec_from_pos(v0, rbf0i->gx, rbf0i->gy);
347 +            c_decodeChroma(&cc0, rbf0i->chroma);
348              for (j = 0; j < mtx_ncols(miga[0]); j++) {
349                  const float     ma = mtx_coef(miga[0],i,j);
350                  const RBFVAL    *rbf1j;
351 +                C_COLOR         ccs;
352                  double          srad2;
353                  if (ma <= cthresh)
354                          continue;
355                  rbf1j = &miga[0]->rbfv[1]->rbfa[j];
356 +                c_decodeChroma(&ccs, rbf1j->chroma);
357 +                c_cmix(&ccs, 1.-s, &cc0, s, &ccs);
358                  srad2 = R2ANG(rbf1j->crad);
359                  srad2 = (1.-s)*(1.-t)*rad0i*rad0i + s*(1.-t)*srad2*srad2;
360                  ovec_from_pos(v1, rbf1j->gx, rbf1j->gy);
# Line 367 | Line 372 | tryagain:
372                      rad2 = srad2 + t*rad2*rad2;
373                      rbf->rbfa[n].peak = w0i * ma * (mb*mbfact + mc*mcfact) *
374                                          rad0i*rad0i/rad2;
375 +                    if (rbf_colorimetry == RBCtristimulus) {
376 +                        C_COLOR cres;
377 +                        c_decodeChroma(&cres, rbf2k->chroma);
378 +                        c_cmix(&cres, 1.-t, &ccs, t, &cres);
379 +                        rbf->rbfa[n].chroma = c_encodeChroma(&cres);
380 +                    } else
381 +                        rbf->rbfa[n].chroma = c_dfchroma;
382                      rbf->rbfa[n].crad = ANG2R(sqrt(rad2));
383                      ovec_from_pos(v2, rbf2k->gx, rbf2k->gy);
384                      geodesic(v2, v1, v2, t, GEOD_REL);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines