Commit 30bb006c authored by Tobias Hansen's avatar Tobias Hansen

Imported Upstream version 0.99~b2+dfsg

parent d6c20c52
$Id: Changes,v 1.134 2011/02/18 04:52:59 johns Exp $
Changelog for Tachyon(tm) Ray Tracer
------------------------------------
02/17/2011 o Revised Tachyon APIs to greatly improve const correctness.
02/15/2011 o Changed the behavior of OpenGL fog such that fog color
doesn't override the background color or background sky sphere.
OpenGL only applies fog to drawn fragments and not
to raster ops or glClear() so this makes it easier to
emulate the behavior that OpenGL applications like VMD expect.
o Added orthographic sky plane background gradient mode, renamed
the background gradient API deprecating the old one, and added
copius comments to the Tachyon header file.
02/11/2011 o Updated in-memory texture image definition API, replacing
rt_define_image() with rt_define_teximage_rgb24().
02/06/2011 o Updated various header files to improve doxygen output.
o Further progress in automating conversion of the threading
code to the WorkForce APIs used in external programs.
02/05/2011 o Misc improvements, added new command line -raydepth
parameter to override maximum ray recursion depth setting
in the scene file.
02/01/2011 o Added "3fv" versions of most object creation APIs
which is more convenient and familiar to OpenGL programmers.
01/31/2011 o Eliminated dependencies on libGLU
01/28/2011 o Greatly expanded range of keyboard input allowed
by OpenGL window handling routines on X11 and Win32.
01/24/2011 o Improved Win32 window resizing behavior
01/19/2011 o Added support for interactive fly-throughs using the
SpaceNavigator and other devices that send events
via windowing system messages.
01/16/2011 o Marked with new version number 0.99
o Updated camera code to allow changes to rendered
image resolution independent of other camera parameters.
o Added keyboard hotkeys to change the window size and
resolution of the ray traced images on-the-fly.
o Added code to gracefully handle window resizing and dynamic
scaling/centering of the ray tracer output image.
o Fixed Win32 OpenGL drawing code to double-buffer by default
01/15/2011 o Added window event handling code for SpaceNavigator/Spaceball
and compatible devices.
o Eliminated code and build settings related to the Mercury/MSTI
i860 and PowerPC builds supporting RTVI framebuffers, circa 1998.
01/12/2011 o Added support for quad-buffered stereoscopic display
modes to the OpenGL window management code.
Updated the OpenGL display code to handle keypresses and a
wide range of other event types. Rewrote the Win32 display
code to eliminate global window state variables through
the use of user-defined window property data.
Added support for both blocking and non-blocking window system
event queries.
o Fixed scene parser logic for extension-based file type
determination
o Update const-correctness of various image I/O modules
o Updated various source files to eliminate Microsoft
compiler warnings
02/10/2010 o Added support for limits on the maximum number of
transparent surfaces shown, a related flag to enable
or disable shadow filtering for transparent objects,
and a new transparency mode flag to enable modulation of
surface transparency based on the angle of incidence of the
incoming ray and the surface normal, emulating the equation
used by Raster3D.
01/18/2010 o Fixed a problem with hybrid MPI+threads builds where
thread IDs other than zero were incorrectly being allowed to
make calls to the parallel message passing code.
11/05/2009 o Fixed a bug in the handling of transmission and reflection
rays in the presence of user-defined clipping planes. The
secondary rays were not being properly clipped due to a ray
flag not being propagated correctly.
07/15/2009 o Greatly improved efficiency of PPM and Targa image output
codes. Image output was making large BlueGene runs I/O bound.
The Targa format is costly on BlueGene due to the need to
swizzle RGB color channels to BGR order, apparently byte loads
and stores perform poorly on this architecture.
05/27/2009 o Updated vertex array primitives to allow the use of
volumetric texturing in place of vertex colored smooth
triangles, when the color block is not defined. This is
used by VMD for rendering of electrostatic potential maps.
05/17/2009 o Added new "shader_mode" scene file block where the
rendering quality setting, and ambient occlusion
settings can be specified, along with special
fog and transparency rendering modes used by VMD.
05/17/2009 o Increased efficacy of the combination of AA and AO samples,
such that any combination of AA and AO sample counts will
result in a grand total of AAsamples*AOsamples unique AO
sample rays for each pixel.
05/16/2009 o Updated X11 OpenGL window event handling to address a problem
on some platforms running KDE.
o Added additional color range clamping checks on output
so that larger-than-unity outline texture values can be used
without corrupting image data.
05/15/2009 o Added "outline" texturing feature for use with VMD
04/22/2009 o Added a VMD-specific fog rendering mode to allow renderings
to precisely match what is seen in OpenGL, which uses a
simple planar fog implementation.
Added higher level thread pool/iterator constructs intended
to eventually replace hand-coded thread calls in the rendering
loops. Various small tweaks to place GCC 4.4.x. Updated the
Make-arch configurations for GCC to only use -O3 since the
higher optimization levels are now ignored anyway.
03/24/2009 o Added Win32 condition variable implementations and enabled
multithreaded builds by default on Windows.
06/01/2008 o Added output image cropping for use by SPEC MPI benchmark
suite when rendering very large test images.
03/09/2007 o Correct the handling of cases where degenerate triangles
are eliminated from the scene by checking for NULL objects
before applying normal fixup mode changes.
......
/*
* Copyright (c) 1994-2007 John E. Stone
* Copyright (c) 1994-2011 John E. Stone
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
......@@ -10,10 +10,7 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by John E. Stone
* 4. The name of the author may not be used to endorse or promote products
* 3. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
......@@ -27,5 +24,8 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: Copyright,v 1.10 2011/02/05 18:56:09 johns Exp $
*
*/
$Id: README,v 1.27 2011/02/05 19:00:07 johns Exp $
README for Tachyon(tm) Parallel/Multiprocessor Ray Tracing Software
-------------------------------------------------------------------
Tachyon - 1967, from Greek "tachys", meaning "swift" or "speedy",
A hypothetical particle held to travel only faster than light.
Author: John E. Stone - johns@megapixel.com (preferred email address)
j.stone@acm.org (preferred email address)
johns@ks.uiuc.edu (work email address)
Author: John E. Stone - john.stone@gmail.com (preferred email address)
johns@ks.uiuc.edu (work email address)
What is Tachyon??
-----------------
What is Tachyon?
----------------
Tachyon is a result of my curiosities in computer graphics. Some of
it was written as part of my M.S. degree in Computer Science, other
parts of it were done purely for their entertainment value.
......@@ -50,7 +50,8 @@ How do I compile and run Tachyon?
All of the documentation, research papers, and seperately distributed
components related to this project can be retrieved from:
http://jedi.ks.uiuc.edu/~johns/raytracer/
http://www.photonlimited.com/~johns/tachyon/
http://jedi.ks.uiuc.edu/~johns/tachyon/
In addition to the existing documentation, feel free to send me email
with questions on how things work, or for help getting things compiled
......@@ -74,9 +75,9 @@ Copyrights etc.
except where noted within specific source files. You may use this code
for any purpose you wish, as long as credit is given to its source(s).
Last updated January 20, 2007
Last updated February 5, 2011
John E. Stone
johns@megapixel.com
johns@ks.uiuc.edu
john.stone@gmail.com
johns@ks.uiuc.edu
/glwin.c/1.12/Fri Aug 10 05:53:08 2001//
/glwin.h/1.3/Mon Mar 5 06:42:58 2001//
/jsinterp.h/1.1/Sun Feb 23 06:06:59 1997//
/mainanim.c/1.14/Wed Dec 20 00:09:36 2000//
/mgfparse.h/1.2/Thu Dec 11 17:07:02 1997//
/nffparse.h/1.3/Sat Nov 1 13:45:53 1997//
/spaceball.c/1.2/Sun Aug 19 06:57:06 2001//
/spaceball.h/1.2/Sun Aug 19 06:57:06 2001//
/tgatoyuv.c/1.3/Fri May 1 01:14:50 1998//
/trackball.c/1.1/Sun Aug 19 05:57:17 2001//
/trackball.h/1.1/Sun Aug 19 05:57:17 2001//
/animskull.c/1.11/Wed Jul 3 21:20:08 2002//
/animspheres.c/1.13/Wed Jul 3 21:20:08 2002//
/animspheres2.c/1.11/Wed Jul 3 21:20:08 2002//
/hypertex.c/1.13/Wed Jul 3 21:20:09 2002//
/nffparse.c/1.12/Wed Jul 3 21:20:09 2002//
/ac3dparse.c/1.18/Mon Jul 29 04:31:27 2002//
/ac3dparse.h/1.7/Mon Jul 29 04:31:27 2002//
/mgfparse.c/1.13/Mon Jul 29 04:31:27 2002//
/parse.h/1.28/Mon Feb 5 03:36:35 2007//
/fire.c/1.22/Tue Feb 13 09:00:35 2007//
/getargs.c/1.42/Tue Feb 13 09:00:35 2007//
/getargs.h/1.19/Tue Feb 13 09:00:35 2007//
/main.c/1.72/Tue Feb 13 09:00:35 2007//
/parse.c/1.73/Fri Mar 9 21:10:33 2007//
D
johns@74.134.246.53:/home/johns/cvsroot
......@@ -3,6 +3,8 @@
*
* See http://www.comp.lancs.ac.uk/computing/users/andy/ac3d/
* for more information on ac3d.
*
* $Id: ac3dparse.c,v 1.19 2011/02/02 06:08:56 johns Exp $
*/
#include <stdio.h>
......
/*
* definitions for parsing ac3d modeler files
*
*
* $Id: ac3dparse.h,v 1.8 2011/02/02 06:10:39 johns Exp $
*/
#define PARSENOERR 0
......
/* main.c
* This file contains the main program and driver for the raytracer.
/* animskull.c
* This file contains a demo program and driver for the raytracer.
*
* $Id: animskull.c,v 1.11 2002/07/03 04:59:28 johns Exp $
* $Id: animskull.c,v 1.12 2011/01/30 03:50:54 johns Exp $
*
*/
......
/* main.c
* This file contains the main program and driver for the raytracer.
/* animspheres.c
* This file contains a demo program and driver for the raytracer.
*
* $Id: animspheres.c,v 1.13 2002/07/03 04:59:28 johns Exp $
* $Id: animspheres.c,v 1.16 2011/01/31 15:26:14 johns Exp $
*
*/
......@@ -9,6 +9,11 @@
#include <stdlib.h>
#include <string.h>
#include "tachyon.h"
#include "glwin.h"
#if defined(USEOPENGL)
#include <GL/gl.h>
#endif
int rt_mynode(void); /* proto */
......@@ -167,15 +172,56 @@ void drawsp(SceneHandle scene) {
int main(int argc, char **argv) {
SceneHandle scene;
int i, j;
int i, xres, yres, maxframes;
apivector Ccenter, Cview, Cup;
apivector ctr1, ctr2;
apitexture tex1, tex2;
void * vtx1, * vtx2;
char fname[100];
int nosave, opengl;
void *glwin = NULL;
unsigned char *img = NULL;
rt_initialize(&argc, &argv);
nosave=0;
opengl=0;
xres=XRES;
yres=XRES;
maxframes=MAXFRAMES;
for (i=1; i<argc; i++) {
if (!strcmp("-res", argv[i])) {
if (i+2<argc) {
i++;
sscanf(argv[i], "%d", &xres);
i++;
sscanf(argv[i], "%d", &xres);
}
continue;
}
if (!strcmp("-frames", argv[i])) {
if (i+1<argc) {
i++;
sscanf(argv[i], "%d", &maxframes);
}
continue;
}
if (!strcmp("-nosave", argv[i])) {
nosave=1;
continue;
}
if (!strcmp("-opengl", argv[i])) {
opengl=1;
continue;
}
}
if (opengl) {
img = (unsigned char *) calloc(1, xres*yres*3);
if (img)
glwin = glwin_create(argv[0], xres, yres);
}
Ccenter.x=0.0; Ccenter.y=0.0; Ccenter.z=-3.0;
Cview.x=0.0; Cview.y=0.0; Cview.z=1.0;
Cup.x=0.0; Cup.y=1.0; Cup.z=0.0;
......@@ -193,19 +239,26 @@ int main(int argc, char **argv) {
tex2.col.b=1.0;
initspheres();
for (i=0; i<MAXFRAMES; i++) {
scene = rt_newscene();
vtx1=rt_texture(scene, &tex1);
vtx2=rt_texture(scene, &tex2);
sprintf(fname,"outfile.%4.4d.tga",i);
if (rt_mynode()==0) printf("Rendering: %s\n", fname);
if (!nosave) {
sprintf(fname,"outfile.%4.4d.tga",i);
if (rt_mynode()==0) printf("Rendering: %s\n", fname);
rt_outputfile(scene, fname);
} else {
printf("\rRendering %d... ", i);
fflush(stdout);
}
if (img != NULL)
rt_rawimage_rgb24(scene, img);
rt_outputfile(scene, fname);
rt_resolution(scene, XRES, YRES);
rt_resolution(scene, xres, yres);
rt_verbose(scene, 0);
rt_camera_setup(scene, 1.0, 1.0, 0, 5, Ccenter, Cview, Cup);
......@@ -218,14 +271,58 @@ int main(int argc, char **argv) {
rt_renderscene(scene);
#ifdef USEOPENGL
if (opengl) {
float wscalex, wscaley, wminscale;
float wxoffset, wyoffset;
int wsx, wsy, instereo, maxx, maxy;
glwin_get_wininfo(glwin, &instereo, NULL);
glwin_get_winsize(glwin, &wsx, &wsy);
maxx=xres;
maxy=yres;
wscalex = wsx / (float) maxx;
wscaley = wsy / (float) maxy;
wminscale = (wscalex < wscaley) ? wscalex : wscaley;
wxoffset = ((wminscale * maxx) - wsx) / 2.0f;
wyoffset = ((wminscale * maxy) - wsy) / 2.0f;
glDrawBuffer(GL_BACK);
glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
glClearColor(0.0, 0.0, 0.0, 1.0); /* black */
glViewport(0, 0, wsx, wsy);
glClear(GL_COLOR_BUFFER_BIT);
glShadeModel(GL_FLAT);
glViewport((int) -wxoffset, (int) -wyoffset, wsx, wsy);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(0.0, wsx, 0.0, wsy, -1.0, 1.0); /* flip upside-down image */
glMatrixMode(GL_MODELVIEW);
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
glPixelZoom(wminscale, wminscale); /* flip upside-down Tachyon image */
glwin_draw_image(glwin, xres, yres, img);
}
#endif
rt_deletescene(scene);
#if 0
for (j=0; j<NUMSP; j++)
free(sp[i].voidtex);
#endif
}
rt_finalize();
if (opengl) {
glwin_destroy(glwin);
if (img)
free(img);
}
return 0;
}
/*
* fire.c
* This file contains the main program and driver for the raytracer.
* This file contains a demo program and driver for the raytracer.
*
* $Id: fire.c,v 1.22 2007/02/12 19:05:30 johns Exp $
* $Id: fire.c,v 1.24 2011/01/30 04:34:52 johns Exp $
*/
#include <stdio.h>
......@@ -287,7 +287,7 @@ int main(int argc, char **argv) {
updatefire(); /* run one iteration of the fire code */
rt_camera_setup(scene, zoom, aspectratio, antialiasing,
6, Ccenter, Cview, Cup);
6, Ccenter, Cview, Cup);
rt_renderscene(scene);
......
/*
* getargs.c - command line argument parsing for tachyon command line
*
* $Id: getargs.c,v 1.57 2011/02/04 16:11:46 johns Exp $
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
......@@ -39,13 +43,14 @@ static void printusage(char **argv) {
printf("Valid options: (** denotes default behaviour)\n");
printf("----------------------------------------------\n");
printf("Message Options:\n");
printf(" +V verbose messages on \n");
printf(" -V verbose messages off **\n");
printf(" +V verbose messages on \n");
printf(" -V verbose messages off **\n");
printf("\n");
printf("Speed Tuning Options:\n");
printf(" -numthreads xxx (** default is auto-determined)\n");
printf(" -nobounding\n");
printf(" -boundthresh xxx (** default threshold is 16)\n");
printf(" -raydepth xxx (maximum ray recursion depth\n");
printf(" -numthreads xxx (** default is auto-determined)\n");
printf(" -nobounding\n");
printf(" -boundthresh xxx (** default threshold is 16)\n");
printf("\n");
printf("Shading Options:\n");
printf(" -fullshade best quality rendering (and slowest) **\n");
......@@ -73,9 +78,20 @@ static void printusage(char **argv) {
printf(" -shade_nullphong disable specular highlights\n");
printf("\n");
printf("Transparency Shading Options:\n");
printf(" -trans_max_surfaces xxx Limit the number of transparent\n");
printf(" surfaces shown to the number specified\n");
printf(" -trans_orig Original implementation**\n");
printf(" -trans_raster3d Raster3D angle-based opacity modulation\n");
printf(" -trans_vmd Opacity post-multiply used by VMD\n");
printf("\n");
printf("Transparent Surface Shadowing Options:\n");
printf(" -shadow_filter_on Transparent objects cast shadows**\n");
printf(" -shadow_filter_off Transparent objects do not cast shadows\n");
printf("\n");
printf("Fog Shading Options:\n");
printf(" -fog_radial Radial fog implementation**\n");
printf(" -fog_vmd Planar OpenGL-like fog used by VMD\n");
printf("\n");
printf("Surface Normal/Winding Order Fixup Mode:\n");
printf(" -normalfixup [off | flip | guess] (**off is default)\n");
printf("\n");
......@@ -107,17 +123,14 @@ static void printusage(char **argv) {
printf(" -format TARGA 24-bit Targa (uncompressed) **\n");
printf("\n");
printf("Animation Related Options:\n");
printf(" -camfile filename.cam Animate using file of camera positions.\n");
printf(" -nosave Disable writing of output frames to disk\n");
printf(" -camfile filename.cam Animate using file of camera positions.\n");
printf(" -nosave Disable writing of output frames to disk\n");
printf(" (only used for doing real-time rendering)\n");
printf("\n");
#if defined(USESPACEBALL)
printf("Interactive Spaceball Control:\n");
printf(" -spaceball devicename \n");
printf("Interactive Spaceball/SpaceNavigator Control:\n");
printf(" -spaceball Enable Spaceball/SpaceNavigator camera flight\n");
printf(" -spaceballport serialportdevicename (only for serial devices)\n");
printf("\n");
#endif
}
static void initoptions(argoptions * opt) {
......@@ -129,13 +142,17 @@ static void initoptions(argoptions * opt) {
opt->xsize = 0;
opt->ysize = 0;
opt->verbosemode = -1;
opt->ray_maxdepth = -1;
opt->aa_maxsamples = -1;
opt->boundmode = -1;
opt->boundthresh = -1;
opt->usecamfile = -1;
opt->shadermode = -1;
opt->phongfunc = -1;
opt->transcount = -1;
opt->transmode = -1;
opt->shadow_filtering = -1;
opt->fogmode = -1;
opt->normalfixupmode = -1;
opt->imgprocess = -1;
opt->imggamma = 1.0;
......@@ -145,6 +162,11 @@ static void initoptions(argoptions * opt) {
opt->auto_skylight = 0.0;
opt->add_skylight = 0.0;
opt->skylight_samples = 128;
opt->cropmode = 0; /* SPECMPI image cropping */
opt->cropxres = 0;
opt->cropyres = 0;
opt->cropxstart = 0;
opt->cropystart = 0;
}
/* process options that affect scene generation */
......@@ -156,7 +178,7 @@ int presceneoptions(argoptions * opt, SceneHandle scene) {
return 0;
}
/* process options that scene rendering */
/* process options that affect scene rendering */
int postsceneoptions(argoptions * opt, SceneHandle scene) {
if (opt->outimageformat == -1) {
opt->outimageformat = RT_FORMAT_TARGA;
......@@ -165,6 +187,17 @@ int postsceneoptions(argoptions * opt, SceneHandle scene) {
rt_resolution(scene, opt->xsize, opt->ysize);
}
if (opt->cropmode != 0) {
if (opt->cropmode == 1) {
rt_crop_output(scene, opt->cropxres, opt->cropyres,
opt->cropxstart, opt->cropystart);
} else {
int xs, ys;
rt_get_resolution(scene, &xs, &ys);
rt_crop_output(scene, 100, 100, xs/2 - 50, ys/2 - 50);
}
}
if (opt->useoutfilename == -1) {
if (opt->usecamfile != -1) {
strcpy(opt->outfilename, "cam.%04d");
......@@ -223,9 +256,9 @@ int postsceneoptions(argoptions * opt, SceneHandle scene) {
/* enable ambient occlusion lighting, and rescale direct lights */
/* to compensate. */
apicolor col;
float lightscale = 1.0 - opt->auto_skylight;
if (lightscale < 0.0)
lightscale = 0.0;
float lightscale = 1.0f - opt->auto_skylight;
if (lightscale < 0.0f)
lightscale = 0.0f;
rt_rescale_lights(scene, lightscale);
col.r = opt->auto_skylight;
......@@ -268,6 +301,10 @@ int postsceneoptions(argoptions * opt, SceneHandle scene) {
rt_verbose(scene, 0);
}
if (opt->ray_maxdepth != -1) {
rt_camera_raydepth(scene, opt->ray_maxdepth);
}
if (opt->aa_maxsamples != -1) {
rt_aa_maxsamples(scene, opt->aa_maxsamples);
}
......@@ -288,10 +325,22 @@ int postsceneoptions(argoptions * opt, SceneHandle scene) {
rt_phong_shader(scene, opt->phongfunc);
}
if (opt->transcount != -1) {
rt_trans_max_surfaces(scene, opt->transcount);
}
if (opt->transmode != -1) {
rt_trans_mode(scene, opt->transmode);
}
if (opt->shadow_filtering != -1) {
rt_shadow_filtering(scene, opt->shadow_filtering);
}
if (opt->fogmode != -1) {
rt_fog_rendering_mode(scene, opt->fogmode);
}
if (opt->numthreads != -1) {
rt_set_numthreads(scene, opt->numthreads);
}
......@@ -331,6 +380,10 @@ static int getparm(int argc, char **argv, int num, argoptions * opt, int node) {
}
return 2;
}
if (!strcmp(argv[num], "-raydepth")) {
sscanf(argv[num + 1], "%d", &opt->ray_maxdepth);
return 2;
}
if (!strcmp(argv[num], "-aasamples")) {
sscanf(argv[num + 1], "%d", &opt->aa_maxsamples);
return 2;
......@@ -403,12 +456,42 @@ static int getparm(int argc, char **argv, int num, argoptions * opt, int node) {
opt->phongfunc = RT_SHADER_NULL_PHONG;
return 1;
}
if (!strcmp(argv[num], "-trans_max_surfaces")) {
sscanf(argv[num + 1], "%d", &opt->transcount);
return 2;
}
if (!strcmp(argv[num], "-trans_orig")) {
opt->transmode = RT_TRANS_ORIG;
opt->transmode = RT_TRANS_ORIG; /* reset all flags to default */
return 1;
}
if (!strcmp(argv[num], "-trans_raster3d")) {
if (opt->transmode == -1)
opt->transmode = RT_TRANS_RASTER3D; /* combine with o