18 static int strupncmp(
const char *a, 
const char *b, 
int n) {
    20       if (toupper(*a) != toupper(*b)) {
    21          return toupper(*b) - toupper(*a);
    23       if (*a == 0) 
return 0;
    29 static int compare(
const char *a, 
const char *b) {
    30   if (strlen(a) != strlen(b)) 
    38   printf(
"  %s modelfile [options] \n", argv[0]);
    40   printf(
"Model file formats supported:\n");
    41   printf(
"  filename.dat -- The model files originated with this package.\n");
    42   printf(
"  filaname.ac  -- AC3D model files.\n");
    44   printf(
"  filaname.mgf -- MGF model files.\n");
    46   printf(
"  filename.nff -- The NFF scene format used by Eric Haines' SPD.\n");
    48   printf(
"Valid options:  (** denotes default behaviour)\n");
    49   printf(
"----------------------------------------------\n");
    50   printf(
"Message Options:\n");
    51   printf(
"  +V verbose messages on \n");
    52   printf(
"  -V verbose messages off **\n");
    54   printf(
"Speed Tuning Options:\n");
    55   printf(
"  -raydepth xxx     (maximum ray recursion depth\n");
    56   printf(
"  -numthreads xxx   (** default is auto-determined)\n");
    57   printf(
"  -nobounding\n");
    58   printf(
"  -boundthresh xxx  (** default threshold is 16)\n");
    60   printf(
"Shading Options:\n");
    61   printf(
"  -fullshade    best quality rendering (and slowest) **\n");
    62   printf(
"  -mediumshade  good quality rendering, but no shadows\n");
    63   printf(
"  -lowshade     low quality rendering, preview (and fast)\n");
    64   printf(
"  -lowestshade  worst quality rendering, preview (and fastest)\n");
    66   printf(
"Lighting Options:\n");
    67   printf(
"  -rescale_lights xxx rescale light intensity values by\n");
    68   printf(
"                      specified factor (performed before other\n");
    69   printf(
"                      lighting overrides take effect)\n");
    70   printf(
"  -auto_skylight xxx  force use of ambient occlusion lighting,\n");
    71   printf(
"                      auto-rescaling direct light sources to  \n");
    72   printf(
"                      compensate for ambient occlusion factor.\n");
    73   printf(
"                      (use value 0.7 as a good starting point)\n");
    74   printf(
"  -add_skylight xxx   force use of ambient occlusion lighting,\n");
    75   printf(
"                      manually-rescaling direct light sources to\n");
    76   printf(
"                      compensate for ambient occlusion factor.\n");
    77   printf(
"  -skylight_maxdist xxx AO maximum occlusion distance cutoff.\n");
    78   printf(
"  -skylight_samples xxx number of sample rays to shoot.\n");
    80   printf(
"Specular Highlight Shading Options:\n");
    81   printf(
"  -shade_phong       Phong specular highlights\n");
    82   printf(
"  -shade_blinn       Blinn's specular highlights**\n");
    83   printf(
"  -shade_blinn_fast  fast approximation to Blinn's highlights\n");
    84   printf(
"  -shade_nullphong   disable specular highlights\n");
    86   printf(
"Transparency Shading Options:\n");
    87   printf(
"  -trans_max_surfaces xxx  Limit the number of transparent\n");
    88   printf(
"                           surfaces shown to the number specified\n");
    89   printf(
"  -trans_orig        Original implementation**\n");
    90   printf(
"  -trans_raster3d    Raster3D angle-based opacity modulation\n");
    91   printf(
"  -trans_vmd         Opacity post-multiply used by VMD\n");
    93   printf(
"Transparent Surface Shadowing Options:\n");
    94   printf(
"  -shadow_filter_on  Transparent objects cast shadows**\n");  
    95   printf(
"  -shadow_filter_off Transparent objects do not cast shadows\n");
    97   printf(
"Fog Shading Options:\n");
    98   printf(
"  -fog_radial        Radial fog implementation**\n");
    99   printf(
"  -fog_vmd           Planar OpenGL-like fog used by VMD\n");
   101   printf(
"Surface Normal/Winding Order Fixup Mode:\n");
   102   printf(
"  -normalfixup [off | flip | guess]  (**off is default)\n");
   104   printf(
"Antialiasing Options:\n");
   105   printf(
"  -aasamples xxx  (maximum supersamples taken per pixel)\n");
   106   printf(
"                  (** default is 0, or scene file determined)\n");
   108   printf(
"Output Options:\n");
   109   printf(
"  -res Xres Yres  override scene-defined output image size\n");
   110   printf(
"  -o outfile.tga  set output file name\n");
   111   printf(
"  -clamp          clamp pixel values to [0 to 1) (** default)\n");
   112   printf(
"  -normalize      normalize pixel values to [0 to 1)\n");
   113   printf(
"  -gamma val      normalize apply gamma correction\n");
   114   printf(
"  -format BMP     24-bit Windows BMP  (uncompressed)\n");
   116   printf(
"  -format JPEG    24-bit JPEG         (compressed, but lossy)\n");
   118   printf(
"  -format JPEG    XXX Not compiled into this binary XXX\n");
   121   printf(
"  -format PNG     24-bit PNG          (compressed, lossless)\n");
   123   printf(
"  -format PNG     XXX Not compiled into this binary XXX\n");
   125   printf(
"  -format PPM     24-bit PPM          (uncompressed)\n");
   126   printf(
"  -format PPM48   48-bit PPM          (uncompressed)\n");
   127   printf(
"  -format PSD48   48-bit PSD          (uncompressed)\n");
   128   printf(
"  -format RGB     24-bit SGI RGB      (uncompressed)\n");
   129   printf(
"  -format TARGA   24-bit Targa        (uncompressed) **\n");
   131   printf(
"Animation Related Options:\n");
   132   printf(
"  -camfile filename.cam  Animate using file of camera positions.\n");
   133   printf(
"  -nosave                Disable writing of output frames to disk\n");
   134   printf(
"                        (only used for doing real-time rendering)\n");
   136   printf(
"Interactive Spaceball/SpaceNavigator Control:\n");
   137   printf(
"  -spaceball       Enable Spaceball/SpaceNavigator camera flight\n");
   138   printf(
"  -spaceballport serialportdevicename (only for serial devices)\n");
   144   opt->
filenames = (
char **) malloc(
sizeof(
char *) * 10);
   267     if (lightscale < 0.0f)
   359   if (!strcmp(argv[num], 
"-o")) {
   361     sscanf(argv[num + 1], 
"%s", (
char *) &opt->
outfilename);
   364   if (!strcmp(argv[num], 
"-numthreads")) {
   365     sscanf(argv[num + 1], 
"%d", &opt->
numthreads);
   368   if (!strcmp(argv[num], 
"-camfile")) {
   373   if (!strcmp(argv[num], 
"-nosave")) {
   378   if (!strcmp(argv[num], 
"-normalfixup")) {
   380     sscanf(argv[num + 1], 
"%s", tmp);
   381     if (!strcmp(tmp, 
"off")) {
   383     } 
else if (!strcmp(tmp, 
"flip")) {
   385     } 
else if (!strcmp(tmp, 
"guess")) {
   390   if (!strcmp(argv[num], 
"-raydepth")) {
   394   if (!strcmp(argv[num], 
"-aasamples")) {
   398   if (!strcmp(argv[num], 
"-V")) {
   403   if (!strcmp(argv[num], 
"+V")) {
   408   if (!strcmp(argv[num], 
"-nobounding")) {
   413   if (!strcmp(argv[num], 
"-boundthresh")) {
   418   if (!strcmp(argv[num], 
"-fullshade")) {
   422   if (!strcmp(argv[num], 
"-mediumshade")) {
   426   if (!strcmp(argv[num], 
"-lowshade")) {
   430   if (!strcmp(argv[num], 
"-lowestshade")) {
   434   if (!strcmp(argv[num], 
"-rescale_lights")) {
   438   if (!strcmp(argv[num], 
"-auto_skylight")) {
   442   if (!strcmp(argv[num], 
"-add_skylight")) {
   446   if (!strcmp(argv[num], 
"-skylight_maxdist")) {
   450   if (!strcmp(argv[num], 
"-skylight_samples")) {
   454   if (!strcmp(argv[num], 
"-shade_phong")) {
   458   if (!strcmp(argv[num], 
"-shade_blinn")) {
   462   if (!strcmp(argv[num], 
"-shade_blinn_fast")) {
   466   if (!strcmp(argv[num], 
"-shade_nullphong")) {
   470   if (!strcmp(argv[num], 
"-trans_max_surfaces")) {
   471     sscanf(argv[num + 1], 
"%d", &opt->
transcount);
   474   if (!strcmp(argv[num], 
"-trans_orig")) {
   478   if (!strcmp(argv[num], 
"-trans_raster3d")) {
   485   if (!strcmp(argv[num], 
"-trans_vmd")) {
   492   if (!strcmp(argv[num], 
"-shadow_filter_on")) {
   496   if (!strcmp(argv[num], 
"-shadow_filter_off")) {
   500   if (!strcmp(argv[num], 
"-fog_normal")) {
   504   if (!strcmp(argv[num], 
"-fog_vmd")) {
   508   if (!strcmp(argv[num], 
"-res")) {
   509     sscanf(argv[num + 1], 
"%d", &opt->
xsize);
   510     sscanf(argv[num + 2], 
"%d", &opt->
ysize);
   513   if (!strcmp(argv[num], 
"-cropoutputauto")) {
   517   if (!strcmp(argv[num], 
"-cropoutput")) {
   519     sscanf(argv[num + 1], 
"%d", &opt->
cropxres);
   520     sscanf(argv[num + 2], 
"%d", &opt->
cropyres);
   521     sscanf(argv[num + 3], 
"%d", &opt->
cropxstart);
   522     sscanf(argv[num + 4], 
"%d", &opt->
cropystart);
   525   if (!strcmp(argv[num], 
"-clamp")) {
   529   if (!strcmp(argv[num], 
"-normalize")) {
   533   if (!strcmp(argv[num], 
"-gamma")) {
   535     sscanf(argv[num + 1], 
"%f", &opt->
imggamma);
   538   if (!strcmp(argv[num], 
"-format")) {
   540     sscanf(argv[num + 1], 
"%s", &str[0]);
   544     } 
else if (!
compare(str, 
"BMP")) {
   546     } 
else if (!
compare(str, 
"PPM48")) {
   548     } 
else if (!
compare(str, 
"PPM")) {
   550     } 
else if (!
compare(str, 
"PSD48")) {
   552     } 
else if (!
compare(str, 
"RGB")) {
   555     } 
else if (!
compare(str, 
"JPEG")) {
   559     } 
else if (!
compare(str, 
"PNG")) {
   564         printf(
"Unknown/Unsupported Image Format: %s, defaulting to Targa...\n", str);
   569   if (!strcmp(argv[num], 
"-spaceball")) {
   573   if (!strcmp(argv[num], 
"-spaceballport")) {
   580     printf(
"Unrecognized parameter/option flag: %s\n", argv[num]);
   602     if (argv[i][0] == 
'-' || argv[i][0] == 
'+') {
   603       rc = 
getparm(argc, argv, i, opt, node);
   616         (
char *) malloc(
sizeof(
char) * strlen(argv[i]) + 1);
   622     printf(
"parsefile[%d]: %s\n", i, opt->
filenames[i]);
   634       printf(
"Missing model file name!\n");
 int transcount
max transparent surfaces to render 
 
#define RT_NORMAL_FIXUP_GUESS
random normal/winding, use best guess 
 
float g
Green color component. 
 
#define RT_FORMAT_PPM
24-bit NetPBM PPM file 
 
float r
Red color component. 
 
int shadermode
quality level 
 
void rt_set_numthreads(SceneHandle voidscene, int numthreads)
Explicitly set the number of worker threads Tachyon will use. 
 
int cropmode
post rendering image crop (SPECMPI) 
 
int verbosemode
verbose flags 
 
static int strupncmp(const char *a, const char *b, int n)
 
void rt_shadermode(SceneHandle voidscene, int mode)
Set the shading mode for the specified scene. 
 
void rt_resolution(SceneHandle voidscene, int hres, int vres)
Set the horizontal and vertical resolution (in pixels) for the specified scene. 
 
#define RT_TRANS_VMD
mult shaded color by opacity, for VMD 
 
void rt_trans_mode(SceneHandle voidscene, int mode)
Set transparency rendering mode. 
 
static void printusage(char **argv)
 
int ray_maxdepth
maximum ray recursion depth 
 
void rt_trans_max_surfaces(SceneHandle voidscene, int count)
Set the maximum number of transparent surfaces that will be rendered. 
 
void rt_fog_rendering_mode(SceneHandle voidscene, int mode)
Set fog rendering mode, either radial fog (native Tachyon behavior), or an OpenGL- or VMD-like planar...
 
char camfilename[FILENAME_MAX]
camera filename 
 
#define RT_SHADER_NULL_PHONG
Disable Phong contributions. 
 
char ** filenames
list of model files to render 
 
int ysize
override default image y resolution 
 
#define RT_SHADER_LOW
low quality shading 
 
#define RT_TRANS_ORIG
original transparency mode 
 
int imgprocess
image post processing flags 
 
#define RT_SHADER_BLINN_FAST
Fast version of Blinn's equation. 
 
void rt_aa_maxsamples(SceneHandle voidscene, int maxsamples)
Sets the maximum number of supersamples to take for any pixel. 
 
#define RT_SHADER_FULL
Highest quality shading available. 
 
int boundmode
bounding mode 
 
int shadow_filtering
transparent surface shadowing mode 
 
#define RT_FORMAT_JPEG
24-bit JPEG file 
 
int numthreads
explicit number of threads to use 
 
void freeoptions(argoptions *opt)
 
int boundthresh
bounding threshold 
 
float imggamma
image gamma correction factor 
 
char spaceballport[FILENAME_MAX]
spaceball serial port device 
 
int skylight_samples
number of ambient occlusion samples 
 
int normalfixupmode
override normal fixup mode 
 
static void initoptions(argoptions *opt)
 
void rt_ambient_occlusion(SceneHandle voidscene, int numsamples, apiflt maxdist, apicolor col)
Ambient occlusion lighting, with monte carlo sampling of omnidirectional "sky" light. 
 
#define RT_TRANS_RASTER3D
angle-dependent opacity modulation 
 
void rt_rescale_lights(SceneHandle voidscene, flt lightscale)
Rescale all light sources in the scene by factor lightscale. 
 
int nosave
don't write output image to disk 
 
#define RT_FOG_VMD
planar OpenGL-like fog 
 
#define RT_BOUNDING_DISABLED
Disable spatial subdivision/bounding. 
 
#define RT_SHADER_LOWEST
lowest quality shading available 
 
int fogmode
fog rendering mode 
 
int numfiles
number of files to render 
 
float auto_skylight
automatic ambient occlusion lighting 
 
#define RT_AO_MAXDIST_UNLIMITED
unlimited AO distaned macro 
 
void rt_image_gamma(SceneHandle voidscene, float gamma)
Apply gamma correction to the pixel values after normalization. 
 
char outfilename[FILENAME_MAX]
name of output image file 
 
void rt_outputfile(SceneHandle voidscene, const char *outname)
Set the filename for the output image for the specified scene. 
 
#define RT_FORMAT_TARGA
24-bit Targa file 
 
#define RT_NORMAL_FIXUP_FLIP
flip normals to agree with winding order 
 
float rescale_lights
direct lighting rescaling factor 
 
void rt_normal_fixup_mode(SceneHandle voidscene, int mode)
Set the surface normal and polygon winding order fixup mode to use when generating triangles with int...
 
#define RT_FORMAT_SGIRGB
24-bit SGI RGB file 
 
void rt_phong_shader(SceneHandle voidscene, int mode)
Set the equation used for rendering specular highlights. 
 
#define RT_FORMAT_WINBMP
24-bit Windows BMP file 
 
int postsceneoptions(argoptions *opt, SceneHandle scene)
 
void rt_image_normalize(SceneHandle voidscene)
Enable renormalization of pixel values to the range [0 1) (rather than clamping) prior to output...
 
int presceneoptions(argoptions *opt, SceneHandle scene)
 
float skylight_maxdist
AO max occlusion distance cutoff. 
 
#define RT_SHADER_BLINN
Blinn's specular highlights, as in OpenGL. 
 
static int compare(const char *a, const char *b)
 
#define RT_SHADER_MEDIUM
Medium quality shading. 
 
int usecamfile
use camera file 
 
void rt_image_clamp(SceneHandle voidscene)
Enable clamping of pixel values to the range [0 1) (rather than renormalizing) prior to output...
 
int outimageformat
format of output image 
 
float b
Blue color component. 
 
float add_skylight
ambient occlusion lighting factor 
 
#define RT_FORMAT_PPM48
48-bit NetPBM PPM file 
 
int aa_maxsamples
antialiasing setting 
 
void rt_outputformat(SceneHandle voidscene, int format)
Set the format of the output image(s). 
 
void rt_boundthresh(SceneHandle voidscene, int threshold)
Set the threshold to be used when automatic generation of ray tracing acceleration structures is to b...
 
int xsize
override default image x resolution 
 
void rt_camera_raydepth(SceneHandle voidscene, int maxdepth)
Camera maximum ray recursion depth (i.e. 
 
int spaceballon
spaceball input enabled 
 
void rt_boundmode(SceneHandle voidscene, int mode)
Enables or disable automatic generation and use of ray tracing acceleration data structures. 
 
#define RT_SHADER_PHONG
Phong specular highlights. 
 
#define RT_FORMAT_PNG
24-bit PNG file 
 
static int getparm(int argc, char **argv, int num, argoptions *opt, int node)
 
void rt_get_resolution(SceneHandle voidscene, int *hres, int *vres)
Get the horizontal and vertical resolution (in pixels) for the specified scene. 
 
#define RT_NORMAL_FIXUP_OFF
surface normals and winding order agree 
 
int transmode
transparency rendering mode 
 
Tachyon public API function prototypes and declarations used to drive the ray tracing engine...
 
#define RT_FORMAT_PSD48
48-bit Photoshop PSD file 
 
#define RT_FOG_NORMAL
radial fog 
 
void rt_crop_output(SceneHandle voidscene, int hres, int vres, int sx, int sy)
Crop the output image to the specified size, intended only for use in SPECMPI benchmarking. 
 
int getargs(int argc, char **argv, argoptions *opt, int node)
 
int phongfunc
shader for specular highlights 
 
int useoutfilename
override output filename 
 
void rt_verbose(SceneHandle voidscene, int v)
Enables or Disables verbose messages from the Tachyon library during rendering. 
 
void rt_shadow_filtering(SceneHandle voidscene, int onoff)
Control whether or not transparent surfaces modulate incident light or not.