From theseas!Princeton.EDU!cek Fri, 15 Jul 94 07:49:29 EET
Received: by kriton.UUCP (V1.17-beta/Amiga)
	  id <03r0@kriton.UUCP>; Fri, 15 Jul 94 07:49:29 EET
Received: by theseas.ntua.gr with UUCP; Thu, 14 Jul 1994 22:30:53 +0300
Received: from nemesis.ics.forth.gr (nemesis.csi.forth.gr) by pythia.ics.forth.gr via FORTHnet with SMTP;
	id AA18445 (5.65c/FORTH-ICS-3.0-MHS-7.0); Thu, 14 Jul 1994 21:53:27 +0300
Received: from eunet.EU.net by nemesis.ics.forth.gr via FORTHnet with SMTP;
	id AA26728 (5.65c/ICS-1.1); Thu, 14 Jul 1994 21:44:56 +0300 (EET DST)
Received: (uunet@localhost) by eunet.EU.net (8.6.8/8.6.4) with UUCP id UAA24408 for ariadne!theseas!kriton!kyrimis; Thu, 14 Jul 1994 20:49:02 +0200
Received: from Princeton.EDU by relay1.UU.NET with SMTP 
	(relay) id QQwynz05646; Thu, 14 Jul 1994 14:45:02 -0400
Received: from fs.Princeton.EDU by Princeton.EDU (5.65b/2.111/princeton)
	id AA15127; Thu, 14 Jul 94 14:44:06 -0400
Received: by cs.Princeton.EDU (4.1/1.105)
	id AA17019; Thu, 14 Jul 94 14:44:05 EDT
Received: from netmail.austin.ibm.com by cs.Princeton.EDU (4.1/1.105)
	id AA16964; Thu, 14 Jul 94 14:43:45 EDT
Received: from doorstop.austin.ibm.com by netmail.austin.ibm.com (AIX 3.1/UCB 5.61/gw.0.7)
	for rayshade-users@cs.princeton.edu at cs.princeton.edu
	id AA40595; Thu, 14 Jul 94 13:43:43 -0500
Received: by doorstop.austin.ibm.com (AIX 3.2/UCB 5.64/4.03-client-2.4)
          for rayshade-users@cs.princeton.edu at austin.ibm.com; id AA25818; Thu, 14 Jul 1994 13:43:33 -0500
Organization: Institute of Computer Science, 
	Foundation for Research and Technology-Hellas (FORTH)
	P.O.Box 1385,
	GR 711 10 Heraklion, Crete, Greece        
	tel.: +30 (81) 39 16 00,  fax: +30 (81) 39 16 01
Message-Id: <9407141843.AA25818@doorstop.austin.ibm.com>
Date: Thu, 14 Jul 1994 13:43:32 -0500 (CDT)
In-Reply-To: <199407141548.AA242100909@dizzy.ece.ucdavis.edu> from "Wes Hardaker" at Jul 14, 94 08:48:29 am
X-Mailer: ELM [version 2.4 PL22]
Mime-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Content-Length: 4113
Errors-To: rayshade-users-request@cs.Princeton.EDU
Remailed-Date: Thu Jul 14 14:43:53 EDT 1994
From: tif@austin.ibm.com (Paul Chamberlain)
To: hardaker@ece.ucdavis.edu, rayshade-users@cs.Princeton.EDU
Subject: Re: rayshade -> heightfield?

Wes Hardaker writes:
>Has anyone made any patches that will allow rayshade to output a
>height field rather than a image?  (IE, closer points in white,
>farther in black).

I made a hack to do this.  I was going to do random dot stereograms
with the output.  Never got around to the stereograms but my ray2hf
seemed to kind-o-sort-of work.

I've attached my diffs.

WARNING: this is a hack.
WARNING: it's also a hand pieced together set of diffs
--
Paul Chamberlain  |  <I do NOT speak for IBM!>	| UNIX: tif@austin.ibm.com
IBM AWS, I/O Dev  |  512/838-3759, IBM T/L 678	| IBM-VNET:  TIF AT AUSTIN


*** src/libshade/Makefile	Wed Aug 26 13:26:39 1992
--- ray2hf/libshade/Makefile	Tue Aug 17 14:29:32 1993
***************
*** 25,31 ****
  INCLUDE = -I.. -I$(LIBRAYDIR)
  YFLAGS = -d
  
! CFLAGS = $(CCFLAGS) $(URTINC) $(INCLUDE) $(OPTIMIZE)
  SHELL = /bin/sh
  
  LIB = libshade.a
--- 25,31 ----
  INCLUDE = -I.. -I$(LIBRAYDIR)
  YFLAGS = -d
  
! CFLAGS = $(CCFLAGS) $(URTINC) $(INCLUDE) $(OPTIMIZE) -DRAY2HF
  SHELL = /bin/sh
  
  LIB = libshade.a



*** src/libshade/picture.c	Tue Aug 17 11:47:38 1993
--- ray2hf/libshade/picture.c	Tue Aug 17 11:53:01 1993
***************
*** 289,295 ****
  	} else
  		Options.pictfile = stdout;
  
! 	fprintf(Options.pictfile,"%d %d\n",Screen.xsize, Screen.ysize);
  
  	(void)fflush(Options.pictfile);
  }
--- 289,295 ----
  	} else
  		Options.pictfile = stdout;
  
! 	fprintf(Options.pictfile,"P5\n%d %d\n255\n",Screen.xsize, Screen.ysize);
  
  	(void)fflush(Options.pictfile);
  }
***************
*** 301,309 ****
  	register int i;
  
  	for (i = 0; i < Screen.xsize; i++) {
! 		(void)fputc((int)CORRECT(buf[i].r), Options.pictfile);
! 		(void)fputc((int)CORRECT(buf[i].g), Options.pictfile);
! 		(void)fputc((int)CORRECT(buf[i].b), Options.pictfile);
  	}
  	(void)fflush(Options.pictfile);
  }
--- 301,308 ----
  	register int i;
  
  	for (i = 0; i < Screen.xsize; i++) {
! 		fprintf(stderr,"alpha=%f\n",buf[i].alpha);
! 		(void)fputc((int)(buf[i].alpha), Options.pictfile);
  	}
  	(void)fflush(Options.pictfile);
  }


*** src/libshade/viewing.c	Wed Aug 26 13:26:39 1992
--- ray2hf/libshade/viewing.c	Tue Aug 17 14:22:01 1993
***************
*** 239,245 ****
--- 239,247 ----
  	color->r *= Sampling.filter[u][v];
  	color->g *= Sampling.filter[u][v];
  	color->b *= Sampling.filter[u][v];
+ #ifndef RAY2HF
  	color->alpha *= Sampling.filter[u][v];
+ #endif
  }	
  
  void
***************
*** 281,286 ****
--- 283,289 ----
  	dist = FAR_AWAY;
  	hitlist.nodes = 0;
  	(void)TraceRay(ray, &hitlist, EPSILON, &dist);
+ #ifndef RAY2HF
  	ShadeRay(&hitlist, ray, dist, &Screen.background, &ctmp, &fullintens);
  	color->r = ctmp.r;
  	color->g = ctmp.g;
***************
*** 287,292 ****
--- 290,299 ----
  	color->b = ctmp.b;
  	if (hitlist.nodes != 0) {
  		color->alpha = 1.;
+ #else
+ 	if (hitlist.nodes != 0) {
+ 		color->alpha = dist;
+ #endif
  	} else {
  		color->alpha = 0.;
  	}


*** src/rayshade/Makefile	Wed Aug 26 13:26:45 1992
--- ray2hf/rayshade/Makefile	Tue Aug 17 14:29:44 1993
***************
*** 32,38 ****
  # If you are running on a Multimax, add -DMULTIMAX -DSHAREDMEM
  # 
  
! CFLAGS = $(CCFLAGS) $(INCLUDE) $(OPTIMIZE)
  
  #
  # C-Linda flags, if appropriate
--- 32,38 ----
  # If you are running on a Multimax, add -DMULTIMAX -DSHAREDMEM
  # 
  
! CFLAGS = $(CCFLAGS) $(INCLUDE) $(OPTIMIZE) -DRAY2HF
  
  #
  # C-Linda flags, if appropriate



*** src/rayshade/raytrace.c	Wed Aug 26 13:26:45 1992
--- ray2hf/rayshade/raytrace.c	Tue Aug 17 14:27:19 1993
***************
*** 262,268 ****
--- 262,270 ----
  		pix->r *= Sampling.filter[x][y];
  		pix->g *= Sampling.filter[x][y];
  		pix->b *= Sampling.filter[x][y];
+ #ifndef RAY2HF
  		pix->alpha *= Sampling.filter[x][y];
+ #endif
  	}
  
  	sampnum = 0;
***************
*** 287,293 ****
--- 289,297 ----
  				pix->r += ctmp.r*Sampling.filter[x][y];
  				pix->g += ctmp.g*Sampling.filter[x][y];
  				pix->b += ctmp.b*Sampling.filter[x][y];
+ #ifndef RAY2HF
  				pix->alpha += ctmp.alpha*Sampling.filter[x][y];
+ #endif
  			}
  			if (++sampnum == Sampling.totsamples)
  				sampnum = 0;

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

