--- ray/src/rt/virtuals.c 1991/08/05 09:02:42 1.21 +++ ray/src/rt/virtuals.c 1991/08/22 11:56:52 1.25 @@ -19,8 +19,8 @@ static char SCCSid[] = "$SunId$ LBL"; #include "random.h" -#define MINSAMPLES 5 /* minimum number of pretest samples */ -#define STESTMAX 30 /* maximum seeks per sample */ +#define MINSAMPLES 16 /* minimum number of pretest samples */ +#define STESTMAX 32 /* maximum seeks per sample */ double getdisk(); @@ -287,8 +287,7 @@ register int sn; /* target source number */ getplaneq(onorm, o); /* set number of rays to sample */ if (source[sn].sflags & SDISTANT) { - n = (2./3.*PI*PI)*or2/(thescene.cusize*thescene.cusize)* - vspretest + .5; + n = 4.*or2/(thescene.cusize*thescene.cusize)*vspretest + .5; infront = DOT(onorm, source[sn].sloc) > 0.; } else { for (i = 0; i < 3; i++) @@ -319,9 +318,9 @@ register int sn; /* target source number */ #endif return(f); /* too small a target! */ } + multisamp(offsdir, 3, urand(sn*931+5827+ssn)); for (i = 0; i < 3; i++) - offsdir[i] = or*(1. - - 2.*urand(urind(931*i+5827,ssn))); + offsdir[i] = or*(1. - 2.*offsdir[i]); ssn++; for (i = 0; i < 3; i++) sr.rorg[i] = oc[i] + offsdir[i]; @@ -349,9 +348,7 @@ register int sn; /* target source number */ nok++; /* check against obstructions */ rayclear(&sr); - sr.revf = raytrace; - rayvalue(&sr); - if (bright(sr.rcol) > FTINY) + if (!localhit(&sr, &thescene) || sr.ro == source[sn].so) nhit++; if (nhit > 0 && nhit < nok) { #ifdef DEBUG