From theseas!fs.Princeton.EDU!cek Tue, 27 Apr 93 01:31:38 EET
Received: by kriton.UUCP (V1.16/Amiga)
	id AA00000; Tue, 27 Apr 93 01:31:38 EET
Received: by theseas.ntua.gr with UUCP; Tue, 27 Apr 93 00:37:23 +0300
Received: from mcsun.EU.net by pythia.ics.forth.gr via ITEnet with SMTP;
	id AA10288 (5.65c/FORTH-ICS-3.0-MHS-7.0); Tue, 27 Apr 1993 00:07:22 +0300
Received: by mcsun.EU.net via EUnet
	id AA17990 (5.65b/CWI-2.217); Mon, 26 Apr 1993 23:02:41 +0200
Received: from Princeton.EDU by relay2.UU.NET with SMTP 
	(5.61/UUNET-internet-primary) id AA21952; Mon, 26 Apr 93 16:56:17 -0400
Received: from fs.Princeton.EDU by Princeton.EDU (5.65b/2.96/princeton)
	id AA00648; Mon, 26 Apr 93 16:53:48 -0400
Received: by fs.Princeton.EDU (4.1/1.105)
	id AA12696; Mon, 26 Apr 93 16:53:46 EDT
Received: from faui45.informatik.uni-erlangen.de ([131.188.34.45]) by fs.Princeton.EDU (4.1/1.105)
	id AA12598; Mon, 26 Apr 93 16:52:59 EDT
Received: from faui43.informatik.uni-erlangen.de by uni-erlangen.de with SMTP;
	id AA04018 (5.65c-5/7.3t-FAU); Mon, 26 Apr 1993 22:52:55 +0200
Received: by immd4.informatik.uni-erlangen.de;
	id AA28920 (5.65c-5/7.3m-FAU); Mon, 26 Apr 1993 22:52:53 +0200
Message-Id: <199304262052.AA28920@faui43.informatik.uni-erlangen.de>
Date: Mon, 26 Apr 93 22:52:53 MDT
X-Mailer: ELM [version 2.3 PL11]
Errors-To: Princeton.EDU!cek
Remailed-Date: Mon Apr 26 16:53:04 EDT 1993
From: "Michael Schroeder (Inf4 - hiwi)" <immd4.informatik.uni-erlangen.de!mlschroe>
To: "Rayshade Distribution List" <cs.Princeton.EDU!rayshade-users>
Subject: blob and shadow bug


Hello,

there is a small bug in the blob intersection code that makes
rayshade miss blob hits if mindist is not zero. This can happen
if a ray to a light source hits a blob. Example:

--------------------------------------------------
screen 120 100
light 1 directional -1 0 1
eyep 2 -10 3
lookp 0 0 0

surface glass
  diffuse 0 0 .5
  transp 1
  extinct .8
  
blob glass  .2  1 1 0 2 0
box glass -.5 -2.5 -.5  .5 -1.5 .5

plane 0 0 -2 0 0 1
plane transp 1 -500 0 0 1 0 0
--------------------------------------------------

Patch:

*** blob.c.orig	Mon Apr 26 22:10:52 1993
--- blob.c	Mon Apr 26 22:25:01 1993
***************
*** 250,256 ****
  	/* 
  	 * only interested in stuff in front of ray origin 
  	 */
! 			if (dmin < mindist) dmin = mindist;
  			dmax = b + t;
  			if (dmax > dmin) /* we have a valid Region */
  			{
--- 250,256 ----
  	/* 
  	 * only interested in stuff in front of ray origin 
  	 */
! 			if (dmin < mindist + EPSILON) dmin = mindist + EPSILON;
  			dmax = b + t;
  			if (dmax > dmin) /* we have a valid Region */
  			{



Note that the fully transparent plane is necessary because rayshade
doesn't handle a light source in a medium with nonzero extinction
coefficient. (There is still the problem that the surfaces are not
held on a stack, but that's another story...)
What do you think?

*** shadow.c.orig	Mon Apr 26 22:30:52 1993
--- shadow.c	Mon Apr 26 22:32:01 1993
***************
*** 233,238 ****
--- 233,244 ----
  		 */
  		hitlist.nodes = 0;
  	} while (TraceRay(ray, &hitlist, totaldist, &s));
+ 	if (prevsurf) {
+ 		if (prevsurf->statten != 1.) {
+ 			statten = pow(prevsurf->statten, dist - totaldist);
+ 			ColorScale(statten, res, &res);
+ 		}
+ 	}
  
  	*result = res;
  	return FALSE;

Michael.

---------------------------------------------------------------
Michael Schroeder    mlschroe@faui43.informatik.uni-erlangen.de
main(a){while(a=~getchar())putchar(~a-1/(~(a|32)/13*2-11)*13);}

----------
Administrivia: rayshade-request@cs.princeton.edu
Mailing list: rayshade-users@cs.princeton.edu

