--- ray/src/rt/rtrace.c 1993/06/18 10:14:42 2.15 +++ ray/src/rt/rtrace.c 1996/04/17 14:02:09 2.22 @@ -1,4 +1,4 @@ -/* Copyright (c) 1992 Regents of the University of California */ +/* Copyright (c) 1995 Regents of the University of California */ #ifndef lint static char SCCSid[] = "$SunId$ LBL"; @@ -53,21 +53,29 @@ int vresolu = 0; /* vertical resolution */ double dstrsrc = 0.0; /* square source distribution */ double shadthresh = .05; /* shadow threshold */ double shadcert = .5; /* shadow certainty */ -int directrelay = 1; /* number of source relays */ +int directrelay = 2; /* number of source relays */ int vspretest = 512; /* virtual source pretest density */ int directvis = 1; /* sources visible? */ -double srcsizerat = .25; /* maximum ratio source size/dist. */ +double srcsizerat = .2; /* maximum ratio source size/dist. */ +COLOR cextinction = BLKCOLOR; /* global extinction coefficient */ +COLOR salbedo = BLKCOLOR; /* global scattering albedo */ +double seccg = 0.; /* global scattering eccentricity */ +double ssampdist = 0.; /* scatter sampling distance */ + double specthresh = .15; /* specular sampling threshold */ double specjitter = 1.; /* specular sampling jitter */ +int backvis = 1; /* back face visibility */ + int maxdepth = 6; /* maximum recursion depth */ double minweight = 4e-3; /* minimum ray weight */ COLOR ambval = BLKCOLOR; /* ambient value */ +int ambvwt = 0; /* initial weight for ambient value */ double ambacc = 0.2; /* ambient accuracy */ -int ambres = 32; /* ambient resolution */ -int ambdiv = 128; /* ambient divisions */ +int ambres = 128; /* ambient resolution */ +int ambdiv = 512; /* ambient divisions */ int ambssamp = 0; /* ambient super-samples */ int ambounce = 0; /* ambient bounces */ char *amblist[128]; /* ambient include/exclude list */ @@ -133,10 +141,7 @@ char *fname; setmode(fileno(fp), O_BINARY); #endif /* set up output */ - if (imm_irrad) - outvals = "v"; - else - setoutput(outvals); + setoutput(outvals); switch (outform) { case 'a': putreal = puta; break; case 'f': putreal = putf; break; @@ -166,7 +171,7 @@ char *fname; if (imm_irrad) irrad(orig, direc); else - traceray(orig, direc); + rad(orig, direc); /* flush if time */ if (--nextflush == 0) { fflush(stdout); @@ -241,25 +246,18 @@ register char *vs; } -traceray(org, dir) /* compute and print ray value(s) */ +rad(org, dir) /* compute and print ray value(s) */ FVECT org, dir; { - register int (**tp)(); - VCOPY(thisray.rorg, org); VCOPY(thisray.rdir, dir); + thisray.rmax = 0.0; rayorigin(&thisray, NULL, PRIMARY, 1.0); if (castonly) localhit(&thisray, &thescene) || sourcehit(&thisray); else rayvalue(&thisray); - - if (ray_out[0] == NULL) - return; - for (tp = ray_out; *tp != NULL; tp++) - (**tp)(&thisray); - if (outform == 'a') - putchar('\n'); + printvals(&thisray); } @@ -274,14 +272,26 @@ FVECT org, dir; } rayorigin(&thisray, NULL, PRIMARY, 1.0); /* pretend we hit surface */ - thisray.rot = 1.0; + thisray.rot = 1.0-1e-4; thisray.rod = 1.0; VCOPY(thisray.ron, dir); for (i = 0; i < 3; i++) /* fudge factor */ thisray.rop[i] = org[i] + 1e-4*dir[i]; /* compute and print */ (*ofun[Lamb.otype].funp)(&Lamb, &thisray); - oputv(&thisray); + printvals(&thisray); +} + + +printvals(r) /* print requested ray values */ +RAY *r; +{ + register int (**tp)(); + + if (ray_out[0] == NULL) + return; + for (tp = ray_out; *tp != NULL; tp++) + (**tp)(r); if (outform == 'a') putchar('\n'); } @@ -354,9 +364,10 @@ RAY *r; if (every_out[0] == NULL) return; - if (traincl == 1 && r->ro == NULL) - return; - if (traincl != -1 && traincl != inset(traset, r->ro->omod)) + if (r->ro == NULL) { + if (traincl == 1) + return; + } else if (traincl != -1 && traincl != inset(traset, r->ro->omod)) return; tabin(r); for (tp = every_out; *tp != NULL; tp++)