home *** CD-ROM | disk | FTP | other *** search
/ rtsi.com / 2014.01.www.rtsi.com.tar / www.rtsi.com / OS9 / OSK / GRAPHICS / rayshade.lzh / DOC / rayshade.man < prev    next >
Text File  |  1990-08-31  |  51KB  |  1,189 lines

  1.  
  2.  
  3.  
  4. RAYSHADE(1G)              USER COMMANDS              RAYSHADE(1G)
  5.  
  6.  
  7.  
  8. NAME
  9.      rayshade - a ray tracing program
  10.  
  11. SYNOPSIS
  12.      rayshade [ _o_p_t_i_o_n_s ] [ _f_i_l_e_n_a_m_e ]
  13.  
  14. DESCRIPTION
  15.      _R_a_y_s_h_a_d_e reads a file describing a scene to be rendered  and
  16.      produces  a  Utah  Raster  RLE format file of the ray-traced
  17.      image.
  18.  
  19. OPTIONS
  20.      -C _r_e_d__c_o_n_t_r_a_s_t _g_r_e_e_n__c_o_n_t_r_a_s_t _b_l_u_e__c_o_n_t_r_a_s_t
  21.           Set contrast factors used in controlling pixel subdivi-
  22.           sion.
  23.  
  24.      -c   Trace shadow rays through transparent objects.
  25.  
  26.      -E _e_y_e__s_e_p_a_r_a_t_i_o_n
  27.           Set eye separation for stereo imaging.
  28.  
  29.      -F _r_e_p_o_r_t__f_r_e_q
  30.           Set frequency, in lines, of status report (default 10).
  31.  
  32.      -h   Print a short usage message.
  33.  
  34.      -j   Perform jittered sampling.
  35.  
  36.      -L _s_t_a_r_t__l_i_n_e
  37.           Begin trace on line _s_t_a_r_t__l_i_n_e, appending to image file
  38.           (requires -O option).
  39.  
  40.      -l   Render image for left eye (requires -E option).
  41.  
  42.      -n   Do not trace shadow rays.
  43.  
  44.      -O _o_u_t_p_u_t__f_i_l_e
  45.           Override image file name in input file, if any.
  46.  
  47.      -P _p_i_x_e_l__s_u_b_d_i_v_i_s_i_o_n_s
  48.           Specifies the maximum number of times a  pixel  may  be
  49.           subdivided.
  50.  
  51.      -p   Discard polygons with degenerate edges.
  52.  
  53.      -q   Do not print warning messages.
  54.  
  55.      -R _x_r_e_s _y_r_e_s
  56.           Set image resolution.
  57.  
  58.      -r   Render image for right eye (requires -E option).
  59.  
  60.  
  61.  
  62.  
  63. Sun Release 4.0  Last change: September 11, 1989                1
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. RAYSHADE(1G)              USER COMMANDS              RAYSHADE(1G)
  71.  
  72.  
  73.  
  74.      -S _s_a_m_p_l_e_s
  75.           Specifies number of jittered samples.
  76.  
  77.      -s   Do not cache shadowing information.
  78.  
  79.      -T _t_h_r_e_s_h
  80.           Specifies adaptive ray-depth cutoff threshold.
  81.  
  82.      -V _f_i_l_e_n_a_m_e
  83.           Write verbose output to _f_i_l_e_n_a_m_e.
  84.  
  85.      -v   Write verbose output to standard output.
  86.  
  87.      -W _w_o_r_k_e_r_s
  88.           Specify  number  of  worker  processes  (Linda  version
  89.           only).
  90.  
  91.      -w   Write verbose worker information to the standard  error
  92.           (Linda version only).
  93.  
  94. OVERVIEW
  95.      _R_a_y_s_h_a_d_e is a  ray  tracing  program  capable  of  rendering
  96.      images  composed  of  a  large  number of primitive objects.
  97.      _R_a_y_s_h_a_d_e reads a series of lines supplied  on  the  standard
  98.      input  or  contained  in the file named on the command line.
  99.      After reading the input file, _r_a_y_s_h_a_d_e  renders  the  image.
  100.      As  each  scanline is rendered, pixels are written to a Utah
  101.      Raster RLE format image file.  By default, this  image  file
  102.      is  written to the standard output, and information messages
  103.      and statistics are written to the standard error.
  104.  
  105. INPUT FILE FORMAT
  106.      The input file consists of commands  (denoted  by  keywords)
  107.      followed by numerical or character arguments.  Spaces, tabs,
  108.      or newlines may be used  to  separate  items  in  the  file.
  109.      Coordinates   and   vectors   are   specified  in  arbitrary
  110.      floating-point units, and may be written with or  without  a
  111.      decimal  point.   Colors  are  specified  as  red-green-blue
  112.      floating-point triplets which indicate intensity  and  range
  113.      from 0 (zero intensity) to 1. (full intensity).
  114.  
  115.      The following sections describe the keywords  which  may  be
  116.      included  in  the  input  file.   Items in boldface type are
  117.      literals, while square brackets surround optional items.
  118.  
  119.  
  120. VIEWING PARAMETERS
  121.      eyep _x _y _z
  122.           Specifies the eye's position in space.  The default  is
  123.           (0, 20, 0).
  124.  
  125.      lookp _x _y _z
  126.  
  127.  
  128.  
  129. Sun Release 4.0  Last change: September 11, 1989                2
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136. RAYSHADE(1G)              USER COMMANDS              RAYSHADE(1G)
  137.  
  138.  
  139.  
  140.           Specifies the point at which the eye is  looking.   The
  141.           default is (0, 0, 0).
  142.  
  143.      up _x _y _z
  144.           Specifies the direction which should be considered "up"
  145.           from  the  eye's  position.  Note that this vector need
  146.           not be perpendicular to the  vector  between  the  look
  147.           point  and  the  eye's position.  The default is (0, 0,
  148.           1.).
  149.  
  150.      fov _h_o_r_i_z_o_n_t_a_l__f_i_e_l_d__o_f__v_i_e_w [_v_e_r_t_i_c_a_l__f_i_e_l_d__o_f__v_i_e_w]
  151.           The horizontal field of view specifies  the  angle,  in
  152.           degrees,  between  the left-most and right-most columns
  153.           of pixels If present, the vertical field of view speci-
  154.           fies  the  angle between the center of the top-most and
  155.           bottom-most row of pixels.  If not present, the  verti-
  156.           cal  field of view is calculated using the screen reso-
  157.           lution and the assumption that pixels are square.   The
  158.           default  horizontal  field-of-view is 45 degrees, while
  159.           the default vertical  field-of-view  is  calculated  as
  160.           described above.
  161.  
  162. IMAGE GENERATION
  163.      When specified  in  the  input  file,  many  of  the  image-
  164.      generation  commands  may be overridden through command-line
  165.      options.  For example, the line  "screen  1024  768"  in  an
  166.      input  file  may be overridden by specifying "-R 128 128" on
  167.      the command line.
  168.  
  169.      screen _x__r_e_s_o_l_u_t_i_o_n _y__r_e_s_o_l_u_t_i_o_n
  170.           Specifies the horizontal and vertical resolution of the
  171.           image  to  be rendered.  This command may be overridden
  172.           through use of the -R option.  The  default  resolution
  173.           is 512 by 512 pixels.
  174.  
  175.      background _r_e_d _g_r_e_e_n _b_l_u_e
  176.           Specifies the color that should  be  assigned  to  rays
  177.           which  do  not  strike  any  object  in the scene.  The
  178.           default is black (0, 0, 0).
  179.  
  180.      outfile _f_i_l_e_n_a_m_e
  181.           Specifies the name of the file to which  the  resulting
  182.           image  should  be  written.   By  default, the image is
  183.           written to the standard output.  This  command  may  be
  184.           overridden through the use of the -O option.
  185.  
  186.      aperture _a_p_e_r_t_u_r_e__r_a_d_i_u_s
  187.           The _a_p_e_r_t_u_r_e__r_a_d_i_u_s is the radius, in world  units,  of
  188.           the aperture centered at the eye point.  This controls,
  189.           in conjunction with focaldist, the depth of field,  and
  190.           thus  the  amount  of  focus  blur present in the final
  191.           image.  Rays  are  cast  from  various  places  on  the
  192.  
  193.  
  194.  
  195. Sun Release 4.0  Last change: September 11, 1989                3
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202. RAYSHADE(1G)              USER COMMANDS              RAYSHADE(1G)
  203.  
  204.  
  205.  
  206.           aperture  disk  towards a point which is _f_o_c_a_l__d_i_s_t_a_n_c_e
  207.           units from the  center  of  the  aperture  disk.   This
  208.           causes  objects which are _f_o_c_a_l__d_i_s_t_a_n_c_e units from the
  209.           eye  point  to  be  in  sharp  focus.   Note  that   an
  210.           _a_p_e_r_t_u_r_e__r_a_d_i_u_s  of  zero causes a pinhole camera model
  211.           to be used, and there will be no blurring (this is  the
  212.           default).   Increasing  the  aperture  radius  leads to
  213.           increased blurring.  When  using  a  non-zero  aperture
  214.           radius, it is best to use jittered sampling in order to
  215.           reduce aliasing effects.
  216.  
  217.      focaldist _f_o_c_a_l__d_i_s_t_a_n_c_e
  218.           Specifies the distance, in world units,  from  the  eye
  219.           point  to  the  focal  plane.  Points which lie in this
  220.           plane will  always  be  in  sharp  focus.   By  keeping
  221.           _a_p_e_r_t_u_r_e__r_a_d_i_u_s  constant  and changing _f_o_c_a_l__d_i_s_t_a_n_c_e,
  222.           it is possible to create a  sequence  of  frames  which
  223.           simulate  pulling focus.  By default, _f_o_c_a_l__d_i_s_t_a_n_c_e is
  224.           equal to the distance from the eye point  to  the  look
  225.           point.
  226.  
  227.      maxdepth _m_a_x_i_m_u_m__d_e_p_t_h
  228.           Controls the  maximum  depth  of  the  ray  tree.   The
  229.           default  is  3, with eye rays considered to be of depth
  230.           zero.
  231.  
  232.      cutoff _c_u_t_o_f_f__t_h_r_e_s_h_o_l_d
  233.           Specifies  the  adaptive  ray-depth  cutoff  threshold.
  234.           When  any ray's maximum contribution to the final color
  235.           of a pixel falls below this  value,  the  ray  and  its
  236.           children  (specularly  transmitted  and reflected rays)
  237.           are not spawned.   This  threshold  may  be  overridden
  238.           through the use of the -T option.  The default value is
  239.           0.001.
  240.  
  241.      jittered
  242.           Use "jittered" sampling.  This command may be  overrid-
  243.           den  through  the use of the -P option.  The default is
  244.           to use adaptive supersampling.
  245.  
  246.      adaptive _m_a_x__d_i_v_i_s_i_o_n_s
  247.           Specifies that adaptive supersampling should  be  used,
  248.           and   that   each  pixel  may  be  subdivided  at  most
  249.           _m_a_x__d_i_v_i_s_i_o_n_s times.  This command  may  be  overridden
  250.           through  the  use of the -j or -P options.  The default
  251.           value is one.
  252.  
  253.      samples _n_u_m__s_a_m_p_l_e_s
  254.           Specifies the number of jittered samples.  See SAMPLING
  255.           for  details.   When specified, this value may be over-
  256.           ridden through the use of the -S option.   The  default
  257.           value is 3.
  258.  
  259.  
  260.  
  261. Sun Release 4.0  Last change: September 11, 1989                4
  262.  
  263.  
  264.  
  265.  
  266.  
  267.  
  268. RAYSHADE(1G)              USER COMMANDS              RAYSHADE(1G)
  269.  
  270.  
  271.  
  272.      contrast _r_e_d _g_r_e_e_n _b_l_u_e
  273.           Specifies the maximum contrast allowed between  samples
  274.           in  a  (sub)pixel  before subdivision takes place.  See
  275.           SAMPLING for details.   When  specified  in  the  input
  276.           file, these values may be overridden through the use of
  277.           the -C option.  The defaults for  the  red,  green  and
  278.           blue channels are 0.25, 0.2, and 0.4, respectively.
  279.  
  280. LIGHT SOURCES
  281.      Three types of light sources are supported:  point, extended
  282.      (area),  and  directional.  Point sources are specified by a
  283.      location in world  space  and  produce  shadows  with  sharp
  284.      edges.   Extended  sources are specified by a location and a
  285.      radius.  They produce shadows  with  "fuzzy"  edges  (penum-
  286.      brae),  but  increase ray tracing time considerably.  Direc-
  287.      tional sources are specified by a direction.  A  maximum  of
  288.      10 light sources may be defined.
  289.  
  290.      In the definitions below, _b_r_i_g_h_t_n_e_s_s specifies the intensity
  291.      of  the  light source.  If a single floating-point number is
  292.      given, the light source emits a "white" light of  the  indi-
  293.      cated normalized intensity.  If three floating-point numbers
  294.      are given, they are interpreted as the normalized red, green
  295.      and blue components of the light source's color.
  296.  
  297.      Lights are defined as follows:
  298.  
  299.      light _b_r_i_g_h_t_n_e_s_s point _x _y _z
  300.           Creates a point source located at ( _x, _y, _z ).
  301.  
  302.      light _b_r_i_g_h_t_n_e_s_s extended _x _y _z _r_a_d_i_u_s
  303.           Creates an extended source centered at ( _x, _y, _z ) with
  304.           the   indicated  _r_a_d_i_u_s.   The  images  produced  using
  305.           extended sources are usually superior to those produced
  306.           using  point sources, but ray-tracing time is increased
  307.           substantially.  Rather than tracing one shadow ray to a
  308.           light  source,  multiple  rays  are  traced  to various
  309.           points on the extended source.  The extended source  is
  310.           approximated   by  sampling  a  square  grid  of  light
  311.           sources.  See SAMPLING for more details on the sampling
  312.           of extended light sources.
  313.  
  314.      light _b_r_i_g_h_t_n_e_s_s directional _x _y _z
  315.           Creates a directional light source whose direction vec-
  316.           tor  from  each point in world space is defined as ( _x,
  317.           _y, _z ).  This vector need not be normalized.
  318.  
  319. SURFACES
  320.      Every primitive object has a  surface  associated  with  it.
  321.      The  surface  specifies  the  color, reflectivity, and tran-
  322.      sparency of an object.  A surface may be defined anywhere in
  323.      the  input  file,  provided it is defined before it is used.
  324.  
  325.  
  326.  
  327. Sun Release 4.0  Last change: September 11, 1989                5
  328.  
  329.  
  330.  
  331.  
  332.  
  333.  
  334. RAYSHADE(1G)              USER COMMANDS              RAYSHADE(1G)
  335.  
  336.  
  337.  
  338.      Surfaces are defined once, and may be  associated  with  any
  339.      number  of primitive objects.  A surface definition is given
  340.      by:
  341.  
  342. _i_n_d_e_x [_t_r_a_n_s_l_u _s_t_c_o_e_f]
  343.      surface _s_u_r_f__n_a_m_e _a_r _a_g _a_b _d_r _d_g _d_b _s_r _s_g  _s_b  _c_o_e_f  _r_e_f_l  _t_r_a_n_s_p
  344.  
  345.      _S_u_r_f__n_a_m_e  is  the  name  associated with the surface.  This
  346.      name must be unique for each surface.
  347.  
  348.      _A_r, _a_g and _a_b are used to specify the red, green,  and  blue
  349.      components  of  the  surface's ambient color.  This color is
  350.      always applied to a ray striking the surface.
  351.  
  352.      _D_r, _d_g and _d_b specify the  diffuse  color  of  the  surface.
  353.      This  color,  the  _b_r_i_g_h_t_n_e_s_s component of each light source
  354.      whose light strikes the surface,  and  dot  product  of  the
  355.      incident  ray  and the surface normal at the point of inter-
  356.      section determine the color which is added to the  color  of
  357.      the incident ray.
  358.  
  359.      _S_r, _s_g and _s_b are used to specify the specular color of  the
  360.      surface.  The application of this color is controlled by the
  361.      _c_o_e_f parameter, a floating-point number which indicates  the
  362.      power  to which the dot product of the surface's normal vec-
  363.      tor at the point of intersection  and  the  vector  to  each
  364.      light  source should be raised.  This number is then used to
  365.      scale the specular color of the surface, which is then added
  366.      to  the  color  of the ray striking the surface.  This model
  367.      (Phong lighting) simulates  specular  reflections  of  light
  368.      sources  on  the surface of the object.  The larger _c_o_e_f is,
  369.      the smaller highlights will be.
  370.  
  371.      _R_e_f_l is a floating-point number between 0 and 1 which  indi-
  372.      cates  the  reflectivity  of the object.  If non-zero, a ray
  373.      striking the surface will spawn a reflection ray. The  color
  374.      assigned to that ray will be scaled by _r_e_f_l and added to the
  375.      color of the incident ray.
  376.  
  377.      _T_r_a_n_s_p is a floating-point number  between  0  and  1  which
  378.      indicates  the  transparency  of the object.  If non-zero, a
  379.      ray striking the surface will spawn a ray which is transmit-
  380.      ted  through  the  object.   The  resulting  color  of  this
  381.      transmitted ray is scaled by _t_r_a_n_s_p and added to  the  color
  382.      of  the  incident ray.  The direction of the transmitted ray
  383.      is controlled by the _i_n_d_e_x parameter,  which  indicates  the
  384.      index of refraction of the surface.
  385.  
  386.      The optional parameters _t_r_a_n_s_l_u and _s_t_c_o_e_f may  be  used  to
  387.      give  a  surface  a  translucent appearance.  _T_r_a_n_s_l_u is the
  388.      translucency of the  surface.    If  non-zero  and  a  light
  389.      source  illuminates  the  side  of the surface opposite that
  390.  
  391.  
  392.  
  393. Sun Release 4.0  Last change: September 11, 1989                6
  394.  
  395.  
  396.  
  397.  
  398.  
  399.  
  400. RAYSHADE(1G)              USER COMMANDS              RAYSHADE(1G)
  401.  
  402.  
  403.  
  404.      being rendered, diffuse lighting calculations are  performed
  405.      with  respect  to  the side of the surface facing the light,
  406.      and the result is scaled by _t_r_a_n_s_l_u and added to  the  color
  407.      of  the  incident  ray.   Thus, _t_r_a_n_s_l_u accounts for diffuse
  408.      transmission of light  through  the  primitive.   _S_t_c_o_e_f  is
  409.      similar to _c_o_e_f, but it applies to the specular transmission
  410.      of highlights.  Note that in both cases the index of refrac-
  411.      tion  of  the surface is ignored.  By default, surfaces have
  412.      zero translucency.
  413.  
  414. PRIMITIVES
  415.      The ray tracer is capable of rendering a number of primitive
  416.      objects.   Primitives  may be specified inside of an object-
  417.      definition block, in which case they are added to  the  list
  418.      of  primitives belonging to that object. In addition, primi-
  419.      tives may be defined outside  of  object-definition  blocks.
  420.      Primitives such as these are added to the list of primitives
  421.      belonging to the World object.  See below for more details.
  422.  
  423.      Rayshade usually ensures that a primitive's normal is point-
  424.      ing  towards  the origin of the incident ray when performing
  425.      shading calculations.  Exceptions to  this  rule  are  tran-
  426.      sparent  primitives, for which rayshade uses the dot product
  427.      of the normal and the incident ray to determine if  the  ray
  428.      is entering or exiting the surface, and superquadrics, whose
  429.      normals  are  never  modified  due  to  the  nature  of  the
  430.      ray/superquadric   intersection   code.    Thus,   all  non-
  431.      transparent primitives except superquadrics will  in  effect
  432.      be double-sided.
  433.  
  434.      Primitives are specified by lines of the form:
  435.  
  436.      _p_r_i_m_i_t_i_v_e__t_y_p_e _s_u_r_f_a_c_e <_p_r_i_m_i_t_i_v_e _d_e_f_i_n_i_t_i_o_n>
  437.                           [_t_r_a_n_s_f_o_r_m_a_t_i_o_n_s]   [_t_e_x_t_u_r_e    _m_a_p_p_i_n_g
  438.                           _i_n_f_o_r_m_a_t_i_o_n]
  439.           _S_u_r_f_a_c_e is the name of the  surface  to  be  associated
  440.           with  the  primitive.   Texture mapping and transforma-
  441.           tions are discussed below.  A list of available  primi-
  442.           tives follows.
  443.  
  444.      sphere _s_u_r_f_a_c_e _r_a_d_i_u_s _x_c_e_n_t_e_r _y_c_e_n_t_e_r _z_c_e_n_t_e_r
  445.           Creates a sphere with the indicated _r_a_d_i_u_s centered  at
  446.           ( _x_c_e_n_t_e_r, _y_c_e_n_t_e_r, _z_c_e_n_t_e_r ).
  447.  
  448.      triangle _s_u_r_f_a_c_e _x_1 _y_1 _z_1 _x_2 _y_2 _z_2 _x_3 _y_3 _z_3
  449.           Creates a triangle with vertices ( _x_1, _y_1, _z_1 ), (  _x_2,
  450.           _y_2,  _z_2 ) and ( _x_3, _y_3, _z_3 ).  Vertices should be given
  451.           in a counter-clockwise order as one is looking  at  the
  452.           'top' face of the triangle.
  453.  
  454.      triangle _s_u_r_f_a_c_e _p_1_x _p_1_y _p_1_z _n_1_x _n_1_y _n_1_z  _p_2_x _p_2_y _p_2_z _n_2_x _n_2_y _n_2_z
  455.                           _p_3_x _p_3_y _p_3_z _n_3_x _n_3_y _n_3_z
  456.  
  457.  
  458.  
  459. Sun Release 4.0  Last change: September 11, 1989                7
  460.  
  461.  
  462.  
  463.  
  464.  
  465.  
  466. RAYSHADE(1G)              USER COMMANDS              RAYSHADE(1G)
  467.  
  468.  
  469.  
  470.           Defines a Phong-shaded triangle.  Here, the first three
  471.           floating-point  numbers  specify  the first vertex, the
  472.           second three specify the normal at that vertex, and  so
  473.           on.   Again,  vertices  should be specified in counter-
  474.           clockwise order. Vertex normals need not be normalized.
  475.  
  476.      poly _s_u_r_f_a_c_e _x_1 _y_1 _z_1 _x_2 _y_2 _z_2 _x_3 _y_3 _z_3 [_x_4 _y_4 _z_4 ...]
  477.           Creates a polygon with  the  specified  vertices.   The
  478.           vertices  should  be given in a counter-clockwise order
  479.           as one faces the "top" of the polygon.  The polygon may
  480.           be non-convex, but non-planar polygons will not be ren-
  481.           dered correctly.  The number  of  vertices  defining  a
  482.           polygon is limited only by available memory.
  483.  
  484.      plane _s_u_r_f_a_c_e _x_n_o_r_m_a_l _y_n_o_r_m_a_l _z_n_o_r_m_a_l _x _y _z
  485.           Creates a plane which passes through the point ( _x,  _y,
  486.           _z ) and has normal ( _x_n_o_r_m_a_l, _y_n_o_r_m_a_l, _z_n_o_r_m_a_l ).
  487.  
  488.      cylinder _s_u_r_f_a_c_e _x_b_a_s_e _y_b_a_s_e _z_b_a_s_e _x_t_o_p _y_t_o_p _z_t_o_p _r_a_d_i_u_s
  489.           Creates a cylinder which extends  from  (_x_b_a_s_e,  _y_b_a_s_e,
  490.           _z_b_a_s_e)  to  (_x_t_o_p,  _y_t_o_p,  _z_t_o_p)  and has the indicated
  491.           _r_a_d_i_u_s.
  492.  
  493. _t_o_p__r_a_d_i_u_s
  494.      cone  _s_u_r_f_a_c_e  _x_b_a_s_e  _y_a_s_e  _z_b_a_s_e  _x_t_o_p  _y_t_o_p  _z_t_o_p   _b_a_s_e__r_a_d_i_u_s
  495.           Creates  a  (truncated) cone which extends from (xbase,
  496.           ybase, zbase) to (xtop, ytop, ztop).  The bottom of the
  497.           cone  will  have radius _b_a_s_e__r_a_d_i_u_s, while the top will
  498.           have radius _t_o_p__r_a_d_i_u_s.
  499.  
  500.      heightfield _s_u_r_f_a_c_e _f_i_l_e_n_a_m_e
  501.           Reads height field data from  _f_i_l_e_n_a_m_e  and  creates  a
  502.           square  height  field  of  unit  size centered at (0.5,
  503.           0.5).  The  height  field  is  rendered  as  a  surface
  504.           tessellated  by  right isoscoles triangles.  The binary
  505.           data in the heightfield file is stored  as  an  initial
  506.           32-bit integer giving the square root of number of data
  507.           points in the file,  termed  the  size  of  the  height
  508.           field.   The  size  is  followed by altitude (Z) values
  509.           stored as 32-bit floating point values.  The 0th  value
  510.           in  the  file  specifies the Z coordinate of the lower-
  511.           left corner of the  height  field  (0,  0).   The  next
  512.           specifies  the  Z  coordinate for (1/(size-1), 0).  The
  513.           last specifies the coordinate for (1., 1.).  In  short,
  514.           value  number _i in the heightfield file specifies the Z
  515.           coordinate for the point ( (i % size) / (size -1), (i /
  516.           size)  /  (size -1) ).  Non-square height fields may be
  517.           rendered by specifying altitude  values  less  than  or
  518.           equal  to  -1000.  Triangles which have any vertex less
  519.           than or equal in altitude to this value  are  not  ren-
  520.           dered.    Be   warned  that  the  heightfield  file  is
  521.           machine-dependent, as it is stored in binary format.
  522.  
  523.  
  524.  
  525. Sun Release 4.0  Last change: September 11, 1989                8
  526.  
  527.  
  528.  
  529.  
  530.  
  531.  
  532. RAYSHADE(1G)              USER COMMANDS              RAYSHADE(1G)
  533.  
  534.  
  535.  
  536.      box _s_u_r_f_a_c_e _x_c_e_n_t_e_r _y_c_e_n_t_e_r _z_c_e_n_t_e_r _x_s_i_z_e _y_s_i_z_e _z_s_i_z_e
  537.           Creates a box centered at ( _x_c_e_n_t_e_r, _y_c_e_n_t_e_r, _z_c_e_n_t_e_r )
  538.           of  size  (2 * _x_s_i_z_e, 2 * _y_s_i_z_e, 2 * _z_s_i_z_e ).  Although
  539.           boxes must initially be aligned with  the  world  axes,
  540.           they may be transformed at will.
  541.  
  542.      superq _s_u_r_f_a_c_e _x_c_e_n_t_e_r _y_c_e_n_t_e_r _z_c_e_n_t_e_r _x_s_i_z_e _y_s_i_z_e _z_s_i_z_e _p_o_w_e_r
  543.           Creates  a superquadric with center ( _x_c_e_n_t_e_r, _y_c_e_n_t_e_r,
  544.           _z_c_e_n_t_e_r, ) of total size (2 * _x_s_i_z_e, 2  *  _y_s_i_z_e,  2  *
  545.           _z_s_i_z_e,  ).   _P_o_w_e_r defines how closely the superquadric
  546.           resembles the corresponding box.  The larger the  value
  547.           of  _p_o_w_e_r,  the  closer  it will resemble the box (with
  548.           rounded corners).  A value greater than or equal  to  1
  549.           is  required  for reasonable images.  In addition, nei-
  550.           ther transparent superquadrics nor superquadrics viewed
  551.           from the interior will rendered correctly.
  552.  
  553. OBJECTS
  554.      One key feature of _r_a_y_s_h_a_d_e is its ability to  treat  groups
  555.      of  primitives  as objects which may transformed and instan-
  556.      tiated at will.  Objects are composed of  groups  of  primi-
  557.      tives  and/or  other  objects and are specified in the input
  558.      file as:
  559.  
  560.           define _o_b_j_e_c_t__n_a_m_e
  561.                [grid _x_v_o_x_e_l_s _y_v_o_x_e_l_s _z_v_o_x_e_l_s]
  562.                [list]
  563.                [primitives]
  564.                [instances]
  565.           defend [texturing information]
  566.  
  567.      The ordering of the  various  elements  inside  the  object-
  568.      definition  block is inconsequential.  Here, [_i_n_s_t_a_n_c_e_s] are
  569.      any number of declarations of the form:
  570.  
  571.      object _o_b_j_e_c_t__n_a_m_e [_t_r_a_n_s_f_o_r_m_a_t_i_o_n_s] [_t_e_x_t_u_r_i_n_g _i_n_f_o_r_m_a_t_i_o_n]
  572.           This causes a copy of the  named  object  to  be  made,
  573.           transformed and textured as requested, and added to the
  574.           object being defined.  An object must be defined before
  575.           it  may  be  instantiated, which ensures that no cycles
  576.           appear in the object-definition graph.
  577.  
  578.      A special object named _W_o_r_l_d  is  maintained  internally  by
  579.      _r_a_y_s_h_a_d_e.  Primitive  definitions  and object instantiations
  580.      which do not appear inside an  object-definition  block  are
  581.      added to this object.  When performing ray tracing, rays are
  582.      intersected with the objects that make up the World object.
  583.  
  584.      Internally, objects are stored by  one  of  two  means.   By
  585.      default,  groups  of  primitives which make up an object are
  586.      stored in a _l_i_s_t.  The constituents of such  an  object  are
  587.      stored  in  a simple linked-list.  When a ray is intersected
  588.  
  589.  
  590.  
  591. Sun Release 4.0  Last change: September 11, 1989                9
  592.  
  593.  
  594.  
  595.  
  596.  
  597.  
  598. RAYSHADE(1G)              USER COMMANDS              RAYSHADE(1G)
  599.  
  600.  
  601.  
  602.      with such an object, the ray is tested for intersection with
  603.      each  object  in  the  list.   While the list is the default
  604.      method of object storage, one may emphasize this fact in the
  605.      input  file  by  including the list keyword somewhere within
  606.      the object-definition block.
  607.  
  608.      The second form of internal object  storage  is  the  three-
  609.      dimensional  _g_r_i_d.   The  grid's total size is calculated by
  610.      _r_a_y_s_h_a_d_e and is equal to the bounding box of the object that
  611.      is  engridded.   A  grid  subdivides  the  space in which an
  612.      object lies into an array of uniform box-shaped _v_o_x_e_l_s. Each
  613.      voxel contains a linked-list of objects and primitives which
  614.      lie within that voxel.  When  intersecting  a  ray  with  an
  615.      object  which  is stored in a grid, the ray is traced incre-
  616.      mentally from voxel-to-voxel, and  the  ray  is  tested  for
  617.      intersected  against  each object in the linked list of each
  618.      voxel that is visited.  In this way the  intersection  of  a
  619.      ray with a collection of objects is generally made faster at
  620.      the expense of increased storage requirements.
  621.  
  622.      This form of object representation is enabled  by  including
  623.      the  the grid keyword somewhere within the object-definition
  624.      block:
  625.  
  626.      grid _x_v_o_x_e_l_s _y_v_o_x_e_l_s _z_v_o_x_e_l_s
  627.           Stores the object being defined as a grid consisting of
  628.           a  total  of (xvoxels * yvoxels * zvoxels) voxels, with
  629.           _x_v_o_x_e_l_s along the x-axis of the grid, _y_v_o_x_e_l_s along the
  630.           y-axis,  and  _z_v_o_x_e_l_s along the z-axis.  For reasonably
  631.           complex objects, a value of 20 for each parameter  usu-
  632.           ally works well.
  633.  
  634.      For convenience, one may also define surfaces inside  of  an
  635.      object-definition  block.   Surfaces  defined in this manner
  636.      are nevertheless globally available.
  637.  
  638.      In addition, object definitions may be nested.  This facili-
  639.      tates the definition of objects through the use of recursive
  640.      programs.
  641.  
  642. TRANSFORMATIONS
  643.      _R_a_y_s_h_a_d_e allows for  the  application  of  arbitrary  linear
  644.      transformations  to  primitives  and  compound objects.  The
  645.      specification of transformations occurs immediately  follow-
  646.      ing  the specification of a primitive or instantiation of an
  647.      object.  Any number of transformations may be composed;  the
  648.      resulting  total  transformation  is  applied  to the entity
  649.      being transformed.  Transformations are specified by:
  650.  
  651.      translate _x _y _z
  652.           Translate the object by ( _x, _y, _z).
  653.  
  654.  
  655.  
  656.  
  657. Sun Release 4.0  Last change: September 11, 1989               10
  658.  
  659.  
  660.  
  661.  
  662.  
  663.  
  664. RAYSHADE(1G)              USER COMMANDS              RAYSHADE(1G)
  665.  
  666.  
  667.  
  668.      rotate _x _y _z _t_h_e_t_a
  669.           Rotate the object counter-clockwise about the vector  (
  670.           _x, _y, _z ) by _t_h_e_t_a degrees.
  671.  
  672.      scale _x _y _z
  673.           Scale the object by ( _x, _y _z ).
  674.  
  675.      transform _x_1 _y_1 _z_1 _x_2 _y_2 _z_2 _x_3 _y_3 _z_3
  676.           Transform the object by the column-major matrix  speci-
  677.           fied by the nine floating-point numbers.  Thus, a point
  678.           (x, y, z) on the surface of the  object  is  mapped  to
  679.           (x*x1  + y*y1 + z*z1, x*x2 + y*y2 + z*z2, x*x3 + y*y3 +
  680.           z*z3).
  681.  
  682. TEXTURE MAPPING
  683.      _R_a_y_s_h_a_d_e provides a means of applying solid procedural  tex-
  684.      tures  to  surfaces  of primitives.  This is accomplished by
  685.      supplying texture mapping information immediately  following
  686.      the  definition  of  a  primitive, object, or instance of an
  687.      object.  This allows one to texture  individual  primitives,
  688.      objects,  and individual instances of objects at will.  Tex-
  689.      turing information is supplied via a number of lines of  the
  690.      following form:
  691.  
  692.      texture _t_e_x_t_u_r_e__t_y_p_e [_a_r_g_u_m_e_n_t_s] [_t_r_a_n_s_f_o_r_m_a_t_i_o_n_s]
  693.           _T_e_x_t_u_r_e__t_y_p_e is the  name  of  the  texture  to  apply.
  694.           _A_r_g_u_m_e_n_t_s  are  any arguments that the specific texture
  695.           type requires.  If supplied, the indicated  _t_r_a_n_s_f_o_r_m_a_-
  696.           _t_i_o_n_s  will  be  applied  to  the texture.  (More accu-
  697.           rately, the inverse of the supplied  transformation  is
  698.           applied  to  the  point  of  intersection  before it is
  699.           passed to the texturing routines.)
  700.  
  701.      Versions of Perlin's Noise() and DNoise() functions are used
  702.      to  generate  values  for  most of the interesting textures.
  703.      There are eight available textures:
  704.  
  705.      bump _s_c_a_l_e
  706.           Applies a random bump map to  the  surface  being  tex-
  707.           tured.    The   point  of  intersection  is  passed  to
  708.           DNoise().  The returned normalized vector  is  weighted
  709.           by _s_c_a_l_e and added to the normal vector at the point of
  710.           intersection.
  711.  
  712.      checker _s_u_r_f_a_c_e
  713.           Applies a (3D) checkerboard texture to the object being
  714.           textured.  Every point that falls within an "even" cube
  715.           will be shaded using the characteristics of  the  named
  716.           surface.   Every  point that falls within an "odd" cube
  717.           will retain  its  usual  surface  characteristics.   Be
  718.           warned  that  strange effects due to roundoff error are
  719.           possible when the planar surface of an object lies in a
  720.  
  721.  
  722.  
  723. Sun Release 4.0  Last change: September 11, 1989               11
  724.  
  725.  
  726.  
  727.  
  728.  
  729.  
  730. RAYSHADE(1G)              USER COMMANDS              RAYSHADE(1G)
  731.  
  732.  
  733.  
  734.           plane of constant integral value in texture space.
  735.  
  736.      blotch _b_l_e_n_d__f_a_c_t_o_r _s_u_r_f_a_c_e
  737.           This texture produces  a  mildly  interesting  blotchy-
  738.           looking  surface.   _B_l_e_n_d__f_a_c_t_o_r is used to control the
  739.           interpolation between a point's default surface charac-
  740.           teristics and the characteristics of the named surface.
  741.           A value of 0 results in a roughly 50-50 mix of the  two
  742.           surfaces.  Higher values result in greater instances of
  743.           the 'default' surface type.
  744.  
  745.      fbm _o_f_f_s_e_t _s_c_a_l_e _H _l_a_m_b_d_a _o_c_t_a_v_e_s _t_h_r_e_s_h [_c_o_l_o_r_m_a_p]
  746.           This texture generates a sample  of  discretized  frac-
  747.           tional  Brownian motion (fBm) and uses it to modify the
  748.           diffuse and ambient components of  an  object's  color.
  749.           If  no  _c_o_l_o_r_m_a_p  is named, the sample is used to scale
  750.           the object's diffuse color.   If  a  _c_o_l_o_r_m_a_p  name  is
  751.           given,  a  256-entry  colormap  is  read from the named
  752.           file, and the object is colored  using  the  values  in
  753.           this  colormap (see below).  _S_c_a_l_e is used to scale the
  754.           output of  the  fractional  Brownian  motion  function.
  755.           _O_f_f_s_e_t   allows one to control the minimum value of the
  756.           fBm function.  _H is related to the _H_o_l_d_e_r _c_o_n_s_t_a_n_t used
  757.           in the fBm (a value of 0.5 works well).  _L_a_m_b_d_a is used
  758.           to control the _l_a_c_u_n_a_r_i_t_y, or spacing  between  succes-
  759.           sive  frequencies, in the fBm (a value of 2.0 will suf-
  760.           fice).  _O_c_t_a_v_e_s specifies  the  number  of  octaves  of
  761.           Noise()  to  use  in  simulating  the fBm (5 to 7 works
  762.           well), and _t_h_r_e_s_h is used to specify a lower  bound  on
  763.           the  output  of  fBm  function.   Any  value lower than
  764.           _t_h_r_e_s_h is set to zero.
  765.  
  766.      fbmbump _o_f_f_s_e_t _s_c_a_l_e _H _l_a_m_b_d_a _o_c_t_a_v_e_s
  767.           This texture is similar to  the  fbm  texture.   Rather
  768.           modifying  the  color  of  a surface, fbmbump acts as a
  769.           bump map.
  770.  
  771.      gloss _g_l_o_s_s_i_n_e_s_s
  772.           This texture gives reflective surfaces a glossy appear-
  773.           ance.  A  glossy  object's  surface normal is perturbed
  774.           such that it 'samples'  a  cone  of  unit  height  with
  775.           radius  1. - _g_l_o_s_s_i_n_e_s_s.  Thus, a value of 1 results in
  776.           perfect mirror-like reflections, while  a  value  of  0
  777.           results  in  extremely  fuzzy  reflections.   For  best
  778.           results, jittered sampling should be used when  render-
  779.           ing scenes containing glossy objects.
  780.  
  781.      marble [_c_o_l_o_r_m_a_p]
  782.           This texture gives a surface a marble-like  appearance.
  783.           The  texture  is implemented as roughly parallel alter-
  784.           nating veins of marble, each of which is  separated  by
  785.           1/7 of a unit and runs perpendicular to the Z axis.  If
  786.  
  787.  
  788.  
  789. Sun Release 4.0  Last change: September 11, 1989               12
  790.  
  791.  
  792.  
  793.  
  794.  
  795.  
  796. RAYSHADE(1G)              USER COMMANDS              RAYSHADE(1G)
  797.  
  798.  
  799.  
  800.           the name of a _c_o_l_o_r_m_a_p file is given, the  marble  will
  801.           be colored using the RGB values in the colormap.  If no
  802.           colormap name is given, the diffuse  and  ambient  com-
  803.           ponents of the object's surface are simply scaled.  One
  804.           may transform the texture to control the density of the
  805.           marble veins.
  806.  
  807.      wood
  808.           This texture gives a wood-like appearance to a surface.
  809.           The  feature  size  of  the  texture  is  approximately
  810.           1/100th of a unit, making it often necessary  to  scale
  811.           the texture in order to achieve the desired appearance.
  812.  
  813.      A colormap is an ASCII file 256 lines in length,  each  line
  814.      containing  three space-separated integers ranging from 0 to
  815.      255.  The first number on the nth  line  specifies  the  red
  816.      component  of  the  nth  entry  in  the colormap, the second
  817.      number the green component, and the  third  the  blue.   The
  818.      values  in  the colormap are normalized before being used in
  819.      texturing functions.  Textures which make use  of  colormaps
  820.      generally  compute  an  index  into the colormap and use the
  821.      corresponding entry to scale the ambient  and  diffuse  com-
  822.      ponents of a surface's color.
  823.  
  824.      It is important to note that more than one  texture  may  be
  825.      applied to an object at any time.  In addition to being able
  826.      to apply more than one texture directly (by supplying multi-
  827.      ple  "texturing information" lines for a single object), one
  828.      may instantiate textured objects which, in turn, may be tex-
  829.      tured  or  contain  instances of objects which are textured,
  830.      and so on.
  831.  
  832. ATMOSPHERIC EFFECTS
  833.      _R_a_y_s_h_a_d_e has the capability of including  several  kinds  of
  834.      atmospheric effects when rendering an image.  Currently, two
  835.      such effects are available:
  836.  
  837.      fog _t_h_i_n_n_e_s_s _r_e_d _g_r_e_e_n _b_l_u_e
  838.           Add global exponential fog with the specified  _t_h_i_n_n_e_s_s
  839.           and  color.   Fog is simulated by blending the color of
  840.           the fog with the color of each ray.  The amount of  fog
  841.           color  blended into a ray color is an exponential func-
  842.           tion of the distance from the ray origin to  the  point
  843.           of  intersection  divided by _t_h_i_n_n_e_s_s.  If the distance
  844.           divided by _t_h_i_n_n_e_s_s is equal to 1, a  ray's  new  color
  845.           will  be  half  of the fog color plus half its original
  846.           color.
  847.  
  848.      mist _r_e_d _g_r_e_e_n _b_l_u_e _t_r_a_n_s._r_e_d _t_r_a_n_s._g_r_e_e_n _t_r_a_n_s._b_l_u_e _z_e_r_o _s_c_a_l_e
  849.           Add  global  low-altitude  mist of the specified color.
  850.           The color of a ray is modulated by a fog  with  density
  851.           which  varies  linearly with the difference in altitude
  852.  
  853.  
  854.  
  855. Sun Release 4.0  Last change: September 11, 1989               13
  856.  
  857.  
  858.  
  859.  
  860.  
  861.  
  862. RAYSHADE(1G)              USER COMMANDS              RAYSHADE(1G)
  863.  
  864.  
  865.  
  866.           (Z coordinate) between the ray origin and the point  of
  867.           intersection.   The  three  trans  values  specify  the
  868.           transmissivity (thinness) of the mist for each  of  the
  869.           red, green and blue channels.  The base altitude of the
  870.           mist is given by _z_e_r_o, and the apparent height  of  the
  871.           mist can be controlled by _s_c_a_l_e, which is used to scale
  872.           the difference in altitude.
  873.  
  874. SAMPLING
  875.      This section clarifies  how  antialiasing  and  sampling  of
  876.      extended  light  sources  are  accomplished.   Two  types of
  877.      anti-aliasing are supported;  adaptive subdivision  and  so-
  878.      called "jittered sampling".
  879.  
  880.      Adaptive subdivision works by sampling  each  pixel  at  its
  881.      corners.   The  contrast  between these four samples is com-
  882.      puted, and if too large, the pixel is subdivided  into  four
  883.      equivalent  sub-pixels  and  the  process  is repeated.  The
  884.      threshold contrast may be controlled via the  -C  option  or
  885.      the contrast command.  There are separate thresholds for the
  886.      red, green, and blue channels.  If the contrast  in  any  of
  887.      the  three  is greater than the appropriate threshold value,
  888.      the pixel is subdivided.  The pixel-subdivision  process  is
  889.      repeated until either the samples' contrast is less than the
  890.      threshold or the maximum pixel subdivision level,  specified
  891.      via the -P option or the adaptive command, is reached.  When
  892.      the subdivision process is complete, a weighted  average  of
  893.      the samples is taken as the color of the pixel.
  894.  
  895.      Jittered sampling works by dividing each pixel into a number
  896.      of  square  regions  and tracing a ray through _s_o_m_e point in
  897.      each region.  The exact location in each  region  is  chosen
  898.      randomly.   The number of regions into which a pixel is sub-
  899.      divided is specified through the use of the -S option.   The
  900.      integer  following  this option specifies the square root of
  901.      the number of regions.
  902.  
  903.      Each extended light source is, in effect, approximated by  a
  904.      square  grid  of  light sources.  The length of each side of
  905.      the square is equal to the diameter of the extended  source.
  906.      Each  array  element, which is square in shape, is in turned
  907.      sampled by randomly choosing a point within that element  to
  908.      which  a  ray  is traced from the point of intersection.  If
  909.      the ray does not intersect any primitive  object  before  it
  910.      strikes  a light source element, there is said to be no sha-
  911.      dow cast by that portion of the light source.  The  fraction
  912.      of  the  light  emitted  by  an  extended light source which
  913.      reaches the point of intersection is the number of  elements
  914.      which  are not blocked by intervening objects divided by the
  915.      total number of elements.  The fraction is used to scale the
  916.      intensity  (color)  of  the  light  source,  and this scaled
  917.      intensity is then used in the various lighting calculations.
  918.  
  919.  
  920.  
  921. Sun Release 4.0  Last change: September 11, 1989               14
  922.  
  923.  
  924.  
  925.  
  926.  
  927.  
  928. RAYSHADE(1G)              USER COMMANDS              RAYSHADE(1G)
  929.  
  930.  
  931.  
  932.      When jittered sampling is used, one shadow ray is traced  to
  933.      each  extended  source per shading calculation.  The element
  934.      to be sampled is determined  by  the  region  of  the  pixel
  935.      through which the eye ray at the top of the ray tree passed.
  936.  
  937.      When adaptive supersampling is used, the -S  option  or  the
  938.      samples  command  controls how may shadow rays are traced to
  939.      each extended extended light source per shading calculation.
  940.      Specifically,  each  extended  source  is  approximated by a
  941.      square array consisting of _s_a_m_p_l_e_s * _s_a_m_p_l_e_s elements.  How-
  942.      ever, the corners of the array are skipped to save rendering
  943.      time and to more closely approximate the circular projection
  944.      of  an  extended  light  source.   Because  the  corners are
  945.      skipped,  _s_a_m_p_l_e_s must be at least 3 if  adaptive  supersam-
  946.      pling is being used.
  947.  
  948.      Note that the meaning of the -S option (and the samples com-
  949.      mand)  is  different  depending upon whether or not jittered
  950.      sampling is being used.
  951.  
  952.      While jittered sampling is generally  slower  than  adaptive
  953.      subdivision,  it  can be beneficial if the penumbrae cast by
  954.      extended light sources take up a relatively large percentage
  955.      of  the  entire image or if the image is especially prone to
  956.      aliasing.
  957.  
  958. EXAMPLES
  959.      A very simple _r_a_y_s_h_a_d_e input file might be:
  960.  
  961.      light 1.0 directional 1. 1. 1.
  962.  
  963.      surface red  .2 0 0  .8 0 0  .5 .5 .5  32. 0.8 0. 1.
  964.      surface green  0 .2 0  0 .8 0  0 0 0  0. 0. 0. 1.
  965.  
  966.      sphere red 8.  0. 0. -2.
  967.      plane green 0. 0. 1.  0. 0. -10.
  968.  
  969.  
  970.      Passing this input to _r_a_y_s_h_a_d_e will result in an image of  a
  971.      red  reflective sphere sitting on a white ground-plane being
  972.      written to the standard output.  Note  that  in  this  case,
  973.      default  values  for eyep, lookp, up, screen, fov, and back-
  974.      ground are assumed.
  975.  
  976.      A more interesting example uses instantiation to place  mul-
  977.      tiple  copies  of  an  object  at various locations in world
  978.      space:
  979.  
  980.      eyep 10. 10. 10.
  981.      fov 20
  982.      light 1.0 directional 0. 1. 1.
  983.      surface red  .2 0 0  .8 0 0  .5 .5 .5  32. 0.8 0. 1.
  984.  
  985.  
  986.  
  987. Sun Release 4.0  Last change: September 11, 1989               15
  988.  
  989.  
  990.  
  991.  
  992.  
  993.  
  994. RAYSHADE(1G)              USER COMMANDS              RAYSHADE(1G)
  995.  
  996.  
  997.  
  998.      surface green  0 .2 0  0 .8 0  0 0 0  0. 0. 0. 1.
  999.      surface white 0.1 0.1 0.1 0.8 0.8 0.8 0.6 0.6 0.6 30 0 0 0
  1000.  
  1001.      define blob
  1002.           sphere red 0.5   .5 .5 0.
  1003.           sphere white 0.5 .5 -.5 0. texture marble scale 0.5 0.5 0.5
  1004.           sphere red 0.5  -.5 -.5 0.
  1005.           sphere green 0.5 -.5 .5 0.
  1006.      defend
  1007.  
  1008.      object blob translate 1. 1. 0.
  1009.      object blob translate 1. -1. 0.
  1010.      object blob translate -1. -1. 0.
  1011.      object blob translate -1. 1. 0.
  1012.      grid 20 20 20
  1013.  
  1014.  
  1015.      Here, an object named _b_l_o_b is defined  to  consist  of  four
  1016.      spheres, two of which are red and reflective.  The object is
  1017.      stored as a simple list of  the  four  spheres.   The  _W_o_r_l_d
  1018.      object consists of four instances of this object, translated
  1019.      to place them in a regular pattern about the  origin.   Note
  1020.      that since the marbled sphere was textured in "sphere space"
  1021.      each instance of that particular sphere has exactly the same
  1022.      marble texture applied to it.
  1023.  
  1024.      Of course, just as the object _b_l_o_b was instantiated as  part
  1025.      of  the _W_o_r_l_d object, one may instantiate objects as part of
  1026.      any other object.  For example, a series of objects such as:
  1027.           define wheel
  1028.                sphere tire_color 1.  0 0 0  scale 1. 0.2 1.
  1029.                sphere hub_color 0.2 0 0. 0
  1030.           defend
  1031.  
  1032.           define axle
  1033.                object wheel translate 0. 2. 0.
  1034.                object wheel translate 0. -2. 0.
  1035.                cylinder axle_color 0. -2. 0. 0. 2. 0. 0.1
  1036.           defend
  1037.  
  1038.           define truck
  1039.                box truck_color 0. 0. 0. 5. 2. 2.  /* Trailer */
  1040.                box truck_color 6. 0 -1 2 2 1      /* Cab */
  1041.                object axle translate -4 0 -2
  1042.                object axle translate 4. 0. -2.
  1043.           defend
  1044.  
  1045.      could be used to define a very primitive truck-like object.
  1046.  
  1047. RENDERING HINTS
  1048.      Ray tracing is  a  computationally  intensive  process,  and
  1049.      rendering complex scenes can take hours of CPU time, even on
  1050.  
  1051.  
  1052.  
  1053. Sun Release 4.0  Last change: September 11, 1989               16
  1054.  
  1055.  
  1056.  
  1057.  
  1058.  
  1059.  
  1060. RAYSHADE(1G)              USER COMMANDS              RAYSHADE(1G)
  1061.  
  1062.  
  1063.  
  1064.      relatively powerful machines.  There are, however, a  number
  1065.      of ways of attempting to reduce the running time of the pro-
  1066.      gram.
  1067.  
  1068.      The first and most obvious way is to reduce  the  number  of
  1069.      rays  which are traced.  This is most simply accomplished by
  1070.      reducing the resolution of the image to be rendered.  The -P
  1071.      option  may  be used to reduce the maximum pixel subdivision
  1072.      level.  A maximum level of 0 will speed ray tracing  consid-
  1073.      erably,  but  will  result in obvious aliasing in the image.
  1074.      By default, a pixel will be  subdivided  a  maximum  of  one
  1075.      time, giving a maximum of nine rays per pixel total.
  1076.  
  1077.      Alternatively, the -C option or the contrast command may  be
  1078.      used to decrease the number of instances in which pixels are
  1079.      subdivided.  Using these options, one may indicate the  max-
  1080.      imum  normalized  contrast which is allowed before supersam-
  1081.      pling will occur.   If  the  red,  green  or  blue  contrast
  1082.      between  neighboring  samples  (taken  at  pixel corners) is
  1083.      greater than the maximum allowed, the pixel will  be  subdi-
  1084.      vided  into  four  sub-pixels  and the sampling process will
  1085.      recurse until the sub-pixel contrast is  acceptable  or  the
  1086.      maximum subdivision level is reached.
  1087.  
  1088.      The number of rays traced can also be lowered by making  all
  1089.      surfaces  non-reflecting  and  non-refracting  or by setting
  1090.      maxdepth to a small number.  If set to 0, no  reflection  or
  1091.      refraction  rays will be traced. Lastly, using the -n option
  1092.      will cause no shadow rays to be traced.
  1093.  
  1094.      In addition, judicious use of the grid  command  can  reduce
  1095.      rendering  times  substantially.  However, if an object con-
  1096.      sists of a relatively small number  of  simple  objects,  it
  1097.      will  likely take less time to simply check for intersection
  1098.      with each element of the object than to trace a ray  through
  1099.      a grid.
  1100.  
  1101.      The C pre-processor can be used to  make  the  creation  and
  1102.      managing  of  input files much easier.  For example, one can
  1103.      create "libraries" of useful colors,  objects,  and  viewing
  1104.      parameters by using #define and #include.  To use such input
  1105.      files, run the C pre-processor on the  file,  and  pipe  the
  1106.      resulting text to rayshade.
  1107.  
  1108. FILES
  1109.      Examples/*                    example input files
  1110.  
  1111. AUTHORS
  1112.      _R_a_y_s_h_a_d_e had its beginnings  as  an  "introductory"  public-
  1113.      domain  ray  tracer  written by Roman Kuchkuda.  Vestiges of
  1114.      his code may be found in rayshade, particularly in the names
  1115.      of  variables  and the superquadric code.  The first version
  1116.  
  1117.  
  1118.  
  1119. Sun Release 4.0  Last change: September 11, 1989               17
  1120.  
  1121.  
  1122.  
  1123.  
  1124.  
  1125.  
  1126. RAYSHADE(1G)              USER COMMANDS              RAYSHADE(1G)
  1127.  
  1128.  
  1129.  
  1130.      of _r_a_y_s_h_a_d_e  was  written  at  Princeton  University  during
  1131.      1987-88  by  Craig Kolb, David C. Hoffman, and David P. Dob-
  1132.      kin.  The current manifestation of _r_a_y_s_h_a_d_e was written dur-
  1133.      ing  the  fall  of  1988  by  Craig  Kolb.   The Noise() and
  1134.      DNoise() routines which form the basis of many of  the  tex-
  1135.      turing functions were written by Robert Skinner and Ken Mus-
  1136.      grave.  The depth of field code appears courtesy  of  Rodney
  1137.      G. Bogart.
  1138.  
  1139. CAVEATS
  1140.      _R_a_y_s_h_a_d_e performs no automatic hierarchy construction.   The
  1141.      intelligent  placement  of  objects in grids and/or lists is
  1142.      entirely the job of the modeler.
  1143.  
  1144.      While transparent objects may be wholly contained  in  other
  1145.      transparent  objects, rendering partially intersecting tran-
  1146.      sparent objects with different indices of refraction is, for
  1147.      the most part, nonsensical.
  1148.  
  1149.      _R_a_y_s_h_a_d_e is capable of using large amounts  of  memory.   In
  1150.      the  environment in which it was developed (machines with at
  1151.      least 8 Megabytes of physical memory plus  virtual  memory),
  1152.      this  has  not been a problem, and scenes containing several
  1153.      billion primitives have been rendered.  On smaller machines,
  1154.      however, memory size can be a limiting factor.
  1155.  
  1156.      The "Total memory allocated" statistic is  the  total  space
  1157.      allocated  by  calls  to malloc.  It is _n_o_t the memory high-
  1158.      water mark.  After the input file is  processed,  memory  is
  1159.      only  allocated when refraction occurs (to push media onto a
  1160.      stack) and when ray tracing height  fields  (to  dynamically
  1161.      allocate triangles).
  1162.  
  1163.      The image produced will always be 24 bits deep.
  1164.  
  1165.      Explicit or implicit specification of vectors of length less
  1166.      than _e_p_s_i_l_o_n (1.E-6) results in undefined behavior.
  1167.  
  1168. SEE ALSO
  1169.      rle(5)
  1170.  
  1171.  
  1172.  
  1173.  
  1174.  
  1175.  
  1176.  
  1177.  
  1178.  
  1179.  
  1180.  
  1181.  
  1182.  
  1183.  
  1184.  
  1185. Sun Release 4.0  Last change: September 11, 1989               18
  1186.  
  1187.  
  1188.  
  1189.