OBJ2MESH(1)                                                        OBJ2MESH(1)



NNAAMMEE
       obj2mesh  -  create  a  compiled RADIANCE mesh file from Wavefront .OBJ
       input

SSYYNNOOPPSSIISS
       oobbjj22mmeesshh [ --aa mmaattffiillee ][ --ll mmaattlliibb ][ --nn oobbjjlliimm ][ --rr mmaaxxrreess ][ --ww ]  [
       iinnppuutt..oobbjj [ oouuttppuutt..rrttmm ] ]

DDEESSCCRRIIPPTTIIOONN
       _O_b_j_2_m_e_s_h  reads  a  Wavefront .OBJ file from _i_n_p_u_t_._o_b_j (or the standard
       input) and compiles it into a RADIANCE triangle mesh, which is sent  to
       _o_u_t_p_u_t_._r_t_m  (or  standard  output).  Any RADIANCE material descriptions
       included via one or more _-_a options will be compiled and stored in  the
       mesh as well.  If the _-_l option is used to specify a material file, the
       RADIANCE library locations are searched.  This mesh may be included  in
       a RADIANCE scene description via the _m_e_s_h primitive, thus:

         mod mesh id
         1+ output.rtm [xform args]
         0
         0

       The  syntax and semantics are identical to the RADIANCE _i_n_s_t_a_n_c_e primi-
       tive.  If _m_o_d is "void", then the stored mesh materials will be applied
       during rendering.  Otherwise, the given material will be substituted on
       all the mesh surfaces.

       The _-_n option specifies the maximum surface set size  for  each  voxel.
       Larger  numbers  result  in  quicker  mesh  generation, but potentially
       slower rendering.  Values below 6 are not recommended,  since  this  is
       the  median  valence  for a mesh vertex (the number of adjacent faces),
       and smaller values will result in pointless  octree  subdivision.   The
       default setting is 9.

       The  _-_r option specifies the maximum octree resolution.  This should be
       greater than or equal to the ratio of the  mesh  bounding  box  to  the
       smallest triangle.  The default is 16384.

       The _-_w option suppresses warnings.

       Although  the  mesh  file  format is binary, it is meant to be portable
       between machines.  The only limitation is that machines with  radically
       different integer sizes will not work together.

DDEETTAAIILLSS
       The  following  Wavefront  statements  are  understood  and compiled by
       _o_b_j_2_m_e_s_h_.

       vv _x _y _z   A vertex location, given by its Cartesian  coordinates.   The
                 final  mesh  position may of course be modified by the trans-
                 form arguments given to the _m_e_s_h primitive  in  the  Radiance
                 scene description.

       vvnn _d_x _d_y _d_z
                 A  vertex  normal vector, given by its three direction compo-
                 nents, which will be normalized by _o_b_j_2_m_e_s_h_.  Normals will be
                 interpolated  over  the  mesh  during  rendering to produce a
                 smooth surface.  If no vertex normals are present,  the  mesh
                 will  appear  tesselated.  A zero length normal (i.e., 0 0 0)
                 will generate a syntax error.

       vvtt _u _v    A local vertex texture coordinate.  These coordinates will be
                 interpolated and passed to the "Lu" and "Lv" variables during
                 rendering.  Local coordinates can  extend  over  any  desired
                 range of values.

       uusseemmttll _m_n_a_m_e
                 A  material  name.   The  following  faces will use the named
                 material, which is taken from the material definitions in the
                 _-_a input file(s).

       gg _g_n_a_m_e   Group  association.   The following faces are associated with
                 the named group.  If no "usemtl" statement has  been  encoun-
                 tered,  the  current  group  is used for the surface material
                 identifier.

       ff _v_1_/_t_1_/_n_1 _v_2_/_t_2_/_n_2 _v_3_/_t_3_/_n_3 ....
                 A polygonal face.  Polygon vertices are  specified  as  three
                 indices  separated  by slashes ('/').  The first index is the
                 vertex location, the second index is the local (u,v)  texture
                 coordinate, and the third index is the vertex surface normal.
                 Positive indices count from the beginning of the input, where
                 the  first  vertex position ( _v statement) is numbered 1, and
                 likewise for the first texture coordinate and the first  sur-
                 face  normal.   Negative indices count backward from the cur-
                 rent position in the input,  where  -1  is  the  last  vertex
                 encountered,  -2  is the one before that, etc.  An index of 0
                 may be used for the vertex  texture  or  normal  to  indicate
                 none,  or  these may be left off entirely.  All faces will be
                 broken into triangles in the final mesh.  _O_b_j_2_m_e_s_h  currently
                 makes  an  unsafe assumption that faces are convex, which may
                 result in odd results if they are not.

       All other statement types will be ignored  on  the  input.   Statements
       understood  by  _o_b_j_2_r_a_d_(_1_)  will  be ignored silently; other statements
       will generate a warning message after translation to indicate how  much
       was missed.

DDIIAAGGNNOOSSTTIICCSS
       There are four basic error types reported by obj2mesh:

              warning - a non-fatal input-related error

              fatal - an unrecoverable input-related error

              system - a system-related error

              internal - a fatal error related to program limitations

              consistency - a program-caused error

       Most  errors  are  self-explanatory.   However,  the following internal
       errors should be mentioned:

       Set overflow in addobject (id)
              This error occurs when too many surfaces are close together in a
              scene.  Sometimes a dense mesh can be accommodated by increasing
              the maximum resolution (by powers of two) using the  _-_r  option,
              but usually this error indicates something is wrong.  Either too
              many surfaces are lying right on  top  of  each  other,  or  the
              bounding  cube is inflated from disparate geometry in the input.
              Chances are, the face number "id"  is  near  those  causing  the
              problem.

       Hash table overflow in fullnode
              This  error  is caused by too many surfaces, and there is little
              hope of compiling this mesh.

EEXXAAMMPPLLEESS
       To create a compiled triangle mesh from the scene file  mesh.obj  using
       materials from the file mesh.mat:

         obj2mesh -a mesh.mat mesh.obj mesh.rtm

       To  use  local  coordinates  to  place  a  square tiled image on a mesh
       object:

       void colorpict tiled_pat
       7 red green blue mytile.hdr . frac(Lu) frac(Lv)
       0
       0

       tiled_pat plastic tiled_mat
       0
       0
       5 .9 .9 .9 0 0

       tiled_mat mesh tiled_mesh
       1 mymesh.rtm
       0
       0

EENNVVIIRROONNMMEENNTT
       RAYPATH        the directories to search for material files.

AAUUTTHHOORR
       Greg Ward

SSEEEE AALLSSOO
       gensurf(1),  getinfo(1),  make(1),  obj2rad(1),   oconv(1),   rpict(1),
       rvu(1), rtrace(1), xform(1)



RADIANCE                           03/11/03                        OBJ2MESH(1)
