TMESH2RAD(1)                                                      TMESH2RAD(1)



NNAAMMEE
       tmesh2rad - convert a triangular mesh to a RADIANCE scene description

SSYYNNOOPPSSIISS
       ttmmeesshh22rraadd [ --oo oobbjj ][ --mm mmaatt ][ --pp ppaatt ] [ iinnppuutt ....  ]

DDEESSCCRRIIPPTTIIOONN
       _T_m_e_s_h_2_r_a_d  converts one or more triangle-mesh files to a RADIANCE scene
       description.  The _-_o option may be used  to  assign  a  default  object
       name.  The single letter "T" is used if no name is given on the command
       line or in the file.  The _-_m option may be used  to  assign  a  default
       material name.  The non-material "void" is used as a default if none is
       given on the command line or in the file.  The _-_p option may be used to
       assign  a  default  picture for a surface pattern.  If none is given on
       the command line or in the file, the surface will not have  an  associ-
       ated pattern.

FFIILLEE FFOORRMMAATT
       A  triangle-mesh  is a free-format ASCII file composed of the following
       eight primitive types.  Each primitive is begun with a  single,  white-
       space-delimited letter:

       ## _C_o_m_m_e_n_t Whatever follows up until the end of line is passed as a com-
                 ment to the output.  Note that there must  be  at  least  one
                 space or tab following the pound-sign.

       oo _n_a_m_e    The white-space-delimited string _n_a_m_e is used as a prefix for
                 all following output triangles.

       mm _m_a_t_e_r_i_a_l
                 The white-space-delimited string _m_a_t_e_r_i_a_l is used as the mod-
                 ifier name for all following output triangles.

       pp _p_i_c_t_u_r_e The  white-space-delimited string _p_i_c_t_u_r_e is used as the name
                 of the RADIANCE picture file to be used as a pattern for  all
                 following  output  triangles  with properly defined vertices.
                 (See _i primitive below.)

       vv _i_d _x _y _z
                 Defines the vertex _i_d with 3-dimensional coordinates _x_, _y and
                 _z_.  The identifier, _i_d must be some small, non-negative inte-
                 ger value.  If the same integer is used for  a  later  vertex
                 definition,  this  definition will be lost, though any trian-
                 gles using the vertex prior to its redefinition will be unaf-
                 fected.

       nn _n_x _n_y _n_z
                 Defines a surface normal vector with the 3-dimensional compo-
                 nents _n_x_, _n_y and _n_z_.  This vector will be associated with the
                 most recently defined vertex, and is often placed on the same
                 line as the vertex definition for clarity.  The  vector  need
                 not be normalized.

       ii _u _v     Defines a picture index for the most recently defined vertex.
                 The _u value will be used to lookup the horizontal pixel coor-
                 dinate in the currently defined picture.  The _v value will be
                 used to lookup the vertical pixel coordinate.  (See the RADI-
                 ANCE  reference manual for details on picture coordinate val-
                 ues.)  As with associated surface  normals,  picture  indices
                 are  interpolated  using barycentric coordinates based on the
                 triangle vertices.  If these coordinates are calculated  cor-
                 rectly,  this  should result in a smooth mapping of a pattern
                 onto the surface mesh.

       tt _i_d_1 _i_d_2 _i_d_3
                 Create a triangle connecting the three vertices identified by
                 _i_d_1_,  _i_d_2  and _i_d_3_.  The right-hand rule is used to determine
                 the default surface normal orientation, and this  should  not
                 be  too far from the associated vertex normals (if any).  All
                 three vertices must have an associated normal if the triangle
                 is  to  be  smoothed.   If  a picture file is defined and all
                 three vertices have pattern  indices  associated  with  them,
                 then  this  picture  will  be used as a pattern to modify the
                 triangle's color.

       We realize there are many similar T-mesh file formats in existence, and
       that  it  would  have been just as easy to support one of these formats
       directly.  The disadvantage to supporting an existing  format  is  that
       conversion  from  other formats might prove difficult.  It was our hope
       to provide a "greatest common multiple" format that would  support  all
       similar  T-mesh formats, rather than supporting WaveFront's .obj format
       (for example) and being unable to associate a pattern with  an  object.
       Converting from other formats should be relatively straightforward.  In
       many cases, an _a_w_k_(_1_)_, _r_c_a_l_c_(_1_) or even a _s_e_d_(_1_) script should be  suf-
       ficient.

EEXXAAMMPPLLEE
       Here is an example T-mesh file:

              # Our object name:
              o test_object
              # Our material:
              m puce
              # Our vertices:
              v 1  10   15   5
              v 2  10   -15  5
              v 3  0    -15  0
              v 4  -10  15   -5
              # Two triangles joined together:
              t 1 2 3
              t 2 3 4

       Which generates the following output:

              ## T-mesh read from: <stdin>

              # Our material:

              # Our vertices:

              # Two triangles joined together:

              puce polygon test_object.1
              0
              0
              9
                              10                 15                  5
                              10                -15                  5
                               0                -15                  0

              puce polygon test_object.2
              0
              0
              9
                              10                -15                  5
                               0                -15                  0
                             -10                 15                 -5


       Here is another example:

              # A partial cylinder:
              m BluePlastic
              v 1 -14.673 -3.119    50 n -0.95677 -0.203374 1.17936e-10
              v 2 -12.136 -8.817   -50 n -0.791363 -0.574922 4.84915e-10
              v 3 -12.136 -8.817    50 n -0.791363 -0.574922 4.84915e-10
              t 1 2 3
              m OrangePlastic
              v 1 -7.501 -12.991    50 n -0.549094 -0.812427 -1.45812e-09
              v 2 -12.136 -8.817    50 n -0.791363 -0.574922 4.84915e-10
              v 3 -12.136 -8.817   -50 n -0.791363 -0.574922 4.84915e-10
              t 1 2 3
              m BluePlastic
              v 1 -1.568 -14.918    50 n -0.171094 -0.965568 -5.69788e-09
              v 2 -7.501 -12.991    50 n -0.549094 -0.812427 -1.45812e-09
              v 3 -7.501 -12.991   -50 n -0.429001 -0.881759 -3.6502e-09
              t 1 2 3

       Note  that  the same three vertices were used repeatedly, and intermin-
       gled with the triangle definitions.

AAUUTTHHOORR
       Greg Ward

BBUUGGSS
       Triangle smoothing doesn't work very well for glass or  trans  material
       types  in Radiance, since textures cause distorted transmission through
       these materials.  It is best to use the  dielectric  material  type  if
       smooth transmission is desired.

SSEEEE AALLSSOO
       arch2rad(1),   awk(1),   ies2rad(1),  thf2rad(1),  oconv(1),  rcalc(1),
       sed(1), xform(1)



RADIANCE                            3/18/96                       TMESH2RAD(1)
