home *** CD-ROM | disk | FTP | other *** search
/ Encyclopedia of Graphics File Formats Companion / GFF_CD.ISO / formats / waveobj / spec / obj_spec.txt < prev    next >
Encoding:
Text File  |  1994-06-01  |  93.2 KB  |  3,046 lines

  1. B1. Object Files (.obj)
  2.  
  3. Object files define the geometry and other properties for objects in
  4. Wavefront's Advanced Visualizer. Object files can also be used to
  5. transfer geometric data back and forth between the Advanced Visualizer
  6. and other applications.
  7.  
  8. Object files can be in ASCII format (.obj) or binary format (.mod).
  9. This appendix describes the ASCII format for object files. These files
  10. must have the extension .obj.
  11.  
  12. In this release, the .obj file format supports both polygonal objects
  13. and free-form objects. Polygonal geometry uses points, lines, and faces
  14. to define objects while free-form geometry uses curves and surfaces.
  15.  
  16. About this section
  17.  
  18. The .obj appendix is for those who want to use the .obj format to
  19. translate geometric data from other software applications to Wavefront
  20. products. It also provides information for Advanced Visualizer users
  21. who want detailed information on the Wavefront .obj file format.
  22.  
  23. If you are a 2.11 user and want to understand the significance of the
  24. 3.0 release and how it affects your existing files, you may be
  25. especially interested in the section called "Superseded statements" at
  26. the end of the appendix. The section, "Patches and free-form surfaces,"
  27. gives examples of how 2.11 patches look in 3.0.
  28.  
  29. How this section is organized
  30.  
  31. Most of this appendix describes the different parts of an .obj file and
  32. how those parts are arranged in the file. The three sections at the end
  33. of the appendix provide background information on the 3.0 release of
  34. the .obj format.
  35.  
  36. The .obj appendix includes the following sections:
  37.  
  38. o       File structure
  39.  
  40. o       General statement
  41.  
  42. o       Vertex data
  43.  
  44. o       Specifying free-form curves/surfaces
  45.  
  46. o       Free-form curve/surface attributes
  47.  
  48. o       Elements
  49.  
  50. o       Free-form curve/surface body statements
  51.  
  52. o       Connectivity between free-form surfaces
  53.  
  54. o       Grouping
  55.  
  56. o       Display/render attributes
  57.  
  58. o       Comments
  59.  
  60. o       Mathematics for free-form curves/surfaces
  61.  
  62. o       Superseded statements
  63.  
  64. o       Patches and free-form surfaces
  65.  
  66. ---------------
  67.  
  68.     The curve and surface extensions to the .obj file format were
  69.     developed in conjunction with mental images GmbH&Co.KG, Berlin,
  70.     Germany, as part of a joint development project to incorporate
  71.     free-form surfaces into Wavefront's Advanced Visualizer.
  72.  
  73. File structure
  74.  
  75. The following types of data may be included in an .obj file. In this
  76. list, the keyword (in parentheses) follows the data type.
  77.  
  78. Vertex data
  79.  
  80. o       geometric vertices (v)
  81.  
  82. o       texture vertices (vt)
  83.  
  84. o       vertex normals (vn)
  85.  
  86. o       parameter space vertices (vp)
  87.     Free-form curve/surface attributes
  88.  
  89. o       rational or non-rational forms of curve or surface type:
  90.     basis matrix, Bezier, B-spline, Cardinal, Taylor (cstype)
  91.  
  92. o       degree (deg)
  93.  
  94. o       basis matrix (bmat)
  95.  
  96. o       step size (step)
  97.  
  98. Elements
  99.  
  100. o       point (p)
  101.  
  102. o       line (l)
  103.  
  104. o       face (f)
  105.  
  106. o       curve (curv)
  107.  
  108. o       2D curve (curv2)
  109.  
  110. o       surface (surf)
  111.  
  112. Free-form curve/surface body statements
  113.  
  114. o       parameter values (parm)
  115.  
  116. o       outer trimming loop (trim)
  117.  
  118. o       inner trimming loop (hole)
  119.  
  120. o       special curve (scrv)
  121.  
  122. o       special point (sp)
  123.  
  124. o       end statement (end)
  125.  
  126. Connectivity between free-form surfaces
  127.  
  128.  
  129. o       connect (con)
  130.  
  131. Grouping
  132.  
  133. o       group name (g)
  134.  
  135. o       smoothing group (s)
  136.  
  137. o       merging group (mg)
  138.  
  139. o       object name (o)
  140.  
  141. Display/render attributes
  142.  
  143. o       bevel interpolation (bevel)
  144.  
  145. o       color interpolation (c_interp)
  146.  
  147. o       dissolve interpolation (d_interp)
  148.  
  149. o       level of detail (lod)
  150.  
  151. o       material name (usemtl)
  152.  
  153. o       material library (mtllib)
  154.  
  155. o       shadow casting (shadow_obj)
  156.  
  157. o       ray tracing (trace_obj)
  158.  
  159. o       curve approximation technique (ctech)
  160.  
  161. o       surface approximation technique (stech)
  162.  
  163.  
  164. The following diagram shows how these parts fit together in a typical
  165. .obj file.
  166.  
  167. |--------------------------------------|
  168. |            grouping                  |                    
  169. |    display/render attributes         |
  170. |                                      |
  171. |--------------------------------------|                                       |
  172. |           vertex data                |
  173. |                                      |
  174. |--------------------------------------|                                       |
  175. |       free-form attributes           |
  176. |                                      |
  177. |--------------------------------------|                                       |
  178. |           elements                   |
  179. |       body statements                |
  180. |                                      |
  181. |--------------------------------------|                                       |
  182. |     grouping/attribute data          | 
  183. |                                      | 
  184. |--------------------------------------|                                       |
  185. |            element data . . .        |
  186. |                                      |
  187. |                                      |
  188. |                .                     |
  189. |                .                     |
  190. |                .                     |
  191. |                                      |
  192. |                                      |
  193. |--------------------------------------|
  194.  
  195. Figure  B1-1.   Typical .obj file structure
  196.  
  197.  
  198. General statement
  199.  
  200. call  filename.ext arg1 arg2 . . .
  201.  
  202.     Reads the contents of the specified .obj or .mod file at this
  203.     location.  The call statement can be inserted into .obj files using
  204.     a text editor.
  205.  
  206.     filename.ext is the name of the .obj or .mod file to be read. You
  207.     must include the extension with the filename.
  208.  
  209.     arg1  arg2 . . .  specifies a series of optional integer arguments
  210.     that are passed to the called file. There is no limit to the number
  211.     of nested calls that can be made.
  212.  
  213.     Arguments passed to the called file are substituted in the same way
  214.     as in UNIX scripts; for example, $1 in the called file is replaced
  215.     by arg1,  $2 in the called file is replaced by arg2, and so on.
  216.  
  217.     If the frame number is needed in the called file for variable
  218.     substitution, "$1" must be used as the first argument in the call
  219.     statement. For example:
  220.  
  221.     call filename.obj $1
  222.  
  223.     Then the statement in the called file,
  224.  
  225.     scmp filename.pv $1
  226.  
  227.     will work as expected. For more information on the scmp statement,
  228.     see appendix C, Variable Substitution for more information.
  229.  
  230.     Another method to do the same thing is:
  231.  
  232.     scmp filename.pv $1
  233.  
  234.     call filename.obj
  235.  
  236.     Using this method, the scmp statement provides the .pv file for all
  237.     subsequently called .obj or .mod files.
  238.  
  239. csh command
  240.  
  241. csh -command
  242.  
  243.     Executes the requested UNIX command. If the UNIX command returns an
  244.     error, the parser flags an error during parsing.
  245.  
  246.     If a dash (-) precedes the UNIX command, the error is ignored.
  247.  
  248.     command is the UNIX command.
  249.  
  250. Vertex data
  251.  
  252. Vertex data provides coordinates for:
  253.  
  254. o        geometric vertices
  255.  
  256. o        texture vertices
  257.  
  258. o        vertex normals
  259.  
  260. For free-form objects, the vertex data also provides:
  261.  
  262. o        parameter space vertices
  263.  
  264. The vertex data is represented by four vertex lists; one for each type
  265. of vertex coordinate. A right-hand coordinate system is used to specify
  266. the coordinate locations.
  267.  
  268. The following sample is a portion of an .obj file that contains the
  269. four types of vertex information.
  270.  
  271.     v      -5.000000       5.000000       0.000000
  272.     v      -5.000000      -5.000000       0.000000
  273.     v       5.000000      -5.000000       0.000000
  274.     v       5.000000       5.000000       0.000000
  275.     vt     -5.000000       5.000000       0.000000
  276.     vt     -5.000000      -5.000000       0.000000
  277.     vt      5.000000      -5.000000       0.000000
  278.     vt      5.000000       5.000000       0.000000
  279.     vn      0.000000       0.000000       1.000000
  280.     vn      0.000000       0.000000       1.000000
  281.     vn      0.000000       0.000000       1.000000
  282.     vn      0.000000       0.000000       1.000000
  283.     vp      0.210000       3.590000
  284.     vp      0.000000       0.000000
  285.     vp      1.000000       0.000000
  286.     vp      0.500000       0.500000
  287.  
  288.  
  289.  
  290. When vertices are loaded into the Advanced Visualizer, they are
  291. sequentially numbered, starting with 1. These reference numbers are
  292. used in element statements.
  293.  
  294. Syntax
  295.  
  296. The following syntax statements are listed in order of complexity.
  297.  
  298. v x y z w
  299.  
  300.     Polygonal and free-form geometry statement.
  301.  
  302.     Specifies a geometric vertex and its x y z coordinates. Rational
  303.     curves and surfaces require a fourth homogeneous coordinate, also
  304.     called the weight.
  305.  
  306.     x y z are the x, y, and z coordinates for the vertex. These are
  307.     floating point numbers that define the position of the vertex in
  308.     three dimensions.
  309.  
  310.     w is the weight required for rational curves and surfaces. It is
  311.     not required for non-rational curves and surfaces. If you do not
  312.     specify a value for w, the default is 1.0.
  313.  
  314.     NOTE: A positive weight value is recommended. Using zero or
  315.     negative values may result in an undefined point in a curve or
  316.     surface.
  317.  
  318. vp u v w
  319.  
  320.     Free-form geometry statement.
  321.  
  322.     Specifies a point in the parameter space of a curve or surface.
  323.  
  324.     The usage determines how many coordinates are required. Special
  325.     points for curves require a 1D control point (u only) in the
  326.     parameter space of the curve. Special points for surfaces require a
  327.     2D point (u and v) in the parameter space of the surface. Control
  328.     points for non-rational trimming curves require u and v
  329.     coordinates. Control points for rational trimming curves require u,
  330.     v, and w (weight) coordinates.
  331.  
  332.     u is the point in the parameter space of a curve or the first
  333.     coordinate in the parameter space of a surface.
  334.  
  335.     v is the second coordinate in the parameter space of a surface.
  336.  
  337.     w is the weight required for rational trimming curves. If you do
  338.     not specify a value for w, it defaults to 1.0.
  339.  
  340.     NOTE: For additional information on parameter vertices, see the
  341.     curv2 and sp statements
  342.  
  343. vn i j k
  344.  
  345.     Polygonal and free-form geometry statement.
  346.  
  347.     Specifies a normal vector with components i, j, and k.
  348.  
  349.     Vertex normals affect the smooth-shading and rendering of geometry.
  350.     For polygons, vertex normals are used in place of the actual facet
  351.     normals.  For surfaces, vertex normals are interpolated over the
  352.     entire surface and replace the actual analytic surface normal.
  353.  
  354.     When vertex normals are present, they supersede smoothing groups.
  355.  
  356.     i j k are the i, j, and k coordinates for the vertex normal. They
  357.     are floating point numbers.
  358.  
  359. vt u v w
  360.  
  361.     Vertex statement for both polygonal and free-form geometry.
  362.  
  363.     Specifies a texture vertex and its coordinates. A 1D texture
  364.     requires only u texture coordinates, a 2D texture requires both u
  365.     and v texture coordinates, and a 3D texture requires all three
  366.     coordinates.
  367.  
  368.     u is the value for the horizontal direction of the texture.
  369.  
  370.     v is an optional argument.
  371.  
  372.     v is the value for the vertical direction of the texture. The
  373.     default is 0.
  374.  
  375.     w is an optional argument.
  376.  
  377.     w is a value for the depth of the texture. The default is 0.
  378.  
  379. Specifying free-form curves/surfaces
  380.  
  381. There are three steps involved in specifying a free-form curve or
  382. surface element.
  383.  
  384. o       Specify the type of curve or surface (basis matrix, Bezier,
  385.     B-spline, Cardinal, or Taylor) using free-form curve/surface
  386.     attributes.
  387.  
  388. o       Describe the curve or surface with element statements.
  389.  
  390. o       Supply additional information, using free-form curve/surface
  391.     body statements
  392.  
  393. The next three sections of this appendix provide detailed information
  394. on each of these steps.
  395.  
  396. Data requirements for curves and surfaces
  397.  
  398. All curves and surfaces require a certain set of data. This consists of
  399. the following:
  400.  
  401. Free-form curve/surface attributes
  402.  
  403. o       All curves and surfaces require type data, which is given with
  404.     the cstype statement.
  405.  
  406. o       All curves and surfaces require degree data, which is given
  407.     with the deg statement.
  408.  
  409. o       Basis matrix curves or surfaces require a bmat statement.
  410.  
  411. o       Basis matrix curves or surfaces also require a step size, which
  412.     is given with the step statement.
  413.  
  414. Elements
  415.  
  416. o       All curves and surfaces require control points, which are
  417.     referenced in the curv, curv2, or surf statements.
  418.  
  419. o       3D curves and surfaces require a parameter range, which is
  420.     given in the curv and surf statements, respectively.
  421.  
  422. Free-form curve/surface body statements
  423.  
  424. o       All curves and surfaces require a set of global parameters or a
  425.     knot vector, both of which are given with the parm statement.
  426.  
  427. o       All curves and surfaces body statements require an explicit end
  428.     statement.
  429.  
  430. Error checks
  431.  
  432. The above set of data starts out empty with no default values when
  433. reading of an .obj file begins. While the file is being read,
  434. statements are encountered, information is accumulated, and some errors
  435. may be reported.
  436.  
  437. When the end statement is encountered, the following error checks,
  438. which involve consistency between various statements, are performed:
  439.  
  440. o       All required information is present.
  441.  
  442. o       The number of control points, number of parameter values
  443.     (knots), and degree are consistent with the curve or surface
  444.     type. If the type is bmatrix, the step size is also consistent.
  445.     (For more information, refer to the parameter vector equations
  446.     in the section, "Mathematics of free-form curves/ surfaces" at
  447.     the end of appendix B1.)
  448.  
  449. o       If the type is bmatrix and the degree is n, the size of the
  450.     basis matrix is (n + 1) x (n + 1).
  451.  
  452. Note that any information given by the state-setting statements remains
  453. in effect from one curve or surface to the next. Information given
  454. within a curve or surface body is only effective for the curve or
  455. surface it is given with.
  456.  
  457.  
  458.  
  459. Free-form curve/surface attributes
  460.  
  461. Five types of free-form geometry are available in the .obj file
  462. format:
  463.  
  464. o       Bezier
  465.  
  466. o       basis matrix
  467.  
  468. o       B-spline
  469.  
  470. o       Cardinal
  471.  
  472. o       Taylor
  473.  
  474. You can apply these types only to curves and surfaces. Each of these
  475. five types can be rational or non-rational.
  476.  
  477. In addition to specifying the type, you must define the degree for the
  478. curve or surface. For basis matrix curve and surface elements, you must
  479. also specify the basis matrix and step size.
  480.  
  481. All free-form curve and surface attribute statements are state-setting.
  482. This means that once an attribute statement is set, it applies to all
  483. elements that follow until it is reset to a different value.
  484.  
  485. Syntax
  486.  
  487. The following syntax statements are listed in order of use.
  488.  
  489. cstype rat type
  490.  
  491.     Free-form geometry statement.
  492.  
  493.     Specifies the type of curve or surface and indicates a rational or
  494.     non-rational form.
  495.  
  496.     rat is an optional argument.
  497.  
  498.     rat specifies a rational form for the curve or surface type. If rat
  499.     is not included, the curve or surface is non-rational
  500.  
  501.     type specifies the curve or surface type. Allowed types are:
  502.  
  503.     bmatrix        basis matrix
  504.  
  505.     bezier        Bezier
  506.  
  507.     bspline        B-spline
  508.  
  509.     cardinal        Cardinal
  510.  
  511.     taylor        Taylor
  512.  
  513.     There is no default. A value must be supplied.
  514.  
  515. deg degu degv
  516.  
  517.     Free-form geometry statement.
  518.  
  519.     Sets the polynomial degree for curves and surfaces.
  520.  
  521.     degu is the degree in the u direction. It is required for both
  522.     curves and surfaces.
  523.  
  524.     degv is the degree in the v direction. It is required only for
  525.     surfaces. For Bezier, B-spline, Taylor, and basis matrix, there is
  526.     no default; a value must be supplied. For Cardinal, the degree is
  527.     always 3. If some other value is given for Cardinal, it will be
  528.     ignored.
  529.  
  530. bmat u matrix
  531.  
  532. bmat v matrix
  533.  
  534.     Free-form geometry statement.
  535.  
  536.     Sets the basis matrices used for basis matrix curves and surfaces.
  537.     The u and v values must be specified in separate bmat statements.
  538.  
  539.     NOTE: The deg statement must be given before the bmat statements
  540.     and the size of the matrix must be appropriate for the degree.
  541.  
  542.     u specifies that the basis matrix is applied in the u direction.
  543.  
  544.     v specifies that the basis matrix is applied in the v direction.
  545.  
  546.     matrix lists the contents of the basis matrix with column subscript
  547.     j varying the fastest. If n is the degree in the given u or v
  548.     direction, the matrix (i,j) should be of size (n + 1) x (n + 1).
  549.  
  550.     There is no default. A value must be supplied.
  551.  
  552.     NOTE: The arrangement of the matrix is different from that commonly
  553.     found in other references. For more information, see the examples
  554.     at the end of this section and also the section, "Mathematics for
  555.     free-form curves and surfaces."
  556.  
  557. step stepu stepv
  558.  
  559.     Free-form geometry statement.
  560.  
  561.     Sets the step size for curves and surfaces that use a basis
  562.     matrix.
  563.  
  564.     stepu is the step size in the u direction. It is required for both
  565.     curves and surfaces that use a basis matrix.
  566.  
  567.     stepv is the step size in the v direction. It is required only for
  568.     surfaces that use a basis matrix. There is no default. A value must
  569.     be supplied.
  570.  
  571.     When a curve or surface is being evaluated and a transition from
  572.     one segment or patch to the next occurs, the set of control points
  573.     used is incremented by the step size. The appropriate step size
  574.     depends on the representation type, which is expressed through the
  575.     basis matrix, and on the degree.
  576.  
  577.     That is, suppose we are given a curve with k control points:
  578.             {v , ... v }
  579.               1       k
  580.  
  581.     If the curve is of degree n, then n + 1 control points are needed
  582.     for each polynomial segment. If the step size is given as s, then
  583.     the ith polynomial segment, where i = 0 is the first segment, will
  584.     use the control points:
  585.             {v    ,...,v      }
  586.               is+1      is+n+1
  587.  
  588.     For example, for Bezier curves, s = n .
  589.  
  590.     For surfaces, the above description applies independently to each
  591.     parametric direction.
  592.  
  593.     When you create a file which uses the basis matrix type, be sure to
  594.     specify a step size appropriate for the current curve or surface
  595.     representation.
  596.  
  597. Examples
  598.  
  599. 1.      Cubic Bezier surface made with a basis matrix
  600.  
  601.     To create a cubic Bezier surface:
  602.  
  603.     cstype bmatrix
  604.     deg 3 3
  605.     step 3 3
  606.     bmat u  1       -3      3       -1      \
  607.         0       3       -6      3       \
  608.         0       0       3       -3      \
  609.         0       0       0       1
  610.     bmat v  1       -3      3       -1      \
  611.         0       3       -6      3       \
  612.         0       0       3       -3      \
  613.         0       0       0       1
  614.  
  615. 2.      Hermite curve made with a basis matrix
  616.  
  617.     To create a Hermite curve:
  618.  
  619.     cstype bmatrix
  620.     deg 3
  621.     step 2
  622.     bmat u  1     0     -3      2      0       0       3      -2 \
  623.         0     1     -2      1      0       0      -1       1
  624.  
  625. 3.      Bezier in u direction with B-spline in v direction;
  626.     made with a basis matrix
  627.  
  628.     To create a surface with a cubic Bezier in the u direction and
  629.     cubic uniform B-spline in the v direction:
  630.  
  631.     cstype bmatrix
  632.     deg 3 3
  633.     step 3 1
  634.     bmat u  1      -3       3      -1 \
  635.         0       3      -6       3 \
  636.         0       0       3      -3 \
  637.         0       0       0       1
  638.     bmat v  0.16666 -0.50000  0.50000 -0.16666 \
  639.         0.66666  0.00000 -1.00000  0.50000 \
  640.         0.16666  0.50000  0.50000 -0.50000 \
  641.         0.00000  0.00000  0.00000  0.16666
  642.  
  643.  
  644.  
  645. Elements
  646.  
  647. For polygonal geometry, the element types available in the .obj file
  648. are:
  649.  
  650. o       points
  651.  
  652. o       lines
  653.  
  654. o       faces
  655.  
  656. For free-form geometry, the element types available in the .obj file
  657. are:
  658.  
  659. o       curve
  660.  
  661. o       2D curve on a surface
  662.  
  663. o       surface
  664.  
  665. All elements can be freely intermixed in the file.
  666.  
  667. Referencing vertex data
  668.  
  669. For all elements, reference numbers are used to identify geometric
  670. vertices, texture vertices, vertex normals, and parameter space
  671. vertices.
  672.  
  673. Each of these types of vertices is numbered separately, starting with
  674. 1. This means that the first geometric vertex in the file is 1, the
  675. second is 2, and so on. The first texture vertex in the file is 1, the
  676. second is 2, and so on. The numbering continues sequentially throughout
  677. the entire file. Frequently, files have multiple lists of vertex data.
  678. This numbering sequence continues even when vertex data is separated by
  679. other data.
  680.  
  681. In addition to counting vertices down from the top of the first list in
  682. the file, you can also count vertices back up the list from an
  683. element's position in the file. When you count up the list from an
  684. element, the reference numbers are negative. A reference number of -1
  685. indicates the vertex immediately above the element. A reference number
  686. of -2 indicates two references above and so on.
  687.  
  688. Referencing groups of vertices
  689.  
  690. Some elements, such as faces and surfaces, may have a triplet of
  691. numbers that reference vertex data.These numbers are the reference
  692. numbers for a geometric vertex, a texture vertex, and a vertex normal.
  693.  
  694. Each triplet of numbers specifies a geometric vertex, texture vertex,
  695. and vertex normal. The reference numbers must be in order and must
  696. separated by slashes (/).
  697.  
  698. o       The first reference number is the geometric vertex.
  699.  
  700. o       The second reference number is the texture vertex. It follows
  701.     the first slash.
  702.  
  703. o       The third reference number is the vertex normal. It follows the
  704.     second slash.
  705.  
  706. There is no space between numbers and the slashes. There may be more
  707. than one series of geometric vertex/texture vertex/vertex normal
  708. numbers on a line.
  709.  
  710. The following is a portion of a sample file for a four-sided face
  711. element:
  712.  
  713.     f 1/1/1 2/2/2 3/3/3 4/4/4
  714.  
  715. Using v, vt, and vn to represent geometric vertices, texture vertices,
  716. and vertex normals, the statement would read:
  717.  
  718.     f v/vt/vn v/vt/vn v/vt/vn v/vt/vn
  719.  
  720. If there are only vertices and vertex normals for a face element (no
  721. texture vertices), you would enter two slashes (//). For example, to
  722. specify only the vertex and vertex normal reference numbers, you would
  723. enter:
  724.  
  725.     f 1//1 2//2 3//3 4//4
  726.  
  727. When you are using a series of triplets, you must be consistent in the
  728. way you reference the vertex data. For example, it is illegal to give
  729. vertex normals for some vertices, but not all.
  730.  
  731. The following is an example of an illegal statement.
  732.  
  733.     f 1/1/1 2/2/2 3//3 4//4
  734.  
  735. Syntax
  736.  
  737. The following syntax statements are listed in order of complexity of
  738. geometry.
  739.  
  740. p  v1 v2 v3 . . .
  741.  
  742.     Polygonal geometry statement.
  743.  
  744.     Specifies a point element and its vertex. You can specify multiple
  745.     points with this statement. Although points cannot be shaded or
  746.     rendered, they are used by other Advanced Visualizer programs.
  747.  
  748.     v is the vertex reference number for a point element. Each point
  749.     element requires one vertex. Positive values indicate absolute
  750.     vertex numbers. Negative values indicate relative vertex numbers.
  751.  
  752. l  v1/vt1   v2/vt2   v3/vt3 . . .
  753.  
  754.     Polygonal geometry statement.
  755.  
  756.     Specifies a line and its vertex reference numbers. You can
  757.     optionally include the texture vertex reference numbers. Although
  758.     lines cannot be shaded or rendered, they are used by other Advanced
  759.     Visualizer programs.
  760.  
  761.     The reference numbers for the vertices and texture vertices must be
  762.     separated by a slash (/). There is no space between the number and
  763.     the slash.
  764.  
  765.     v is a reference number for a vertex on the line. A minimum of two
  766.     vertex numbers are required. There is no limit on the maximum.
  767.     Positive values indicate absolute vertex numbers. Negative values
  768.     indicate relative vertex numbers.
  769.  
  770.     vt is an optional argument.
  771.  
  772.     vt is the reference number for a texture vertex in the line
  773.     element. It must always follow the first slash.
  774.  
  775. f  v1/vt1/vn1   v2/vt2/vn2   v3/vt3/vn3 . . .
  776.  
  777.     Polygonal geometry statement.
  778.  
  779.     Specifies a face element and its vertex reference number. You can
  780.     optionally include the texture vertex and vertex normal reference
  781.     numbers.
  782.  
  783.     The reference numbers for the vertices, texture vertices, and
  784.     vertex normals must be separated by slashes (/). There is no space
  785.     between the number and the slash.
  786.  
  787.     v is the reference number for a vertex in the face element. A
  788.     minimum of three vertices are required.
  789.  
  790.     vt is an optional argument.
  791.  
  792.     vt is the reference number for a texture vertex in the face
  793.     element. It always follows the first slash.
  794.  
  795.     vn is an optional argument.
  796.  
  797.     vn is the reference number for a vertex normal in the face element.
  798.     It must always follow the second slash.
  799.  
  800.     Face elements use surface normals to indicate their orientation. If
  801.     vertices are ordered counterclockwise around the face, both the
  802.     face and the normal will point toward the viewer. If the vertex
  803.     ordering is clockwise, both will point away from the viewer. If
  804.     vertex normals are assigned, they should point in the general
  805.     direction of the surface normal, otherwise unpredictable results
  806.     may occur.
  807.  
  808.     If a face has a texture map assigned to it and no texture vertices
  809.     are assigned in the f statement, the texture map is ignored when
  810.     the element is rendered.
  811.  
  812.     NOTE: Any references to fo (face outline) are no longer valid as of
  813.     version 2.11. You can use f (face) to get the same results.
  814.     References to fo in existing .obj files will still be read,
  815.     however, they will be written out as f when the file is saved.
  816.  
  817. curv u0 u1 v1 v2 . . .
  818.  
  819.     Element statement for free-form geometry.
  820.  
  821.     Specifies a curve, its parameter range, and its control vertices.
  822.     Although curves cannot be shaded or rendered, they are used by
  823.     other Advanced Visualizer programs.
  824.  
  825.     u0 is the starting parameter value for the curve. This is a
  826.     floating point number.
  827.  
  828.     u1 is the ending parameter value for the curve. This is a floating
  829.     point number.
  830.  
  831.     v is the vertex reference number for a control point. You can
  832.     specify multiple control points. A minimum of two control points
  833.     are required for a curve.
  834.  
  835.     For a non-rational curve, the control points must be 3D. For a
  836.     rational curve, the control points are 3D or 4D. The fourth
  837.     coordinate (weight) defaults to 1.0 if omitted.
  838.  
  839. curv2  vp1  vp2   vp3. . .
  840.  
  841.     Free-form geometry statement.
  842.  
  843.     Specifies a 2D curve on a surface and its control points. A 2D
  844.     curve is used as an outer or inner trimming curve, as a special
  845.     curve, or for connectivity.
  846.  
  847.     vp is the parameter vertex reference number for the control point.
  848.     You can specify multiple control points. A minimum of two control
  849.     points is required for a 2D curve.
  850.  
  851.     The control points are parameter vertices because the curve must
  852.     lie in the parameter space of some surface. For a non-rational
  853.     curve, the control vertices can be 2D. For a rational curve, the
  854.     control vertices can be 2D or 3D. The third coordinate (weight)
  855.     defaults to 1.0 if omitted.
  856.  
  857. surf  s0  s1  t0  t1  v1/vt1/vn1   v2/vt2/vn2 . . .
  858.  
  859.     Element statement for free-form geometry.
  860.  
  861.     Specifies a surface, its parameter range, and its control vertices.
  862.     The surface is evaluated within the global parameter range from s0
  863.     to s1 in the u direction and t0 to t1 in the v direction.
  864.  
  865.     s0 is the starting parameter value for the surface in the u
  866.     direction.
  867.  
  868.     s1 is the ending parameter value for the surface in the u
  869.     direction.
  870.  
  871.     t0 is the starting parameter value for the surface in the v
  872.     direction.
  873.  
  874.     t1 is the ending parameter value for the surface in the v
  875.     direction.
  876.  
  877.     v is the reference number for a control vertex in the surface.
  878.  
  879.     vt is an optional argument.
  880.  
  881.     vt is the reference number for a texture vertex in the surface.  It
  882.     must always follow the first slash.
  883.  
  884.     vn is an optional argument.
  885.  
  886.     vn is the reference number for a vertex normal in the surface.  It
  887.     must always follow the second slash.
  888.  
  889.     For a non-rational surface, the control vertices are 3D.  For a
  890.     rational surface the control vertices can be 3D or 4D.  The fourth
  891.     coordinate (weight) defaults to 1.0 if ommitted.
  892.  
  893.     NOTE: For more information on the ordering of control points for
  894.     survaces, refer to the section on surfaces and control points in
  895.     "mathematics of free-form curves/surfaces" at the end of this
  896.     appendix.
  897.  
  898.  
  899.  
  900.  
  901. Examples
  902.  
  903. These are examples for polygonal geometry.
  904.  
  905. For examples using free-form geometry, see the examples at the end of
  906. the next section, "Free-form curve/surface body statements."
  907.  
  908. 1.    Square
  909.  
  910. This example shows a square that measures two units on each side and
  911. faces in the positive direction (toward the camera).  Note that the
  912. ordering of the vertices is counterclockwise. This ordering determines
  913. that the square is facing forward.
  914.  
  915.     v 0.000000 2.000000 0.000000
  916.     v 0.000000 0.000000 0.000000
  917.     v 2.000000 0.000000 0.000000
  918.     v 2.000000 2.000000 0.000000
  919.     f 1 2 3 4
  920.  
  921. 2.      Cube
  922.  
  923. This is a cube that measures two units on each side. Each vertex is
  924. shared by three different faces.
  925.  
  926.     v 0.000000 2.000000 2.000000
  927.     v 0.000000 0.000000 2.000000
  928.     v 2.000000 0.000000 2.000000
  929.     v 2.000000 2.000000 2.000000
  930.     v 0.000000 2.000000 0.000000
  931.     v 0.000000 0.000000 0.000000
  932.     v 2.000000 0.000000 0.000000
  933.     v 2.000000 2.000000 0.000000
  934.     f 1 2 3 4
  935.     f 8 7 6 5
  936.     f 4 3 7 8
  937.     f 5 1 4 8
  938.     f 5 6 2 1
  939.     f 2 6 7 3
  940.  
  941. 3.      Cube with negative reference numbers
  942.  
  943. This is a cube with negative vertex reference numbers. Each element
  944. references the vertices stored immediately above it in the file. Note
  945. that vertices are not shared.
  946.  
  947. v 0.000000 2.000000 2.000000
  948. v 0.000000 0.000000 2.000000
  949. v 2.000000 0.000000 2.000000
  950. v 2.000000 2.000000 2.000000
  951. f -4 -3 -2 -1
  952.  
  953. v 2.000000 2.000000 0.000000
  954. v 2.000000 0.000000 0.000000
  955. v 0.000000 0.000000 0.000000
  956. v 0.000000 2.000000 0.000000
  957. f -4 -3 -2 -1
  958.  
  959. v 2.000000 2.000000 2.000000
  960. v 2.000000 0.000000 2.000000
  961. v 2.000000 0.000000 0.000000
  962. v 2.000000 2.000000 0.000000
  963. f -4 -3 -2 -1
  964.  
  965. v 0.000000 2.000000 0.000000
  966. v 0.000000 2.000000 2.000000
  967. v 2.000000 2.000000 2.000000
  968. v 2.000000 2.000000 0.000000
  969. f -4 -3 -2 -1
  970.  
  971. v 0.000000 2.000000 0.000000
  972. v 0.000000 0.000000 0.000000
  973. v 0.000000 0.000000 2.000000
  974. v 0.000000 2.000000 2.000000
  975. f -4 -3 -2 -1
  976.  
  977. v 0.000000 0.000000 2.000000
  978. v 0.000000 0.000000 0.000000
  979. v 2.000000 0.000000 0.000000
  980. v 2.000000 0.000000 2.000000
  981. f -4 -3 -2 -1
  982.  
  983.  
  984.  
  985. Free-form curve/surface body statements
  986.  
  987. You can specify additional information for free-form curve and surface
  988. elements using a series of statements called body statements. The
  989. series is concluded by an end statement.
  990.  
  991. Body statements are valid only when they appear between the free-form
  992. element statement (curv, curv2, surf) and the end statement. If they
  993. are anywhere else in the .obj file, they do not have any effect.
  994.  
  995. You can use body statements to specify the following values:
  996.  
  997. o       parameter
  998.  
  999. o       knot vector
  1000.  
  1001. o       trimming loop
  1002.  
  1003. o       hole
  1004.  
  1005. o       special curve
  1006.  
  1007. o       special point
  1008.  
  1009. You cannot use any other statements between the free-form curve or
  1010. surface statement and the end statement. Using any other of type of
  1011. statement may cause unpredictable results.
  1012.  
  1013. This portion of a sample file shows the knot vector values for a
  1014. rational B-spline surface with a trimming loop. Notice the end
  1015. statement to conclude the body statements.
  1016.  
  1017.     cstype rat bspline
  1018.     deg 2 2
  1019.     surf -1.0 2.5 -2.0 2.0 -9 -8 -7 -6 -5 -4 -3 -2 -1
  1020.     parm u -1.00 -1.00 -1.00 2.50 2.50 2.50
  1021.     parm v -2.00 -2.00 -2.00 -2.00 -2.00 -2.00
  1022.     trim 0.0 2.0 1
  1023.     end
  1024.  
  1025. Parameter values and knot vectors
  1026.  
  1027. All curve and surface elements require a set of parameter values.
  1028.  
  1029. For polynomial curves and surfaces, this specifies global parameter
  1030. values. For B-spline curves and surfaces, this specifies the knot
  1031. vectors.
  1032.  
  1033. For surfaces, the parameter values must be specified for both the u and
  1034. v directions. For curves, the parameter values must be specified for
  1035. only the u direction.
  1036.  
  1037. If multiple parameter value statements for the same parametric
  1038. direction are used inside a single curve or surface body, the last
  1039. statement is used.
  1040.  
  1041. Trimming loops and holes
  1042.  
  1043. The trimming loop statement builds a single outer trimming loop as a
  1044. sequence of curves which lie on a given surface.
  1045.  
  1046. The hole statement builds a single inner trimming loop as a sequence of
  1047. curves which lie on a given surface. The inner loop creates a hole.
  1048.  
  1049. The curves are referenced by number in the same way vertices are
  1050. referenced by face elements.
  1051.  
  1052. The individual curves must lie end-to-end to form a closed loop which
  1053. does not intersect itself and which lies within the parameter range
  1054. specified for the surface. The loop as a whole may be oriented in
  1055. either direction (clockwise or counterclockwise).
  1056.  
  1057. To cut one or more holes in a region, use a trim statement followed by
  1058. one or more hole statements. To introduce another trimmed region in the
  1059. same surface, use another trim statement followed by one or more hole
  1060. statements. The ordering that associates holes and the regions they cut
  1061. is important and must be maintained.
  1062.  
  1063. If the first trim statement in the sequence is omitted, the enclosing
  1064. outer trimming loop is taken to be the parameter range of the surface.
  1065. If no trim or hole statements are specified, then the surface is
  1066. trimmed at its parameter range.
  1067.  
  1068. This portion of a sample file shows a non-rational Bezier surface with
  1069. two regions, each with a single hole:
  1070.  
  1071.     cstype bezier
  1072.     deg 1 1
  1073.     surf 0.0 2.0 0.0 2.0 1 2 3 4
  1074.     parm u 0.00 2.00
  1075.     parm v 0.00 2.00
  1076.     trim 0.0 4.0 1
  1077.     hole 0.0 4.0 2
  1078.     trim 0.0 4.0 3
  1079.     hole 0.0 4.0 4
  1080.     end
  1081.  
  1082. Special curve
  1083.  
  1084. A special curve statement builds a single special curve as a sequence
  1085. of curves which lie on a given surface.
  1086.  
  1087. The curves are referenced by number in the same way vertices are
  1088. referenced by face elements.
  1089.  
  1090. A special curve is guaranteed to be included in any triangulation of
  1091. the surface. This means that the line formed by approximating the
  1092. special curve with a sequence of straight line segments will actually
  1093. appear as a sequence of triangle edges in the final triangulation.
  1094.  
  1095. Special point
  1096.  
  1097. A special point statement specifies that special geometric points are
  1098. to be associated with a curve or surface. For space curves and trimming
  1099. curves, the parameter vertices must be 1D. For surfaces, the parameter
  1100. vertices must be 2D.
  1101.  
  1102. These special points will be included in any linear approximation of
  1103. the curve or surface.
  1104.  
  1105. For space curves, this means that the point corresponding to the given
  1106. curve parameter is included as one of the vertices in an approximation
  1107. consisting of a sequence of line segments.
  1108.  
  1109. For surfaces, this means that the point corresponding to the given
  1110. surface parameters is included as a triangle vertex in the
  1111. triangulation.
  1112.  
  1113. For trimming curves, the treatment is slightly different: a special
  1114. point on a trimming curve is essentially the same as a special point on
  1115. the surface it trims.
  1116.  
  1117. The following portion of a sample files shows special points for a
  1118. rational Bezier 2D curve on a surface.
  1119.  
  1120.     vp -0.675  1.850  3.000
  1121.     vp  0.915  1.930
  1122.     vp  2.485  0.470  2.000
  1123.     vp  2.485 -1.030
  1124.     vp  1.605 -1.890 10.700
  1125.     vp -0.745 -0.654  0.500
  1126.     cstype rat bezier
  1127.     curv2 -6 -5 -4 -3 -2 -1 -6
  1128.     parm u 0.00 1.00 2.00
  1129.     sp 2 3
  1130.     end
  1131.  
  1132. Syntax
  1133.  
  1134. The following syntax statement are listed in order of normal use.
  1135.  
  1136. parm u p1 p2 p3. . .
  1137.  
  1138. parm v p1 p2 p3 . . .
  1139.  
  1140.     Body statement for free-form geometry.
  1141.  
  1142.     Specifies global parameter values. For B-spline curves and
  1143.     surfaces, this specifies the knot vectors.
  1144.  
  1145.     u is the u direction for the parameter values.
  1146.  
  1147.     v is the v direction for the parameter values.
  1148.  
  1149.     To set u and v values, use separate command lines.
  1150.  
  1151.     p is the global parameter or knot value. You can specify multiple
  1152.     values. A minimum of two parameter values are required. Parameter
  1153.     values must increase monotonically. The type of surface and the
  1154.     degree dictate the number of values required.
  1155.  
  1156. trim  u0  u1  curv2d  u0  u1  curv2d . . .
  1157.  
  1158.     Body statement for free-form geometry.
  1159.  
  1160.     Specifies a sequence of curves to build a single outer trimming
  1161.     loop.
  1162.  
  1163.     u0 is the starting parameter value for the trimming curve curv2d.
  1164.  
  1165.     u1 is the ending parameter value for the trimming curve curv2d.
  1166.  
  1167.     curv2d is the index of the trimming curve lying in the parameter
  1168.     space of the surface. This curve must have been previously defined
  1169.     with the curv2 statement.
  1170.  
  1171. hole  u0  u1  curv2d  u0  u1  curv2d . . .
  1172.  
  1173.     Body statement for free-form geometry.
  1174.  
  1175.     Specifies a sequence of curves to build a single inner trimming
  1176.     loop (hole).
  1177.  
  1178.     u0 is the starting parameter value for the trimming curve curv2d.
  1179.  
  1180.     u1 is the ending parameter value for the trimming curve curv2d.
  1181.  
  1182.     curv2d is the index of the trimming curve lying in the parameter
  1183.     space of the surface. This curve must have been previously defined
  1184.     with the curv2 statement.
  1185.  
  1186. scrv u0 u1 curv2d u0 u1 curv2d . . .
  1187.  
  1188.     Body statement for free-form geometry.
  1189.  
  1190.     Specifies a sequence of curves which lie on the given surface to
  1191.     build a single special curve.
  1192.  
  1193.     u0 is the starting parameter value for the special curve curv2d.
  1194.  
  1195.     u1 is the ending parameter value for the special curve curv2d.
  1196.  
  1197.     curv2d is the index of the special curve lying in the parameter
  1198.     space of the surface. This curve must have been previously defined
  1199.     with the curv2 statement.
  1200.  
  1201. sp vp1  vp. . .
  1202.  
  1203.     Body statement for free-form geometry.
  1204.  
  1205.     Specifies special geometric points to be associated with a curve or
  1206.     surface. For space curves and trimming curves, the parameter
  1207.     vertices must be 1D. For surfaces, the parameter vertices must be
  1208.     2D.
  1209.  
  1210.     vp is the reference number for the parameter vertex of a special
  1211.     point to be associated with the parameter space point of the curve
  1212.     or surface.
  1213.  
  1214. end
  1215.  
  1216.     Body statement for free-form geometry.
  1217.  
  1218.     Specifies the end of a curve or surface body begun by a curv,
  1219.     curv2, or surf statement.
  1220.  
  1221. Examples
  1222.  
  1223. 1.      Taylor curve
  1224.  
  1225.     For creating a single-segment Taylor polynomial curve of the form:
  1226.  
  1227.                                    2         3         4
  1228.     x =  3.00 +  2.30t +  7.98t  +  8.30t  +  6.34t 
  1229.  
  1230.                                    2         3         4
  1231.     y =  1.00 - 10.10t +  5.40t  -  4.70t  +  2.03t 
  1232.  
  1233.                                    2         3         4
  1234.     z = -2.50 +  0.50t -  7.00t  + 18.10t  +  0.08t 
  1235.  
  1236.  
  1237. and evaluated between the global parameters 0.5 and 1.6:
  1238.  
  1239.     v       3.000    1.000   -2.500
  1240.     v       2.300  -10.100    0.500
  1241.     v       7.980    5.400   -7.000
  1242.     v       8.300   -4.700   18.100
  1243.     v       6.340    2.030    0.080
  1244.     cstype taylor
  1245.     deg 4
  1246.     curv 0.500 1.600 1 2 3 4 5
  1247.     parm u 0.000 2.000
  1248.     end
  1249.  
  1250. 2.      Bezier curve
  1251.  
  1252. This example shows a non-rational Bezier curve with 13 control points.
  1253.  
  1254.     v -2.300000 1.950000 0.000000
  1255.     v -2.200000 0.790000 0.000000
  1256.     v -2.340000 -1.510000 0.000000
  1257.     v -1.530000 -1.490000 0.000000
  1258.     v -0.720000 -1.470000 0.000000
  1259.     v -0.780000 0.230000 0.000000
  1260.     v 0.070000 0.250000 0.000000
  1261.     v 0.920000 0.270000 0.000000
  1262.     v 0.800000 -1.610000 0.000000
  1263.     v 1.620000 -1.590000 0.000000
  1264.     v 2.440000 -1.570000 0.000000
  1265.     v 2.690000 0.670000 0.000000
  1266.     v 2.900000 1.980000 0.000000
  1267.     # 13 vertices
  1268.  
  1269.     cstype bezier
  1270.     ctech cparm 1.000000
  1271.     deg 3
  1272.     curv 0.000000 4.000000 1 2 3 4 5 6 7 8 9 10 \
  1273.     11 12 13
  1274.     parm u 0.000000 1.000000 2.000000 3.000000  \
  1275.     4.000000
  1276.     end
  1277.     # 1 element
  1278.  
  1279.  
  1280.  
  1281. 3.      B-spline surface
  1282.  
  1283. This is an example of a cubic B-spline surface.
  1284.  
  1285.     g bspatch
  1286.     v -5.000000 -5.000000 -7.808327
  1287.     v -5.000000 -1.666667 -7.808327
  1288.     v -5.000000 1.666667 -7.808327
  1289.     v -5.000000 5.000000 -7.808327
  1290.     v -1.666667 -5.000000 -7.808327
  1291.     v -1.666667 -1.666667 11.977780
  1292.     v -1.666667 1.666667 11.977780
  1293.     v -1.666667 5.000000 -7.808327
  1294.     v 1.666667 -5.000000 -7.808327
  1295.     v 1.666667 -1.666667 11.977780
  1296.     v 1.666667 1.666667 11.977780
  1297.     v 1.666667 5.000000 -7.808327
  1298.     v 5.000000 -5.000000 -7.808327
  1299.     v 5.000000 -1.666667 -7.808327
  1300.     v 5.000000 1.666667 -7.808327
  1301.     v 5.000000 5.000000 -7.808327
  1302.     # 16 vertices
  1303.  
  1304.     cstype bspline
  1305.     stech curv 0.5 10.000000
  1306.     deg 3 3
  1307.     8surf 0.000000 1.000000 0.000000 1.000000 13 14 \ 15 16 9 10 11 12 5 6
  1308.     7 8 1 2 3 4
  1309.     parm u -3.000000 -2.000000 -1.000000 0.000000  \
  1310.     1.000000 2.000000 3.000000 4.000000
  1311.     parm v -3.000000 -2.000000 -1.000000 0.000000  \
  1312.     1.000000 2.000000 3.000000 4.000000
  1313.     end
  1314.     # 1 element
  1315.  
  1316.  
  1317. 4.      Cardinal surface
  1318.  
  1319. This example shows a Cardinal surface.
  1320.  
  1321.     v -5.000000 -5.000000 0.000000
  1322.     v -5.000000 -1.666667 0.000000
  1323.     v -5.000000 1.666667 0.000000
  1324.     v -5.000000 5.000000 0.000000
  1325.     v -1.666667 -5.000000 0.000000
  1326.     v -1.666667 -1.666667 0.000000
  1327.     v -1.666667 1.666667 0.000000
  1328.     v -1.666667 5.000000 0.000000
  1329.     v 1.666667 -5.000000 0.000000
  1330.     v 1.666667 -1.666667 0.000000
  1331.     v 1.666667 1.666667 0.000000
  1332.     v 1.666667 5.000000 0.000000
  1333.     v 5.000000 -5.000000 0.000000
  1334.     v 5.000000 -1.666667 0.000000
  1335.     v 5.000000 1.666667 0.000000
  1336.     v 5.000000 5.000000 0.000000
  1337.     # 16 vertices
  1338.  
  1339.     cstype cardinal
  1340.     stech cparma 1.000000 1.000000
  1341.     deg 3 3
  1342.     surf 0.000000 1.000000 0.000000 1.000000 13 14 \
  1343.     15 16 9 10 11 12 5 6 7 8 1 2 3 4
  1344.     parm u 0.000000 1.000000
  1345.     parm v 0.000000 1.000000
  1346.     end
  1347.     # 1 element
  1348.  
  1349.  
  1350. 5.      Rational B-spline surface
  1351.  
  1352. This example creates a second-degree, rational B-spline surface using
  1353. open, uniform knot vectors. A texture map is applied to the surface.
  1354.  
  1355.     v -1.3 -1.0  0.0
  1356.     v  0.1 -1.0  0.4  7.6
  1357.     v  1.4 -1.0  0.0  2.3
  1358.     v -1.4  0.0  0.2
  1359.     v  0.1  0.0  0.9  0.5
  1360.     v  1.3  0.0  0.4  1.5
  1361.     v -1.4  1.0  0.0  2.3
  1362.     v  0.1  1.0  0.3  6.1
  1363.     v  1.1  1.0  0.0  3.3
  1364.     vt 0.0  0.0
  1365.     vt 0.5  0.0
  1366.     vt 1.0  0.0
  1367.     vt 0.0  0.5
  1368.     vt 0.5  0.5
  1369.     vt 1.0  0.5
  1370.     vt 0.0  1.0
  1371.     vt 0.5  1.0
  1372.     vt 1.0  1.0
  1373.     cstype rat bspline
  1374.     deg 2 2
  1375.     surf 0.0 1.0 0.0 1.0 1/1 2/2 3/3 4/4 5/5 6/6 \
  1376.     7/7 8/8 9/9
  1377.     parm u 0.0 0.0 0.0 1.0 1.0 1.0
  1378.     parm v 0.0 0.0 0.0 1.0 1.0 1.0
  1379.     end
  1380.  
  1381.  
  1382. 6.      Trimmed NURB surface
  1383.  
  1384. This is a complete example of a file containing a trimmed NURB surface
  1385. with negative reference numbers for vertices.
  1386.  
  1387.     # trimming curve
  1388.     vp -0.675  1.850  3.000
  1389.     vp  0.915  1.930
  1390.     vp  2.485  0.470  2.000
  1391.     vp  2.485 -1.030
  1392.     vp  1.605 -1.890 10.700
  1393.     vp -0.745 -0.654  0.500
  1394.     cstype rat bezier
  1395.     deg 3
  1396.     curv2 -6 -5 -4 -3 -2 -1 -6
  1397.     parm u 0.00 1.00 2.00
  1398.     end
  1399.     # surface
  1400.     v -1.350 -1.030 0.000
  1401.     v  0.130 -1.030 0.432 7.600
  1402.     v  1.480 -1.030 0.000 2.300
  1403.     v -1.460  0.060 0.201
  1404.     v  0.120  0.060 0.915 0.500
  1405.     v  1.380  0.060 0.454 1.500
  1406.     v -1.480  1.030 0.000 2.300
  1407.     v  0.120  1.030 0.394 6.100
  1408.     v  1.170  1.030 0.000 3.300
  1409.     cstype rat bspline
  1410.     deg 2 2
  1411.     surf -1.0 2.5 -2.0 2.0 -9 -8 -7 -6 -5 -4 -3 -2 -1
  1412.     parm u -1.00 -1.00 -1.00 2.50 2.50 2.50
  1413.     parm v -2.00 -2.00 -2.00 -2.00 -2.00 -2.00
  1414.     trim 0.0 2.0 1
  1415.     end
  1416.  
  1417.  
  1418. 7.      Two trimming regions with a hole
  1419.  
  1420. This example shows a Bezier surface with two trimming regions, each
  1421. with a hole in them.
  1422.  
  1423.     # outer loop of first region
  1424.     deg 1
  1425.     cstype bezier
  1426.     vp 0.100 0.100
  1427.     vp 0.900 0.100
  1428.     vp 0.900 0.900
  1429.     vp 0.100 0.900
  1430.     curv2 1 2 3 4 1
  1431.     parm u 0.00 1.00 2.00 3.00 4.00
  1432.     end
  1433.     # hole in first region
  1434.     vp 0.300 0.300
  1435.     vp 0.700 0.300
  1436.     vp 0.700 0.700
  1437.     vp 0.300 0.700
  1438.     curv2 5 6 7 8 5
  1439.     parm u 0.00 1.00 2.00 3.00 4.00
  1440.     end
  1441.     # outer loop of second region
  1442.     vp 1.100 1.100
  1443.     vp 1.900 1.100
  1444.     vp 1.900 1.900
  1445.     vp 1.100 1.900
  1446.     curv2 9 10 11 12 9
  1447.     parm u 0.00 1.00 2.00 3.00 4.00
  1448.     end
  1449.     # hole in second region
  1450.     vp 1.300 1.300
  1451.     vp 1.700 1.300
  1452.     vp 1.700 1.700
  1453.     vp 1.300 1.700
  1454.     curv2 13 14 15 16 13
  1455.     parm u 0.00 1.00 2.00 3.00 4.00
  1456.     end
  1457.     # surface
  1458.     v 0.000 0.000 0.000
  1459.     v 1.000 0.000 0.000
  1460.     v 0.000 1.000 0.000
  1461.     v 1.000 1.000 0.000
  1462.     deg 1 1
  1463.     cstype bezier
  1464.     surf 0.0 2.0 0.0 2.0 1 2 3 4
  1465.     parm u 0.00 2.00
  1466.     parm v 0.00 2.00
  1467.     trim 0.0 4.0 1
  1468.     hole 0.0 4.0 2
  1469.     trim 0.0 4.0 3
  1470.     hole 0.0 4.0 4
  1471.     end
  1472.  
  1473.  
  1474. 8.      Trimming with a special curve
  1475. This example is similar to the trimmed NURB surface example (6), except
  1476. there is a special curve on the surface. This example uses negative
  1477. vertex numbers.
  1478.  
  1479.     # trimming curve
  1480.     vp -0.675  1.850  3.000
  1481.     vp  0.915  1.930
  1482.     vp  2.485  0.470  2.000
  1483.     vp  2.485 -1.030
  1484.     vp  1.605 -1.890 10.700
  1485.     vp -0.745 -0.654  0.500
  1486.     cstype rat bezier
  1487.     deg 3
  1488.     curv2 -6 -5 -4 -3 -2 -1 -6
  1489.     parm u 0.00 1.00 2.00
  1490.     end
  1491.     # special curve
  1492.     vp -0.185  0.322
  1493.     vp  0.214  0.818
  1494.     vp  1.652  0.207
  1495.     vp  1.652 -0.455
  1496.     curv2 -4 -3 -2 -1
  1497.     parm u 2.00 10.00
  1498.     end
  1499.     # surface
  1500.     v -1.350 -1.030 0.000
  1501.     v  0.130 -1.030 0.432 7.600
  1502.     v  1.480 -1.030 0.000 2.300
  1503.     v -1.460  0.060 0.201
  1504.     v  0.120  0.060 0.915 0.500
  1505.     v  1.380  0.060 0.454 1.500
  1506.     v -1.480  1.030 0.000 2.300
  1507.     v  0.120  1.030 0.394 6.100
  1508.     v  1.170  1.030 0.000 3.300
  1509.     cstype rat bspline
  1510.     deg 2 2
  1511.     surf -1.0 2.5 -2.0 2.0 -9 -8 -7 -6 -5 -4 -3 -2 -1
  1512.     parm u -1.00 -1.00 -1.00 2.50 2.50 2.50
  1513.     parm v -2.00 -2.00 -2.00 2.00 2.00 2.00
  1514.     trim 0.0 2.0 1
  1515.     scrv 4.2 9.7 2
  1516.     end
  1517.  
  1518.  
  1519. 9.      Trimming with special points
  1520.  
  1521. This example extends the trimmed NURB surface example (6) to include
  1522. special points on both the trimming curve and surface. A space curve
  1523. with a special point is also included. This example uses negative
  1524. vertex numbers.
  1525.  
  1526.     # special point and space curve data
  1527.     vp 0.500
  1528.     vp 0.700
  1529.     vp 1.100
  1530.     vp 0.200 0.950
  1531.     v  0.300 1.500 0.100
  1532.     v  0.000  0.000  0.000
  1533.     v  1.000  1.000  0.000
  1534.     v  2.000  1.000  0.000
  1535.     v  3.000  0.000  0.000
  1536.     cstype bezier
  1537.     deg 3
  1538.     curv 0.2 0.9 -4 -3 -2 -1
  1539.     sp 1
  1540.     parm u 0.00 1.00
  1541.     end
  1542.     # trimming curve
  1543.     vp -0.675  1.850  3.000
  1544.     vp  0.915  1.930
  1545.     vp  2.485  0.470  2.000
  1546.     vp  2.485 -1.030
  1547.     vp  1.605 -1.890 10.700
  1548.     vp -0.745 -0.654  0.500
  1549.     cstype rat bezier
  1550.     curv2 -6 -5 -4 -3 -2 -1 -6
  1551.     parm u 0.00 1.00 2.00
  1552.     sp 2 3
  1553.     end
  1554.     # surface
  1555.     v -1.350 -1.030 0.000
  1556.     v  0.130 -1.030 0.432 7.600
  1557.     v  1.480 -1.030 0.000 2.300
  1558.     v -1.460  0.060 0.201
  1559.     v  0.120  0.060 0.915 0.500
  1560.     v  1.380  0.060 0.454 1.500
  1561.     v -1.480  1.030 0.000 2.300
  1562.     v  0.120  1.030 0.394 6.100
  1563.     v  1.170  1.030 0.000 3.300
  1564.     cstype rat bspline
  1565.     deg 2 2
  1566.     surf -1.0 2.5 -2.0 2.0 -9 -8 -7 -6 -5 -4 -3 -2 -1
  1567.     parm u -1.00 -1.00 -1.00 2.50 2.50 2.50
  1568.     parm v -2.00 -2.00 -2.00 2.00 2.00 2.00
  1569.     trim 0.0 2.0 1
  1570.     sp 4
  1571.     end
  1572.  
  1573. Connectivity between free-form surfaces
  1574.  
  1575. Connectivity connects two surfaces along their trimming curves.
  1576.  
  1577. The con statement specifies the first surface with its trimming curve
  1578. and the second surface with its trimming curve. This information is
  1579. useful for edge merging. Without this surface and curve data,
  1580. connectivity must be determined numerically at greater expense and with
  1581. reduced accuracy using the mg statement.
  1582.  
  1583. Connectivity between surfaces in different merging groups is ignored.
  1584. Also, although connectivity which crosses points of C1discontinuity in
  1585. trimming curves is legal, it is not recommended. Instead, use two
  1586. connectivity statements which meet at the point of discontinuity.
  1587.  
  1588. The two curves and their starting and ending parameters should all map
  1589. to the same curve and starting and ending points in object space.
  1590.  
  1591. Syntax
  1592.  
  1593. con  surf_1  q0_1  q1_1   curv2d_1   surf_2  q0_2  q1_2  curv2d_2
  1594.  
  1595.     Free-form geometry statement.
  1596.  
  1597.     Specifies connectivity between two surfaces.
  1598.  
  1599.     surf_1 is the index of the first surface.
  1600.  
  1601.     q0_1 is the starting parameter for the curve referenced by
  1602.     curv2d_1.
  1603.  
  1604.     q1_1 is the ending parameter for the curve referenced by curv2d_1.
  1605.  
  1606.     curv2d_1 is the index of a curve on the first surface. This curve
  1607.     must have been previously defined with the curv2 statement.
  1608.  
  1609.     surf_2 is the index of the second surface.
  1610.  
  1611.     q0_2 is the starting parameter for the curve referenced by
  1612.     curv2d_2.
  1613.  
  1614.     q1_2 is the ending parameter for the curve referenced by curv2d_2.
  1615.  
  1616.     curv2d_2 is the index of a curve on the second surface. This curve
  1617.     must have been previously defined with the curv2 statement.
  1618.  
  1619. Example
  1620.  
  1621. 1.      Connectivity between two surfaces
  1622.  
  1623. This example shows the connectivity between two surfaces with trimming
  1624. curves.
  1625.  
  1626.     cstype bezier
  1627.     deg 1 1
  1628.  
  1629.     v 0 0 0
  1630.     v 1 0 0
  1631.     v 0 1 0
  1632.     v 1 1 0
  1633.  
  1634.     vp 0 0
  1635.     vp 1 0
  1636.     vp 1 1
  1637.     vp 0 1
  1638.  
  1639.     curv2 1 2 3 4 1
  1640.     parm u 0.0 1.0 2.0 3.0 4.0
  1641.     end
  1642.  
  1643.     surf 0.0 1.0 0.0 1.0 1 2 3 4
  1644.     parm u 0.0 1.0
  1645.     parm v 0.0 1.0
  1646.     trim 0.0 4.0 1
  1647.     end
  1648.  
  1649.     v 1 0 0
  1650.     v 2 0 0
  1651.     v 1 1 0
  1652.     v 2 1 0
  1653.  
  1654.     surf 0.0 1.0 0.0 1.0 5 6 7 8
  1655.     parm u 0.0 1.0
  1656.     parm v 0.0 1.0
  1657.     trim 0.0 4.0 1
  1658.     end
  1659.  
  1660.     con 1 2.0 2.0 1 2 4.0 3.0 1
  1661.  
  1662.  
  1663. Grouping
  1664.  
  1665. There are four statements in the .obj file to help you manipulate groups
  1666. of elements:
  1667.  
  1668. o    Gropu name statements are used to organize collections of
  1669.     elements and simplify data manipulation for operations in
  1670.     Model.
  1671.  
  1672. o    Smoothing group statements let you identify elements over which
  1673.     normals are to be interpolated to give those elements a smooth,
  1674.     non-faceted appearance.  This is a quick way to specify vertex
  1675.     normals.
  1676.  
  1677. o    Merging group statements are used to ideneify free-form elements
  1678.     that should be inspected for adjacency detection.  You can also
  1679.     use merging groups to exclude surfaces which are close enough to
  1680.     be considered adjacent but should not be merged.
  1681.  
  1682. o    Object name statements let you assign a name to an entire object
  1683.     in a single file.
  1684.  
  1685. All grouping statements are state-setting.  This means that once a
  1686. group statement is set, it alpplies to all elements that follow
  1687. until the next group statement.
  1688.  
  1689. This portion of a sample file shows a single element which belongs to
  1690. three groups.  The smoothing group is turned off.
  1691.  
  1692.     g square thing all
  1693.     s off
  1694.     f 1 2 3 4
  1695.  
  1696. This example shows two surfaces in merging group 1 with a merge
  1697. resolution of 0.5.
  1698.  
  1699.     mg 1 .5
  1700.     surf 0.0 1.0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
  1701.     surf 0.0 1.0 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
  1702.  
  1703. Syntax
  1704.  
  1705. g group_name1 group_name2 . . .
  1706.  
  1707.     Polygonal and free-form geometry statement.
  1708.  
  1709.     Specifies the group name for the elements that follow it. You can
  1710.     have multiple group names. If there are multiple groups on one
  1711.     line, the data that follows belong to all groups. Group information
  1712.     is optional.
  1713.  
  1714.     group_name is the name for the group. Letters, numbers, and
  1715.     combinations of letters and numbers are accepted for group names.
  1716.     The default group name is default.
  1717.  
  1718. s group_number
  1719.  
  1720.     Polygonal and free-form geometry statement.
  1721.  
  1722.     Sets the smoothing group for the elements that follow it. If you do
  1723.     not want to use a smoothing group, specify off or a value of 0.
  1724.  
  1725.     To display with smooth shading in Model and PreView, you must
  1726.     create vertex normals after you have assigned the smoothing groups.
  1727.     You can create vertex normals with the vn statement or with the
  1728.     Model program.
  1729.  
  1730.     To smooth polygonal geometry for rendering with Image, it is
  1731.     sufficient to put elements in some smoothing group. However, vertex
  1732.     normals override smoothing information for Image.
  1733.  
  1734.     group_number is the smoothing group number. To turn off smoothing
  1735.     groups, use a value of 0 or off. Polygonal elements use group
  1736.     numbers to put elements in different smoothing groups. For
  1737.     free-form surfaces, smoothing groups are either turned on or off;
  1738.     there is no difference between values greater than 0.
  1739.  
  1740. mg group_number res
  1741.  
  1742.     Free-form geometry statement.
  1743.  
  1744.     Sets the merging group and merge resolution for the free-form
  1745.     surfaces that follow it. If you do not want to use a merging group,
  1746.     specify off or a value of 0.
  1747.  
  1748.     Adjacency detection is performed only within groups, never between
  1749.     groups. Connectivity between surfaces in different merging groups
  1750.     is not allowed. Surfaces in the same merging group are merged
  1751.     together along edges that are within the distance res apart.
  1752.  
  1753.     NOTE: Adjacency detection is an expensive numerical comparison
  1754.     process.  It is best to restrict this process to as small a domain
  1755.     as possible by using small merging groups.
  1756.  
  1757.     group_number is the merging group number. To turn off adjacency
  1758.     detection, use a value of 0 or off.
  1759.  
  1760.     res is the maximum distance between two surfaces that will be
  1761.     merged together. The resolution must be a value greater than 0.
  1762.     This is a required argument only when using merging groups.
  1763.  
  1764. o object_name
  1765.  
  1766.     Polygonal and free-form geometry statement.
  1767.  
  1768.     Optional statement; it is not processed by any Wavefront programs.
  1769.     It specifies a user-defined object name for the elements defined
  1770.     after this statement.
  1771.  
  1772.     object_name is the user-defined object name. There is no default.
  1773.  
  1774. Examples
  1775.  
  1776. 1.      Cube with group names
  1777.  
  1778. The following example is a cube with each of its faces placed in a
  1779. separate group. In addition, all elements belong to the group cube.
  1780.  
  1781.     v 0.000000 2.000000 2.000000
  1782.     v 0.000000 0.000000 2.000000
  1783.     v 2.000000 0.000000 2.000000
  1784.     v 2.000000 2.000000 2.000000
  1785.     v 0.000000 2.000000 0.000000
  1786.     v 0.000000 0.000000 0.000000
  1787.     v 2.000000 0.000000 0.000000
  1788.     v 2.000000 2.000000 0.000000
  1789.     # 8 vertices
  1790.  
  1791.     g front cube
  1792.     f 1 2 3 4
  1793.     g back cube
  1794.     f 8 7 6 5
  1795.     g right cube
  1796.     f 4 3 7 8
  1797.     g top cube
  1798.     f 5 1 4 8
  1799.     g left cube
  1800.     f 5 6 2 1
  1801.     g bottom cube
  1802.     f 2 6 7 3
  1803.     # 6 elements
  1804.  
  1805.  
  1806. 2.      Two adjoining squares with a smoothing group
  1807.  
  1808. This example shows two adjoining squares that share a common edge. The
  1809. squares are placed in a smoothing group to ensure that their common
  1810. edge will be smoothed when rendered with Image.
  1811.  
  1812.     v 0.000000 2.000000 0.000000
  1813.     v 0.000000 0.000000 0.000000
  1814.     v 2.000000 0.000000 0.000000
  1815.     v 2.000000 2.000000 0.000000
  1816.     v 4.000000 0.000000 -1.255298
  1817.     v 4.000000 2.000000 -1.255298
  1818.     # 6 vertices
  1819.  
  1820.     g all
  1821.     s 1
  1822.     f 1 2 3 4
  1823.     f 4 3 5 6
  1824.     # 2 elements
  1825.  
  1826.  
  1827. 3.      Two adjoining squares with vertex normals
  1828.  
  1829. This example also shows two squares that share a common edge. Vertex
  1830. normals have been added to the corners of each square to ensure that
  1831. their common edge will be smoothed during display in Model and PreView
  1832. and when rendered with Image.
  1833.  
  1834.     v 0.000000 2.000000 0.000000
  1835.     v 0.000000 0.000000 0.000000
  1836.     v 2.000000 0.000000 0.000000
  1837.     v 2.000000 2.000000 0.000000
  1838.     v 4.000000 0.000000 -1.255298
  1839.     v 4.000000 2.000000 -1.255298
  1840.     vn 0.000000 0.000000 1.000000
  1841.     vn 0.000000 0.000000 1.000000
  1842.     vn 0.276597 0.000000 0.960986
  1843.     vn 0.276597 0.000000 0.960986
  1844.     vn 0.531611 0.000000 0.846988
  1845.     vn 0.531611 0.000000 0.846988
  1846.     # 6 vertices
  1847.  
  1848.     # 6 normals
  1849.  
  1850.     g all
  1851.     s 1
  1852.     f 1//1 2//2 3//3 4//4
  1853.     f 4//4 3//3 5//5 6//6
  1854.     # 2 elements
  1855.  
  1856.  
  1857. 4.      Merging group
  1858.  
  1859. This example shows two Bezier surfaces that meet at a common edge. They
  1860. have both been placed in the same merging group to ensure continuity at
  1861. the edge where they meet. This prevents "cracks" from appearing along
  1862. the seam between the two surfaces during rendering. Merging groups will
  1863. be ignored during flat-shading, smooth-shading, and material shading of
  1864. the surface.
  1865.  
  1866.     v -4.949854 -5.000000 0.000000
  1867.     v -4.949854 -1.666667 0.000000
  1868.     v -4.949854 1.666667 0.000000
  1869.     v -4.949854 5.000000 0.000000
  1870.     v -1.616521 -5.000000 0.000000
  1871.     v -1.616521 -1.666667 0.000000
  1872.     v -1.616521 1.666667 0.000000
  1873.     v -1.616521 5.000000 0.000000
  1874.     v 1.716813 -5.000000 0.000000
  1875.     v 1.716813 -1.666667 0.000000
  1876.     v 1.716813 1.666667 0.000000
  1877.     v 1.716813 5.000000 0.000000
  1878.     v 5.050146 -5.000000 0.000000
  1879.     v 5.050146 -1.666667 0.000000
  1880.     v 5.050146 1.666667 0.000000
  1881.     v 5.050146 5.000000 0.000000
  1882.     v -15.015566 -4.974991 0.000000
  1883.     v -15.015566 -1.641658 0.000000
  1884.     v -15.015566 1.691675 0.000000
  1885.     v -15.015566 5.025009 0.000000
  1886.     v -11.682233 -4.974991 0.000000
  1887.     v -11.682233 -1.641658 0.000000
  1888.     v -11.682233 1.691675 0.000000
  1889.     v -11.682233 5.025009 0.000000
  1890.     v -8.348900 -4.974991 0.000000
  1891.     v -8.348900 -1.641658 0.000000
  1892.     v -8.348900 1.691675 0.000000
  1893.     v -8.348900 5.025009 0.000000
  1894.     v -5.015566 -4.974991 0.000000
  1895.     v -5.015566 -1.641658 0.000000
  1896.     v -5.015566 1.691675 0.000000
  1897.     v -5.015566 5.025009 0.000000
  1898.  
  1899.     mg 1 0.500000
  1900.  
  1901.     cstype bezier
  1902.     deg 3 3
  1903.     surf 0.000000 1.000000 0.000000 1.000000 13 14 \
  1904.     15 16 9 10 11 12 5 6 7 8 1 2 3 4
  1905.     parm u 0.000000 1.000000
  1906.     parm v 0.000000 1.000000
  1907.     end
  1908.     surf 0.000000 1.000000 0.000000 1.000000 29 30 31 32 25 26 27 28 21 22 \
  1909.     23 24 17 18 19 20
  1910.     parm u 0.000000 1.000000
  1911.     parm v 0.000000 1.000000
  1912.     end
  1913.  
  1914.  
  1915. Display/render attributes
  1916.  
  1917. Display and render attributes describe how an object looks when
  1918. displayed in Model and PreView or when rendered with Image.
  1919.  
  1920. Some attributes apply to both free-form and polygonal geometry, such as
  1921. material name and library, ray tracing, and shadow casting.
  1922. Interpolation attributes apply only to polygonal geometry. Curve and
  1923. surface resolutions are used for only free-form geometry.
  1924.  
  1925. The following chart shows the display and render statements available
  1926. for polygonal and free-form geometry.
  1927.  
  1928. Table B1-1.     Display and render attributes
  1929.  
  1930. polygonal only        polygonal or free-form    free-form only
  1931. --------------        ----------------------    --------------
  1932. bevel            lod            ctech
  1933. c_interp        usemtl            stech
  1934. d_interp        mtllib
  1935.             shadow_obj
  1936.             trace_obj
  1937.  
  1938. All display and render attribute statements are state-setting. This
  1939. means that once an attribute statement is set, it applies to all
  1940. elements that follow until it is reset to a different value.
  1941.  
  1942. The following sample shows rendering and display statements for a face
  1943. element.:
  1944.  
  1945.     s 1
  1946.     usemtl blue
  1947.     usemap marble
  1948.     f 1 2 3 4
  1949.  
  1950. Syntax
  1951.  
  1952. The following syntax statements are listed by the type of geometry.
  1953. First are statements for polygonal geometry. Second are statements for
  1954. both free-form and polygonal geometry. Third are statements for
  1955. free-form geometry only.
  1956.  
  1957. bevel on/off
  1958.  
  1959.     Polygonal geometry statement.
  1960.  
  1961.     Sets bevel interpolation on or off. It works only with beveled
  1962.     objects, that is, objects with sides separated by beveled faces.
  1963.  
  1964.     Bevel interpolation uses normal vector interpolation to give an
  1965.     illusion of roundness to a flat bevel. It does not affect the
  1966.     smoothing of non-bevelled faces.
  1967.  
  1968.     Bevel interpolation does not alter the geometry of the original
  1969.     object.
  1970.  
  1971.     on turns on bevel interpolation.
  1972.  
  1973.     off turns off bevel interpolation. The default is off.
  1974.  
  1975.     NOTE: Image cannot render bevel-interpolated elements that have
  1976.     vertex normals.
  1977.  
  1978. c_interp on/off
  1979.  
  1980.     Polygonal geometry statement.
  1981.  
  1982.     Sets color interpolation on or off.
  1983.  
  1984.     Color interpolation creates a blend across the surface of a polygon
  1985.     between the materials assigned to its vertices. This creates a
  1986.     blending of colors across a face element.
  1987.  
  1988.     To support color interpolation, materials must be assigned per
  1989.     vertex, not per element. The illumination models for all materials
  1990.     of vertices attached to the polygon must be the same. Color
  1991.     interpolation applies to the values for ambient (Ka), diffuse (Kd),
  1992.     specular (Ks), and specular highlight (Ns) material properties.
  1993.  
  1994.     on turns on color interpolation.
  1995.  
  1996.     off turns off color interpolation. The default is off.
  1997.  
  1998. d_interp on/off
  1999.  
  2000.     Polygonal geometry statement.
  2001.  
  2002.     Sets dissolve interpolation on or off.
  2003.  
  2004.     Dissolve interpolation creates an interpolation or blend across a
  2005.     polygon between the dissolve (d) values of the materials assigned
  2006.     to its vertices. This feature is used to create effects exhibiting
  2007.     varying degrees of apparent transparency, as in glass or clouds.
  2008.  
  2009.     To support dissolve interpolation, materials must be assigned per
  2010.     vertex, not per element. All the materials assigned to the vertices
  2011.     involved in the dissolve interpolation must contain a dissolve
  2012.     factor command to specify a dissolve.
  2013.  
  2014.     on turns on dissolve interpolation.
  2015.  
  2016.     off turns off dissolve interpolation. The default is off.
  2017.  
  2018. lod level
  2019.  
  2020.     Polygonal and free-form geometry statement.
  2021.  
  2022.     Sets the level of detail to be displayed in a PreView animation.
  2023.     The level of detail feature lets you control which elements of an
  2024.     object are displayed while working in PreView.
  2025.  
  2026.     level is the level of detail to be displayed. When you set the
  2027.     level of detail to 0 or omit the lod statement, all elements are
  2028.     displayed.  Specifying an integer between 1 and 100 sets the level
  2029.     of detail to be displayed when reading the .obj file.
  2030.  
  2031. maplib filename1 filename2 . . .
  2032.  
  2033.     This is a rendering identifier that specifies the map library file
  2034.     for the texture map definitions set with the usemap identifier. You
  2035.     can specify multiple filenames with maplib. If multiple filenames
  2036.     are specified, the first file listed is searched first for the map
  2037.     definition, the second file is searched next, and so on.
  2038.  
  2039.     When you assign a map library using the Model program, Model allows
  2040.     only one map library per .obj file. You can assign multiple
  2041.     libraries using a text editor.
  2042.  
  2043.     filename is the name of the library file where the texture maps are
  2044.     defined. There is no default.
  2045.  
  2046. usemap map_name/off
  2047.  
  2048.     This is a rendering identifier that specifies the texture map name
  2049.     for the element following it. To turn off texture mapping, specify
  2050.     off instead of the map name.
  2051.  
  2052.     If you specify texture mapping for a face without texture vertices,
  2053.     the texture map will be ignored.
  2054.  
  2055.     map_name is the name of the texture map.
  2056.  
  2057.     off turns off texture mapping. The default is off.
  2058.  
  2059. usemtl material_name
  2060.  
  2061.     Polygonal and free-form geometry statement.
  2062.  
  2063.     Specifies the material name for the element following it. Once a
  2064.     material is assigned, it cannot be turned off; it can only be
  2065.     changed.
  2066.  
  2067.     material_name is the name of the material. If a material name is
  2068.     not specified, a white material is used.
  2069.  
  2070. mtllib filename1 filename2 . . .
  2071.  
  2072.     Polygonal and free-form geometry statement.
  2073.  
  2074.     Specifies the material library file for the material definitions
  2075.     set with the usemtl statement. You can specify multiple filenames
  2076.     with mtllib. If multiple filenames are specified, the first file
  2077.     listed is searched first for the material definition, the second
  2078.     file is searched next, and so on.
  2079.  
  2080.     When you assign a material library using the Model program, only
  2081.     one map library per .obj file is allowed. You can assign multiple
  2082.     libraries using a text editor.
  2083.  
  2084.     filename is the name of the library file that defines the
  2085.     materials.  There is no default.
  2086.  
  2087. shadow_obj filename
  2088.  
  2089.     Polygonal and free-form geometry statement.
  2090.  
  2091.     Specifies the shadow object filename. This object is used to cast
  2092.     shadows for the current object. Shadows are only visible in a
  2093.     rendered image; they cannot be seen using hardware shading. The
  2094.     shadow object is invisible except for its shadow.
  2095.  
  2096.     An object will cast shadows only if it has a shadow object. You can
  2097.     use an object as its own shadow object. However, a simplified
  2098.     version of the original object is usually preferable for shadow
  2099.     objects, since shadow casting can greatly increase rendering time.
  2100.  
  2101.     filename is the filename for the shadow object. You can enter any
  2102.     valid object filename for the shadow object. The object file can be
  2103.     an .obj or .mod file. If a filename is given without an extension,
  2104.     an extension of .obj is assumed.
  2105.  
  2106.     Only one shadow object can be stored in a file. If more than one
  2107.     shadow object is specified, the last one specified will be used.
  2108.  
  2109. trace_obj filename
  2110.  
  2111.     Polygonal and free-form geometry statement.
  2112.  
  2113.     Specifies the ray tracing object filename. This object will be used
  2114.     in generating reflections of the current object on reflective
  2115.     surfaces.  Reflections are only visible in a rendered image; they
  2116.     cannot be seen using hardware shading.
  2117.  
  2118.     An object will appear in reflections only if it has a trace object.
  2119.     You can use an object as its own trace object. However, a
  2120.     simplified version of the original object is usually preferable for
  2121.     trace objects, since ray tracing can greatly increase rendering
  2122.     time.
  2123.  
  2124.     filename is the filename for the ray tracing object. You can enter
  2125.     any valid object filename for the trace object. You can enter any
  2126.     valid object filename for the shadow object. The object file can be
  2127.     an .obj or .mod file. If a filename is given without an extension,
  2128.     an extension of .obj is assumed.
  2129.  
  2130.     Only one trace object can be stored in a file. If more than one is
  2131.     specified, the last one is used.
  2132.  
  2133. ctech  technique  resolution
  2134.  
  2135.     Free-form geometry statement.
  2136.  
  2137.     Specifies a curve approximation technique. The arguments specify
  2138.     the technique and resolution for the curve.
  2139.  
  2140.     You must select from one of the following three techniques.
  2141.  
  2142.     ctech cparm res
  2143.  
  2144.     Specifies a curve with constant parametric subdivision using
  2145.     one resolution parameter. Each polynomial segment of the curve
  2146.     is subdivided n times in parameter space, where n is the
  2147.     resolution parameter multiplied by the degree of the curve.
  2148.  
  2149.     res is the resolution parameter. The larger the value, the
  2150.     finer the resolution. If res has a value of 0, each polynomial
  2151.     curve segment is represented by a single line segment.
  2152.  
  2153.     ctech cspace maxlength
  2154.  
  2155.     Specifies a curve with constant spatial subdivision. The curve
  2156.     is approximated by a series of line segments whose lengths in
  2157.     real space are less than or equal to the maxlength.
  2158.  
  2159.     maxlength is the maximum length of the line segments. The
  2160.     smaller the value, the finer the resolution.
  2161.  
  2162.     ctech curv maxdist maxangle
  2163.  
  2164.     Specifies curvature-dependent subdivision using separate
  2165.     resolution parameters for the maximum distance and the maximum
  2166.     angle.
  2167.  
  2168.     The curve is approximated by a series of line segments in which
  2169.     1) the distance in object space between a line segment and the
  2170.     actual curve must be less than the maxdist parameter and 2) the
  2171.     angle in degrees between tangent vectors at the ends of a line
  2172.     segment must be less than the maxangle parameter.
  2173.  
  2174.     maxdist is the distance in real space between a line segment
  2175.     and the actual curve.
  2176.  
  2177.     maxangle is the angle (in degrees) between tangent vectors at
  2178.     the ends of a line segment.
  2179.  
  2180.     The smaller the values for maxdist and maxangle, the finer the
  2181.     resolution.
  2182.  
  2183.     NOTE: Approximation information for trimming, hole, and special
  2184.     curves is stored in the corresponding surface. The ctech statement
  2185.     for the surface is used, not the ctech statement applied to the
  2186.     curv2 statement. Although untrimmed surfaces have no explicit
  2187.     trimming loop, a loop is constructed which bounds the legal
  2188.     parameter range. This implicit loop follows the same rules as any
  2189.     other loop and is approximated according to the ctech information
  2190.     for the surface.
  2191.  
  2192. stech  technique  resolution
  2193.  
  2194.     Free-form geometry statement.
  2195.  
  2196.     Specifies a surface approximation technique. The arguments specify
  2197.     the technique and resolution for the surface.
  2198.  
  2199.     You must select from one of the following techniques:
  2200.  
  2201.     stech cparma ures vres
  2202.  
  2203.     Specifies a surface with constant parametric subdivision using
  2204.     separate resolution parameters for the u and v directions. Each
  2205.     patch of the surface is subdivided n times in parameter space,
  2206.     where n is the resolution parameter multiplied by the degree of
  2207.     the surface.
  2208.  
  2209.     ures is the resolution parameter for the u direction.
  2210.  
  2211.     vres is the resolution parameter for the v direction.
  2212.  
  2213.     The larger the values for ures and vres, the finer the
  2214.     resolution.  If you enter a value of 0 for both ures and vres,
  2215.     each patch is approximated by two triangles.
  2216.  
  2217.     stech cparmb uvres
  2218.  
  2219.     Specifies a surface with constant parametric subdivision, with
  2220.     refinement using one resolution parameter for both the u and v
  2221.     directions.
  2222.  
  2223.     An initial triangulation is performed using only the points on
  2224.     the trimming curves. This triangulation is then refined until
  2225.     all edges are of an appropriate length. The resulting triangles
  2226.     are not oriented along isoparametric lines as they are in the
  2227.     cparma technique.
  2228.  
  2229.     uvres is the resolution parameter for both the u and v
  2230.     directions.  The larger the value, the finer the resolution.
  2231.  
  2232.     stech cspace maxlength
  2233.  
  2234.     Specifies a surface with constant spatial subdivision.
  2235.  
  2236.     The surface is subdivided in rectangular regions until the
  2237.     length in real space of any rectangle edge is less than the
  2238.     maxlength.  These rectangular regions are then triangulated.
  2239.  
  2240.     maxlength is the length in real space of any rectangle edge.
  2241.     The smaller the value, the finer the resolution.
  2242.  
  2243.     stech curv maxdist maxangle
  2244.  
  2245.     Specifies a surface with curvature-dependent subdivision using
  2246.     separate resolution parameters for the maximum distance and the
  2247.     maximum angle.
  2248.  
  2249.     The surface is subdivided in rectangular regions until 1) the
  2250.     distance in real space between the approximating rectangle and
  2251.     the actual surface is less than the maxdist (approximately) and
  2252.     2) the angle in degrees between surface normals at the corners
  2253.     of the rectangle is less than the maxangle. Following
  2254.     subdivision, the regions are triangulated.
  2255.  
  2256.     maxdist is the distance in real space between the approximating
  2257.     rectangle and the actual surface.
  2258.  
  2259.     maxangle is the angle in degrees between surface normals at the
  2260.     corners of the rectangle.
  2261.  
  2262.     The smaller the values for maxdist and maxangle, the finer the
  2263.     resolution.
  2264.  
  2265. Examples
  2266.  
  2267. 1.      Cube with materials
  2268.  
  2269. This cube has a different material applied to each of its faces.
  2270.  
  2271.     mtllib master.mtl
  2272.  
  2273.     v 0.000000 2.000000 2.000000
  2274.     v 0.000000 0.000000 2.000000
  2275.     v 2.000000 0.000000 2.000000
  2276.     v 2.000000 2.000000 2.000000
  2277.     v 0.000000 2.000000 0.000000
  2278.     v 0.000000 0.000000 0.000000
  2279.     v 2.000000 0.000000 0.000000
  2280.     v 2.000000 2.000000 0.000000
  2281.     # 8 vertices
  2282.  
  2283.     g front
  2284.     usemtl red
  2285.     f 1 2 3 4
  2286.     g back
  2287.     usemtl blue
  2288.     f 8 7 6 5
  2289.     g right
  2290.     usemtl green
  2291.     f 4 3 7 8
  2292.     g top
  2293.     usemtl gold
  2294.     f 5 1 4 8
  2295.     g left
  2296.     usemtl orange
  2297.     f 5 6 2 1
  2298.     g bottom
  2299.     usemtl purple
  2300.     f 2 6 7 3
  2301.     # 6 elements
  2302.  
  2303.  
  2304. 2.      Cube casting a shadow
  2305.  
  2306. In this example, the cube casts a shadow on the other objects when it
  2307. is rendered with Image. The cube, which is stored in the file cube.obj,
  2308. references itself as the shadow object.
  2309.  
  2310.     mtllib master.mtl
  2311.     shadow_obj cube.obj
  2312.  
  2313.     v 0.000000 2.000000 2.000000
  2314.     v 0.000000 0.000000 2.000000
  2315.     v 2.000000 0.000000 2.000000
  2316.     v 2.000000 2.000000 2.000000
  2317.     v 0.000000 2.000000 0.000000
  2318.     v 0.000000 0.000000 0.000000
  2319.     v 2.000000 0.000000 0.000000
  2320.     v 2.000000 2.000000 0.000000
  2321.     # 8 vertices
  2322.  
  2323.     g front
  2324.     usemtl red
  2325.     f 1 2 3 4
  2326.     g back
  2327.     usemtl blue
  2328.     f 8 7 6 5
  2329.     g right
  2330.     usemtl green
  2331.     f 4 3 7 8
  2332.     g top
  2333.     usemtl gold
  2334.     f 5 1 4 8
  2335.     g left
  2336.     usemtl orange
  2337.     f 5 6 2 1
  2338.     g bottom
  2339.     usemtl purple
  2340.     f 2 6 7 3
  2341.     # 6 elements
  2342.  
  2343.  
  2344. 3.      Cube casting a reflection
  2345.  
  2346. This cube casts its reflection on any reflective objects when it is
  2347. rendered with Image. The cube, which is stored in the file cube.obj,
  2348. references itself as the trace object.
  2349.  
  2350.     mtllib master.mtl
  2351.     trace_obj cube.obj
  2352.  
  2353.     v 0.000000 2.000000 2.000000
  2354.     v 0.000000 0.000000 2.000000
  2355.     v 2.000000 0.000000 2.000000
  2356.     v 2.000000 2.000000 2.000000
  2357.     v 0.000000 2.000000 0.000000
  2358.     v 0.000000 0.000000 0.000000
  2359.     v 2.000000 0.000000 0.000000
  2360.     v 2.000000 2.000000 0.000000
  2361.     # 8 vertices
  2362.  
  2363.     g front
  2364.     usemtl red
  2365.     f 1 2 3 4
  2366.     g back
  2367.     usemtl blue
  2368.     f 8 7 6 5
  2369.     g right
  2370.     usemtl green
  2371.     f 4 3 7 8
  2372.     g top
  2373.     usemtl gold
  2374.     f 5 1 4 8
  2375.     g left
  2376.     usemtl orange
  2377.     f 5 6 2 1
  2378.     g bottom
  2379.     usemtl purple
  2380.     f 2 6 7 3
  2381.     # 6 elements
  2382.  
  2383.  
  2384.  
  2385. 4.      Texture-mapped square
  2386.  
  2387. This example describes a 2 x 2 square. It is mapped with a 1 x 1 square
  2388. texture. The texture is stretched to fit the square exactly.
  2389.  
  2390. mtllib master.mtl
  2391.  
  2392. v 0.000000 2.000000 0.000000
  2393. v 0.000000 0.000000 0.000000
  2394. v 2.000000 0.000000 0.000000
  2395. v 2.000000 2.000000 0.000000
  2396. vt 0.000000 1.000000 0.000000
  2397. vt 0.000000 0.000000 0.000000
  2398. vt 1.000000 0.000000 0.000000
  2399. vt 1.000000 1.000000 0.000000
  2400. # 4 vertices
  2401.  
  2402. usemtl wood
  2403. f 1/1 2/2 3/3 4/4
  2404. # 1 element
  2405.  
  2406. 5.      Approximation technique for a surface
  2407.  
  2408. This example shows a B-spline surface which will be approximated using
  2409. curvature-dependent subdivision specified by the stech command.
  2410.  
  2411.     g bspatch
  2412.     v -5.000000 -5.000000 -7.808327
  2413.     v -5.000000 -1.666667 -7.808327
  2414.     v -5.000000 1.666667 -7.808327
  2415.     v -5.000000 5.000000 -7.808327
  2416.     v -1.666667 -5.000000 -7.808327
  2417.     v -1.666667 -1.666667 11.977780
  2418.     v -1.666667 1.666667 11.977780
  2419.     v -1.666667 5.000000 -7.808327
  2420.     v 1.666667 -5.000000 -7.808327
  2421.     v 1.666667 -1.666667 11.977780
  2422.     v 1.666667 1.666667 11.977780
  2423.     v 1.666667 5.000000 -7.808327
  2424.     v 5.000000 -5.000000 -7.808327
  2425.     v 5.000000 -1.666667 -7.808327
  2426.     v 5.000000 1.666667 -7.808327
  2427.     v 5.000000 5.000000 -7.808327
  2428.     # 16 vertices
  2429.  
  2430.     g bspatch
  2431.     cstype bspline
  2432.     stech curv 0.5 10.000000
  2433.     deg 3 3
  2434.     surf 0.000000 1.000000 0.000000 1.000000 13 14 \ 15 16 9 10 11 12 5 6 7
  2435.     8 1 2 3 4
  2436.     parm u -3.000000 -2.000000 -1.000000 0.000000  \
  2437.     1.000000 2.000000 3.000000 4.000000
  2438.     parm v -3.000000 -2.000000 -1.000000 0.000000  \
  2439.     1.000000 2.000000 3.000000 4.000000
  2440.     end
  2441.     # 1 element
  2442.  
  2443.  
  2444.  
  2445. 6.      Approximation technique for a curve
  2446.  
  2447. This example shows a Bezier curve which will be approximated using
  2448. constant parametric subdivision specified by the ctech command.
  2449.  
  2450.     v -2.300000 1.950000 0.000000
  2451.     v -2.200000 0.790000 0.000000
  2452.     v -2.340000 -1.510000 0.000000
  2453.     v -1.530000 -1.490000 0.000000
  2454.     v -0.720000 -1.470000 0.000000
  2455.     v -0.780000 0.230000 0.000000
  2456.     v 0.070000 0.250000 0.000000
  2457.     v 0.920000 0.270000 0.000000
  2458.     v 0.800000 -1.610000 0.000000
  2459.     v 1.620000 -1.590000 0.000000
  2460.     v 2.440000 -1.570000 0.000000
  2461.     v 2.690000 0.670000 0.000000
  2462.     v 2.900000 1.980000 0.000000
  2463.     # 13 vertices
  2464.  
  2465.     g default
  2466.     cstype bezier
  2467.     ctech cparm 1.000000
  2468.     deg 3
  2469.     curv 0.000000 4.000000 1 2 3 4 5 6 7 8 9 10 \
  2470.     11 12 13
  2471.     parm u 0.000000 1.000000 2.000000 3.000000  \
  2472.     4.000000
  2473.     end
  2474.     # 1 element
  2475.  
  2476.  
  2477.  
  2478. Comments
  2479.  
  2480. Comments can appear anywhere in an .obj file. They are used to annotate
  2481. the file; they are not processed.
  2482.  
  2483. Here is an example:
  2484.  
  2485.     # this is a comment
  2486.  
  2487. The Model program automatically inserts comments when it creates .obj
  2488. files. For example, it reports the number of geometric vertices,
  2489. texture vertices, and vertex normals in a file.
  2490.  
  2491.     # 4 vertices
  2492.     # 4 texture vertices
  2493.     # 4 normals
  2494.  
  2495. Mathematics for free-form curves/surfaces
  2496.  
  2497. [I apologize but this section will make absolutely no sense whatsoever
  2498.  without the equations and diagrams and there was just no easy way to
  2499.  include them in a pure ASCII document.  You should probably just skip
  2500.  ahead to the section "Superseded statements."  -Jim, Wavefront]
  2501.  
  2502. PLEASE REFER TO THE FRAME AND PS FILES FOR EQUATIONS
  2503.  
  2504.  
  2505. General forms
  2506.  
  2507. Rational and non-rational curves and surfaces
  2508.  
  2509. In general, any non-rational curve segment may be written as:
  2510.  
  2511. where
  2512.  
  2513. K + 1    is the number of control points
  2514.  
  2515. di       are the control points
  2516.  
  2517. n        is the degree of the curve
  2518.  
  2519. Ni,n(t)          are the degree n basis functions
  2520.  
  2521. Extending this to the bivariate case, any non-rational surface patch
  2522. may be written as:
  2523.  
  2524. where:
  2525.  
  2526. K1 + 1   is the number of control points in the u direction
  2527.  
  2528. K2 + 1   is the number of control points in the v direction
  2529.  
  2530. di,j     are the control points
  2531.  
  2532. m        is the degree of the surface in the u direction
  2533.  
  2534. n        is the degree of the surface in the v direction
  2535.  
  2536. Ni,m(u)          are the degree m basis functions in the u direction
  2537.  
  2538. Nj,n(v)          are the degree n basis functions in the v direction
  2539.  
  2540. NOTE: The front of the surface is defined as the side where the u
  2541. parameter increases to the right and the v parameter increases upward.
  2542.  
  2543. We may extend this curve to the rational case as:
  2544.  
  2545.  
  2546.  
  2547. where wi are the weights associated with the control points di.
  2548. Similarly, a rational surface may be expressed as:
  2549.  
  2550. where wi,j  are the weights associated with the control points di,j.
  2551.  
  2552. NOTE: If a curve or surface in an .obj file is rational, it must use
  2553. the rat option with the cstype statement and it requires some weight
  2554. values for each control point.
  2555.  
  2556.  
  2557.  
  2558. The weights for the rational form are given as a third control point
  2559. coordinate (for trimming curves) or fourth coordinate (for space curves
  2560. and surfaces). These weights are optional and default to 1.0 if not
  2561. given.
  2562.  
  2563.  
  2564.  
  2565. This default weight is only reasonable for curves and surfaces whose
  2566. basis functions sum to 1.0, such as Bezier, Cardinal, and NURB. It does
  2567. not make sense for Taylor and may or may not make sense for a
  2568. representation given in basis-matrix form.
  2569.  
  2570. For all forms other than B-spline, the final curve or surface is
  2571. constructed by piecing together the individual curve segments or
  2572. surface patches. A global parameter space is then defined over the
  2573. entire composite curve or surface using the parameter vector given with
  2574. the parm statement.
  2575.  
  2576. The parameter vector for a curve is a list of p global parameter values
  2577. {t1, . . . , tp}. If t1  t < ti+1 is a point in global parameter space,
  2578. then:
  2579.  
  2580. is the corresponding point in local parameter space for the ith
  2581. polynomial segment. It is this t which is used when evaluating a given
  2582. segment of the piecewise curve. For surfaces, this mapping from global
  2583. to local parameter space is applied independently in both the u and v
  2584. parametric directions.
  2585.  
  2586. B-splines require a knot vector rather than a parameter vector,
  2587. although this is also given with the parm statement. Refer to the
  2588. description of B-splines below.
  2589.  
  2590. The following discussion of each type is expressed in terms of the
  2591. above definitions.
  2592.  
  2593. NOTE: The maximum degree for all curve and surface types is currently
  2594. set at 20, which is high enough for most purposes.
  2595.  
  2596.  
  2597.  
  2598. Free-form curve and surface types
  2599.  
  2600. B-spline
  2601.  
  2602. Type bspline specifies arbitrary degree non-uniform B-splines which are
  2603. commonly referred to as NURBs in their rational form. The basis
  2604. functions are defined by the Cox-deBoor recursion formulas as:
  2605.  
  2606. and:
  2607.  
  2608. where, by convention, 0/0 = 0.
  2609.  
  2610. The xi  {x0, . . . ,xq} form a set known as the knot vector which is
  2611. given by the parm statement. It is required that
  2612.  
  2613. 1.      xi  xi + 1,
  2614.  
  2615. 2.      x0 < xn + 1,
  2616.  
  2617. 3.      xq -n -1 < xq,
  2618.  
  2619. 4.      xi < xi + n for 0 < i < q - n - 1,
  2620.  
  2621. 5.      xn  t min < tmax  xK+ 1, where [tmin, tmax] is the parameter
  2622. over which the B-spline is to be evaluated, and
  2623.  
  2624. 6.      K = q - n - 1.
  2625.  
  2626. A knot is said to be of multiplicity r if its value is repeated r times
  2627. in the knot vector. The second through fourth conditions above restrict
  2628. knots to be of at most multiplicity n + 1 at the ends of the vector and
  2629. at most n everywhere else.
  2630.  
  2631. The last condition requires that the number of control points is equal
  2632. to one less than the number of knots minus the degree. For surfaces,
  2633. all of the above conditions apply independently for the u and v
  2634. parametric directions.
  2635.  
  2636. Bezier
  2637.  
  2638. Type bezier specifies arbitrary degree Bezier curves and surfaces. This
  2639. basis function is defined as:
  2640.  
  2641. where:
  2642.  
  2643. When using type bezier, the number of global parameter values given
  2644. with the parm statement must be K/n + 1, where K is the number of
  2645. control points. For surfaces, this requirement applies independently
  2646. for the u and v parametric directions.
  2647.  
  2648. Cardinal
  2649.  
  2650. Type cardinal specifies a cubic, first derivative, continuous curve or
  2651. surface. For curves, this interpolates all but the first and last
  2652. control points. For surfaces, all but the first and last row and column
  2653. of control points are interpolated.
  2654.  
  2655. Cardinal splines, also known as Catmull-Rom splines, are best
  2656. understood by considering the conversion from Cardinal to Bezier
  2657. control points for a single curve segment:
  2658.  
  2659. Here, the ci variables are the Cardinal control points and the bi
  2660. variables are the Bezier control points. We see that the second and
  2661. third Cardinal points are the beginning and ending points for the
  2662. segment, respectively. Also, the beginning tangent lies along the
  2663. vector from the first to the third point, and the ending tangent along
  2664. the vector from the second to the last point.
  2665.  
  2666. If we let Bi(t) be the cubic Bezier basis functions (i.e. what was
  2667. given above for Bezier as Ni,n(t) with n = 3), then we may write the
  2668. Cardinal basis functions as:
  2669.  
  2670. Note that Cardinal splines are only defined for the cubic case.
  2671.  
  2672. When using type cardinal, the number of global parameter values given
  2673. with the parm statement must be K - n + 2, where K is the number of
  2674. control points. For surfaces, this requirement applies independently
  2675. for the u and v parametric directions.
  2676.  
  2677. Taylor
  2678.  
  2679. Type taylor specifies arbitrary degree Taylor polynomial curves and
  2680. surfaces. The basis function is simply:
  2681.  
  2682. NOTE: The control points in this case are the polynomial coefficients
  2683. and have no obvious geometric significance.
  2684.  
  2685. When using type taylor, the number of global parameter values given
  2686. with the parm statement must be (K + 1)/(n + 1) + 1, where K is the
  2687. number of control points. For surfaces, this requirement applies
  2688. independently for the u and v parametric directions.
  2689.  
  2690. Basis matrix
  2691.  
  2692. Type bmatrix specifies general, arbitrary-degree curves defined through
  2693. the use of a basis matrix rather than an explicit type such as Bezier.
  2694. The basis functions are defined as:
  2695.  
  2696. where the basis matrix is the bi,j. In order to make the matrix nature
  2697. of this more obvious, we may also write:
  2698.  
  2699. When constructing basis matrices, you should keep this definition in
  2700. mind, as different authors write this in different ways. A more common
  2701. matrix representation is:
  2702.  
  2703. To use such matrices in the .obj file, simply transpose the matrix and
  2704. reverse the column ordering.
  2705.  
  2706. When using type basis, the number of global parameter values given with
  2707. the parm statement must be (K - n)/s + 2, where K is the number of
  2708. control points and s is the step size given with the step statement.
  2709. For surfaces, this requirement applies independently for the u and v
  2710. parametric directions.
  2711.  
  2712. Surface vertex data
  2713.  
  2714. Control points
  2715.  
  2716. The control points for a surface consisting of a single patch are
  2717. listed in the order i = 0 to K1 for j = 0, followed by i = 0 to K1 for
  2718. j = 1, and so on until j = K2.
  2719.  
  2720. For surfaces made up of many patches, which is the usual case, the
  2721. control points are ordered as if the surface were a single large patch.
  2722. For example, the control points for a bicubic Bezier surface consisting
  2723. of four patches would be arranged as follows:
  2724.  
  2725. where (m, n) is the global parameter space of the surface and the
  2726. numbers indicate the ordering of the vertex indices in the surf
  2727. statement.
  2728.  
  2729. Texture vertices and texture mapping
  2730.  
  2731. When texture vertices are not supplied, the original surface
  2732. parameterization is used for texture mapping. However, if texture
  2733. vertices are supplied, they are interpreted as additional information
  2734. to be interpolated or approximated separately from, but using the same
  2735. interpolation functions as the control vertices.
  2736.  
  2737. That is, whereas the surface itself, in the non-rational case, was
  2738. given in the section "Rational and non-rational curves and surfaces"
  2739. as:
  2740.  
  2741.  
  2742.  
  2743. the texture vertices are interpolated or approximated by:
  2744.  
  2745. where ti,j are the texture vertices and the basis functions are the
  2746. same as for S(u,v). It is T(u,v), rather than the surface
  2747. parameterization (u,v), which is used when a texture map is applied.
  2748.  
  2749. Vertex normals and normal mapping
  2750.  
  2751. Vertex normals are treated exactly like texture vertices. When vertex
  2752. normals are not supplied, the true surface normals are used. If vertex
  2753. normals are supplied, they are calculated as:
  2754.  
  2755. where qi,j are the vertex normals and the basis functions are the same
  2756. as for S(u,v) and T(u,v).
  2757.  
  2758. NOTE: Vertex normals do not affect the shape of the surface; they are
  2759. simply associated with the triangle vertices in the final
  2760. triangulation. As with faces, supplying vertex normals only affects
  2761. lighting calculations for the surface.
  2762.  
  2763. The treatment of both texture vertices and vertex normals in the case
  2764. of rational surfaces is identical. It is important to notice that even
  2765. when the surface S(u,v) is rational, the texture and normal surfaces,
  2766. T(u,v) and Q(u,v), are not rational. This is because the control points
  2767. (the texture vertices and vertex normals) are never rational.
  2768.  
  2769. Curve and surface operations
  2770.  
  2771. Special points
  2772.  
  2773. The following equations give a more precise description of special
  2774. points for space curves and discuss the extension to trimming curves
  2775. and surfaces.
  2776.  
  2777. Let C(t) be a space curve with the global parameter t. We can
  2778. approximate this curve by a set of k-1 line segments which connect the
  2779. points:
  2780.  
  2781. for some set of k global parameter values {t1,...,tk}
  2782.  
  2783. Given a special point ts in the parameter space of the curve
  2784. (referenced by vp), we guarantee that ts  {t1, . . . ,tk}. More
  2785. specifically, we approximate the curve by:
  2786.  
  2787. where, at the point i where ts is inserted, we have ti  ts < ti+1.
  2788.  
  2789. Special curves
  2790.  
  2791. The following equations give a more precise description of a special
  2792. curve.
  2793.  
  2794. Let T(t) be a special curve with the global parameter t. We have:
  2795.  
  2796. where (m,n) is a point in the global parameter space of a surface. We
  2797. can approximate this curve by a set of k-1 line segments which connect
  2798. the points:
  2799.  
  2800. for some set of k global parameter values.
  2801.  
  2802. Let S(m,n) be a surface with the global parameters m and n. We can
  2803. approximate this surface by a triangulation of a set of p points.
  2804.  
  2805. which lie on the surface. We further define E as the set of all edges
  2806. such that ei,j  E implies that S(mi,ni) and S(mj,nj) are connected in
  2807. the triangulation. Finally, we guarantee that there exists some subset
  2808. of E:
  2809.  
  2810. such that the points:
  2811.  
  2812. are connected in the triangulation.
  2813.  
  2814. Connectivity
  2815.  
  2816. Recall that the syntax of the con statement is:
  2817.  
  2818. con surf_1 q0_1 q1_1 curv2d_1 surf_2 q0_2 q1_2 curv2d_2
  2819.  
  2820. If we let:
  2821.  
  2822. T1(t1)  be the curve referenced by curv2d_1
  2823.  
  2824. S1(m1, n1)      be the surface referenced by surf1 on which T1(t1) lies
  2825.  
  2826. T2(t2)  be the curve referenced by curv2d_2
  2827.  
  2828. S2(m2, n2)      be the surface referenced by surf2 on which T2(t2) lies
  2829.  
  2830. then S1(T1(t1)), S2(T2(t2)) must be identical up to reparameterization.
  2831. Moreover, it must be the case that:
  2832.  
  2833. S1(T1(q0_1)) = S2(T2(q0_2))
  2834.  
  2835. and:
  2836.  
  2837. S1(T1(q1_1)) = S2(T2(q1_2))
  2838.  
  2839. It is along the curve S1(T1(t1)) between t1 = q0_1 and t1 = q1_1, and
  2840. the curve S2(T2(t2)) between t2 = q0_2 and t2 = q1_2 that the surface
  2841. S1(m1, n1) is connected to the surface S2(m2, n2).
  2842.  
  2843.  
  2844.  
  2845. Superseded statements
  2846.  
  2847. The new .obj file format has eliminated the need for several patch and
  2848. curve statements. These statements have been replaced by free-form
  2849. geometry statements.
  2850.  
  2851. In the 3.0 release, the following keywords have been superseded:
  2852.  
  2853. o       bsp
  2854.  
  2855. o       bzp
  2856.  
  2857. o       cdc
  2858.  
  2859. o       cdp
  2860.  
  2861. o       res
  2862.  
  2863. You can still read these statements in this version 3.0, however, the
  2864. system will no longer write files in this format.
  2865.  
  2866. This release is the last release that will read these statements. If
  2867. you want to save any data from this format, read in the file and write
  2868. it out. The system will convert the data to the new .obj format.
  2869.  
  2870. For more information on the new syntax statements, see "Specifying
  2871. free-form curves and surfaces."
  2872.  
  2873. Syntax
  2874.  
  2875. The following syntax statements are for the superseded keywords.
  2876.  
  2877. bsp v1 v2 . . . v16
  2878.  
  2879.     Specifies a B-spline patch. B-spline patches have sixteen control
  2880.     points, defined as vertices. Only four of the control points are
  2881.     distributed over the surface of the patch; the remainder are
  2882.     distributed around the perimeter of the patch.
  2883.  
  2884.     Patches must be tessellated in Model before they can be correctly
  2885.     shaded or rendered.
  2886.  
  2887.     v is the vertex number for a control point. Sixteen vertex numbers
  2888.     are required. Positive values indicate absolute vertex numbers.
  2889.     Negative values indicate relative vertex numbers.
  2890.  
  2891. bzp v1 v2 . . . v16
  2892.  
  2893.     Specifies a Bezier patch. Bezier patches have sixteen control
  2894.     points, defined as vertices. The control points are distributed
  2895.     uniformly over its surface.
  2896.  
  2897.     Patches must be tessellated in Model before they can be correctly
  2898.     shaded or rendered.
  2899.  
  2900.     v is the vertex number for a control point. Sixteen vertex numbers
  2901.     are required. Positive values indicate absolute vertex numbers.
  2902.     Negative values indicate relative vertex numbers.
  2903.  
  2904. cdc v1 v2 v3 v4 v5 . . .
  2905.  
  2906.     Specifies a Cardinal curve. Cardinal curves have a minimum of four
  2907.     control points, defined as vertices.
  2908.  
  2909.     Cardinal curves cannot be correctly shaded or rendered. They can be
  2910.     tessellated and then extruded in Model to create 3D shapes.
  2911.  
  2912.     v is the vertex number for a control point. A minimum of four
  2913.     vertex numbers are required. There is no limit on the maximum.
  2914.     Positive values indicate absolute vertex numbers. Negative values
  2915.     indicate relative vertex numbers.
  2916.  
  2917. cdp v1 v2 v3 . . . v16
  2918.  
  2919.     Specifies a Cardinal patch. Cardinal patches have sixteen control
  2920.     points, defined as vertices. Four of the control points are
  2921.     attached to the corners of the patch.
  2922.  
  2923.     Patches must be tessellated in Model before they can be correctly
  2924.     shaded or rendered.
  2925.  
  2926.     v is the vertex number for a control point. Sixteen vertex numbers
  2927.     are required. Positive values indicate absolute vertex numbers.
  2928.     Negative values indicate relative vertex numbers.
  2929.  
  2930. res useg vseg
  2931.  
  2932.     Reference and display statement.
  2933.  
  2934.     Sets the number of segments for Bezier, B-spline and Cardinal
  2935.     patches that follow it.
  2936.  
  2937.     useg is the number of segments in the u direction (horizontal or x
  2938.     direction). The minimum setting is 3 and the maximum setting is
  2939.     120.  The default is 4.
  2940.  
  2941.     vseg is the number of segments in the v direction (vertical or y
  2942.     direction). The minimum setting is 3 and the maximum setting is
  2943.     120.  The default is 4.
  2944.  
  2945. Comparison of 2.11 and 3.0 syntax
  2946.  
  2947. Cardinal curve
  2948.  
  2949. The following example shows the 2.11 syntax and the 3.0 syntax for the
  2950. same Cardinal curve.
  2951.  
  2952. 2.11 Cardinal curve
  2953.  
  2954.     # 2.11 Cardinal Curve
  2955.  
  2956.     v 2.570000 1.280000 0.000000
  2957.     v 0.940000 1.340000 0.000000
  2958.     v -0.670000 0.820000 0.000000
  2959.     v -0.770000 -0.940000 0.000000
  2960.     v 1.030000 -1.350000 0.000000
  2961.     v 3.070000 -1.310000 0.000000
  2962.     # 6 vertices
  2963.  
  2964.     cdc 1 2 3 4 5 6
  2965.  
  2966.  
  2967. 3.0 Cardinal curve
  2968.  
  2969.     # 3.0 Cardinal curve
  2970.  
  2971.     v 2.570000 1.280000 0.000000
  2972.     v 0.940000 1.340000 0.000000
  2973.     v -0.670000 0.820000 0.000000
  2974.     v -0.770000 -0.940000 0.000000
  2975.     v 1.030000 -1.350000 0.000000
  2976.     v 3.070000 -1.310000 0.000000
  2977.     # 6 vertices
  2978.  
  2979.     cstype cardinal
  2980.     deg 3
  2981.     curv 0.000000 3.000000 1 2 3 4 5 6
  2982.     parm u 0.000000 1.000000 2.000000 3.000000
  2983.     end
  2984.     # 1 element
  2985.  
  2986. Bezier patch
  2987.  
  2988.  The following example shows the 2.11 syntax and the 3.0 syntax for the
  2989.  same Bezier patch.
  2990.  
  2991. 2.11 Bezier patch
  2992.  
  2993.     # 2.11 Bezier Patch
  2994.     v -5.000000 -5.000000 0.000000
  2995.     v -5.000000 -1.666667 0.000000
  2996.     v -5.000000 1.666667 0.000000
  2997.     v -5.000000 5.000000 0.000000
  2998.     v -1.666667 -5.000000 0.000000
  2999.     v -1.666667 -1.666667 0.000000
  3000.     v -1.666667 1.666667 0.000000
  3001.     v -1.666667 5.000000 0.000000
  3002.     v 1.666667 -5.000000 0.000000
  3003.     v 1.666667 -1.666667 0.000000
  3004.     v 1.666667 1.666667 0.000000
  3005.     v 1.666667 5.000000 0.000000
  3006.     v 5.000000 -5.000000 0.000000
  3007.     v 5.000000 -1.666667 0.000000
  3008.     v 5.000000 1.666667 0.000000
  3009.     v 5.000000 5.000000 0.000000
  3010.     # 16 vertices
  3011.  
  3012.     bzp 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
  3013.     # 1 element
  3014.  
  3015. 3.0 Bezier patch
  3016.  
  3017.     #   3.0 Bezier patch
  3018.  
  3019.     v -5.000000 -5.000000 0.000000
  3020.     v -5.000000 -1.666667 0.000000
  3021.     v -5.000000 1.666667 0.000000
  3022.     v -5.000000 5.000000 0.000000
  3023.     v -1.666667 -5.000000 0.000000
  3024.     v -1.666667 -1.666667 0.000000
  3025.     v -1.666667 1.666667 0.000000
  3026.     v -1.666667 5.000000 0.000000
  3027.     v 1.666667 -5.000000 0.000000
  3028.     v 1.666667 -1.666667 0.000000
  3029.     v 1.666667 1.666667 0.000000
  3030.     v 1.666667 5.000000 0.000000
  3031.     v 5.000000 -5.000000 0.000000
  3032.     v 5.000000 -1.666667 0.000000
  3033.     v 5.000000 1.666667 0.000000
  3034.     v 5.000000 5.000000 0.000000
  3035.     # 16 vertices
  3036.  
  3037.     cstype bezier
  3038.     deg 3 3
  3039.     surf 0.000000 1.000000 0.000000 1.000000 13 14 \
  3040.     15 16 9 10 11 12 5 6 7 8 1 2 3 4
  3041.     parm u 0.000000 1.000000
  3042.     parm v 0.000000 1.000000
  3043.     end
  3044.     # 1 element
  3045.  
  3046.