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

Comparing ray/src/rt/normal.c (file contents):
Revision 2.24 by greg, Mon Mar 8 12:37:27 1993 UTC vs.
Revision 2.27 by greg, Wed Jan 12 16:46:45 1994 UTC

# Line 38 | Line 38 | static  gaussamp();
38   *      red     grn     blu     rspec   rough   trans   tspec
39   */
40  
41 #define  BSPEC(m)       (6.0)           /* specularity parameter b */
42
41                                  /* specularity flags */
42   #define  SP_REFL        01              /* has reflected specular component */
43   #define  SP_TRAN        02              /* has transmitted specular */
# Line 156 | Line 154 | register RAY  *r;
154   {
155          NORMDAT  nd;
156          double  transtest, transdist;
159        double  dtmp;
157          COLOR  ctmp;
158          register int  i;
159                                                  /* easy shadow test */
160          if (r->crtype & SHADOW && m->otype != MAT_TRANS)
161 <                return;
161 >                return(1);
162  
163          if (m->oargs.nfargs != (m->otype == MAT_TRANS ? 7 : 5))
164                  objerror(m, USER, "bad number of arguments");
# Line 186 | Line 183 | register RAY  *r;
183                  nd.pdot = .001;                 /* non-zero for dirnorm() */
184          multcolor(nd.mcolor, r->pcol);          /* modify material color */
185          transtest = 0;
186 +        transdist = r->rot;
187                                                  /* get specular component */
188          if ((nd.rspec = m->oargs.farg[3]) > FTINY) {
189                  nd.specfl |= SP_REFL;
# Line 195 | Line 193 | register RAY  *r;
193                  else
194                          setcolor(nd.scolor, 1.0, 1.0, 1.0);
195                  scalecolor(nd.scolor, nd.rspec);
198                                                /* improved model */
199                dtmp = exp(-BSPEC(m)*nd.pdot);
200                for (i = 0; i < 3; i++)
201                        colval(nd.scolor,i) += (1.0-colval(nd.scolor,i))*dtmp;
202                nd.rspec += (1.0-nd.rspec)*dtmp;
196                                                  /* check threshold */
197 <                if (!(nd.specfl & SP_PURE) &&
205 <                                specthresh > FTINY &&
206 <                                (specthresh >= 1.-FTINY ||
207 <                                specthresh + .05 - .1*frandom() > nd.rspec))
197 >                if (!(nd.specfl & SP_PURE) && specthresh >= nd.rspec-FTINY)
198                          nd.specfl |= SP_RBLT;
199                                                  /* compute reflected ray */
200                  for (i = 0; i < 3; i++)
# Line 231 | Line 221 | register RAY  *r;
221                  if (nd.tspec > FTINY) {
222                          nd.specfl |= SP_TRAN;
223                                                          /* check threshold */
224 <                        if (!(nd.specfl & SP_PURE) && specthresh > FTINY &&
225 <                                        (specthresh >= 1.-FTINY ||
236 <                                specthresh + .05 - .1*frandom() > nd.tspec))
224 >                        if (!(nd.specfl & SP_PURE) &&
225 >                                        specthresh >= nd.tspec-FTINY)
226                                  nd.specfl |= SP_TBLT;
227                          if (r->crtype & SHADOW ||
228                                          DOT(r->pert,r->pert) <= FTINY*FTINY) {
# Line 266 | Line 255 | register RAY  *r;
255                  transtest = 0;
256  
257          if (r->crtype & SHADOW)                 /* the rest is shadow */
258 <                return;
258 >                return(1);
259                                                  /* diffuse reflection */
260          nd.rdiff = 1.0 - nd.trans - nd.rspec;
261  
262          if (nd.specfl & SP_PURE && nd.rdiff <= FTINY && nd.tdiff <= FTINY)
263 <                return;                         /* 100% pure specular */
263 >                return(1);                      /* 100% pure specular */
264  
265          if (r->ro != NULL && (r->ro->otype == OBJ_FACE ||
266                          r->ro->otype == OBJ_RING))
# Line 305 | Line 294 | register RAY  *r;
294                                          /* check distance */
295          if (transtest > bright(r->rcol))
296                  r->rt = transdist;
297 +
298 +        return(1);
299   }
300  
301  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines