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

Comparing ray/src/rt/aniso.c (file contents):
Revision 2.23 by greg, Fri Feb 12 10:41:05 1993 UTC vs.
Revision 2.27 by greg, Wed Jan 12 16:46:32 1994 UTC

# Line 19 | Line 19 | static char SCCSid[] = "$SunId$ LBL";
19   extern double  specthresh;              /* specular sampling threshold */
20   extern double  specjitter;              /* specular sampling jitter */
21  
22 + static  agaussamp(), getacoords();
23 +
24   /*
25   *      This routine implements the anisotropic Gaussian
26   *  model described by Ward in Siggraph `92 article.
# Line 34 | Line 36 | extern double  specjitter;             /* specular sampling jitte
36   *  8  red      grn     blu     rspec   u-rough v-rough trans   tspec
37   */
38  
37 #define  BSPEC(m)       (6.0)           /* specularity parameter b */
38
39                                  /* specularity flags */
40   #define  SP_REFL        01              /* has reflected specular component */
41   #define  SP_TRAN        02              /* has transmitted specular */
# Line 181 | Line 181 | register OBJREC  *m;
181   register RAY  *r;
182   {
183          ANISODAT  nd;
184        double  dtmp;
184          COLOR  ctmp;
185          register int  i;
186                                                  /* easy shadow test */
187          if (r->crtype & SHADOW)
188 <                return;
188 >                return(1);
189  
190          if (m->oargs.nfargs != (m->otype == MAT_TRANS2 ? 8 : 6))
191                  objerror(m, USER, "bad number of real arguments");
# Line 220 | Line 219 | register RAY  *r;
219                  else
220                          setcolor(nd.scolor, 1.0, 1.0, 1.0);
221                  scalecolor(nd.scolor, nd.rspec);
223                                                /* improved model */
224                dtmp = exp(-BSPEC(m)*nd.pdot);
225                for (i = 0; i < 3; i++)
226                        colval(nd.scolor,i) += (1.0-colval(nd.scolor,i))*dtmp;
227                nd.rspec += (1.0-nd.rspec)*dtmp;
222                                                  /* check threshold */
223 <                if (specthresh > FTINY &&
230 <                                (specthresh >= 1.-FTINY ||
231 <                                specthresh + .05 - .1*frandom() > nd.rspec))
223 >                if (specthresh >= nd.rspec-FTINY)
224                          nd.specfl |= SP_RBLT;
225                                                  /* compute refl. direction */
226                  for (i = 0; i < 3; i++)
# Line 245 | Line 237 | register RAY  *r;
237                  if (nd.tspec > FTINY) {
238                          nd.specfl |= SP_TRAN;
239                                                          /* check threshold */
240 <                        if (specthresh > FTINY &&
249 <                                        (specthresh >= 1.-FTINY ||
250 <                                specthresh + .05 - .1*frandom() > nd.tspec))
240 >                        if (specthresh >= nd.tspec-FTINY)
241                                  nd.specfl |= SP_TBLT;
242                          if (DOT(r->pert,r->pert) <= FTINY*FTINY) {
243                                  VCOPY(nd.prdir, r->rdir);
# Line 297 | Line 287 | register RAY  *r;
287          }
288                                          /* add direct component */
289          direct(r, diraniso, &nd);
290 +
291 +        return(1);
292   }
293  
294  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines