HC

HC
Wavefront Object Files (.obj)

HC

HC

  • Wavefront Object Files (.obj)
  • File structure
  • General statement
  • Vertex data
  • Specifying free-form curves and surfaces
  • Data requirements for curves and surfaces
  • Elements
  • Free-form curve and surface body statement
  • Free-form curve and surface body statements
  • Connectivity between free-form surfaces
  • Grouping
  • Display and render attributes
  • Comments
  • Mathematics for free-form curves and surfaces
  • Superseded statements
  • Comparison of 2.11 and 3.0 syntax

Wavefront Object Files (.obj)


HC / Wavefront Object Files (.obj)

Wavefront Object Files (.obj)

HC [image] Wavefront Object Files (.obj)
HC File structure

Wavefront Object Files (.obj)

Object files define the geometry and other properties for objects in Wavefront's Advanced Visualizer. Object files can also be used to transfer geometric data back and forth between the Advanced Visualizer and other applications.

Object files can be in ASCII format (.obj) or binary format (.mod). This appendix describes the ASCII format for object files. These files must have the extension .obj.

In this release, the .obj file format supports both polygonal objects and free-form objects. Polygonal geometry uses points, lines, and faces to define objects while free-form geometry uses curves and surfaces.

About this section

The .obj appendix is for those who want to use the .obj format to translate geometric data from other software applications to Wavefront products. It also provides information for Advanced Visualizer users who want detailed information on the Wavefront .obj file format.

If you are a 2.11 user and want to understand the significance of the 3.0 release and how it affects your existing files, you may be especially interested in the section called "Superseded statements" at the end of the appendix. The section, "Patches and free-form surfaces," gives examples of how 2.11 patches look in 3.0.

How this section is organized

Most of this appendix describes the different parts of an .obj file and how those parts are arranged in the file. The three sections at the end of the appendix provide background information on the 3.0 release of the .obj format.

The .obj appendix includes the following sections:

o File structure

o General statement

o Vertex data

o Specifying free-form curves and surfaces

o Free-form curve and surface attributes

o Elements

o Free-form curve and surface body statements

o Connectivity between free-form surfaces

o Grouping

o Display and render attributes

o Comments

o Mathematics for free-form curves and surfaces

o Superseded statements

o Patches and free-form surfaces

The curve and surface extensions to the .obj file format were developed in conjunction with mental images GmbH&Co.KG, Berlin, Germany, as part of a joint development project to incorporate free-form surfaces into Wavefront's Advanced Visualizer.

HC File structure


HC / File structure

File structure

HC [image] File structure
Wavefront Object Files (.obj) General statement

File structure

The following types of data may be included in an .obj file. In this list, the keyword (in parentheses) follows the data type.

Vertex data

o geometric vertices (v)

o texture vertices (vt)

o vertex normals (vn)

o parameter space vertices (vp) Free-form curve and surface attributes

o rational or non-rational forms of curve or surface type: basis matrix, Bezier, B-spline, Cardinal, Taylor (cstype)

o degree (deg)

o basis matrix (bmat)

o step size (step)

Elements

o point (p)

o line (l)

o face (f)

o curve (curv)

o 2D curve (curv2)

o surface (surf)

Free-form curve and surface body statements

o parameter values (parm)

o outer trimming loop (trim)

o inner trimming loop (hole)

o special curve (scrv)

o special point (sp)

o end statement (end)

Connectivity between free-form surfaces

o connect (con)

Grouping

o group name (g)

o smoothing group (s)

o merging group (mg)

o object name (o)

Display/render attributes

o bevel interpolation (bevel)

o color interpolation (c_interp)

o dissolve interpolation (d_interp)

o level of detail (lod)

o material name (usemtl)

o material library (mtllib)

o shadow casting (shadow_obj)

o ray tracing (trace_obj)

o curve approximation technique (ctech)

o surface approximation technique (stech)

The following diagram shows how these parts fit together in a typical .obj file.

Figure B1-1. Typical .obj file structure

Reference:

    Wavefront Object Files (.obj)

Wavefront Object Files (.obj) General statement


HC / General statement

General statement

HC [image] General statement
File structure call

General statement

General statement

  • call
  • csh

Reference:

    Wavefront Object Files (.obj)

File structure call


HC / General statement / call

call

HC [image] General statement [image] call
General statement csh

call filename.ext arg1 arg2 ...

Reads the contents of the specified .obj or .mod file at this location. The call statement can be inserted into .obj files using a text editor.

filename.ext is the name of the .obj or .mod file to be read. You must include the extension with the filename.

arg1 arg2 . . . specifies a series of optional integer arguments that are passed to the called file. There is no limit to the number of nested calls that can be made.

Arguments passed to the called file are substituted in the same way as in UNIX scripts; for example, $1 in the called file is replaced by arg1, $2 in the called file is replaced by arg2, and so on.

If the frame number is needed in the called file for variable substitution, "$1" must be used as the first argument in the call statement. For example:

call filename.obj $1

Then the statement in the called file,

scmp filename.pv $1

will work as expected. For more information on the scmp statement, see appendix C, Variable Substitution for more information.

Another method to do the same thing is:

scmp filename.pv $1

call filename.obj

Using this method, the scmp statement provides the .pv file for all subsequently called .obj or .mod files.


HC / General statement / csh

csh

HC [image] General statement [image] csh
call Vertex data

csh command
csh -command

Executes the requested UNIX command. If the UNIX command returns an error, the parser flags an error during parsing.

If a dash (-) precedes the UNIX command, the error is ignored.

command is the UNIX command.


HC / Vertex data

Vertex data

HC [image] Vertex data
csh v

Vertex data

Vertex data provides coordinates for:

o geometric vertices

o texture vertices

o vertex normals

For free-form objects, the vertex data also provides:

o parameter space vertices

The vertex data is represented by four vertex lists; one for each type of vertex coordinate. A right-hand coordinate system is used to specify the coordinate locations.

The following sample is a portion of an .obj file that contains the four types of vertex information.

v      -5.000000       5.000000       0.000000
v      -5.000000      -5.000000       0.000000
v       5.000000      -5.000000       0.000000
v       5.000000       5.000000       0.000000
vt     -5.000000       5.000000       0.000000
vt     -5.000000      -5.000000       0.000000
vt      5.000000      -5.000000       0.000000
vt      5.000000       5.000000       0.000000
vn      0.000000       0.000000       1.000000
vn      0.000000       0.000000       1.000000
vn      0.000000       0.000000       1.000000
vn      0.000000       0.000000       1.000000
vp      0.210000       3.590000
vp      0.000000       0.000000
vp      1.000000       0.000000
vp      0.500000       0.500000

When vertices are loaded into the Advanced Visualizer, they are sequentially numbered, starting with 1. These reference numbers are used in element statements.

Syntax

The following syntax statements are listed in order of complexity.

Vertex data

  • v
  • vp
  • vn
  • vt

References:

    Referencing groups of vertices(2), Referencing vertex data(2), File structure, Wavefront Object Files (.obj)

csh v


HC / Vertex data / v

v

HC [image] Vertex data [image] v
Vertex data vp

v x y z w

Polygonal and free-form geometry statement.

Specifies a geometric vertex and its x y z coordinates. Rational curves and surfaces require a fourth homogeneous coordinate, also called the weight.

x y z are the x, y, and z coordinates for the vertex. These are floating point numbers that define the position of the vertex in three dimensions.

w is the weight required for rational curves and surfaces. It is not required for non-rational curves and surfaces. If you do not specify a value for w, the default is 1.0.

NOTE: A positive weight value is recommended. Using zero or negative values may result in an undefined point in a curve or surface.

Examples:

  • Example Bezier in u direction with B-spline in v direction
  • Example Cubic Bezier surface made with a basis matrix
  • Example Two adjoining squares with a smoothing group
  • Example Two adjoining squares with vertex normals
  • Example Approximation technique for a surface
  • Example Approximation technique for a curve
  • Free-form curve and surface body statements
  • Example Connectivity between two surfaces
  • Example Two trimming regions with a hole
  • Example Trimming with a special curve
  • Cube_with_negative_reference_numbers
  • Example Trimming with special points
  • Example Cube casting a reflection
  • Example Rational B-spline surface
  • Referencing groups of vertices
  • Example Cube casting a shadow
  • Example Cube with group names
  • Example Texture-mapped square
  • Example Trimmed NURB surface
  • Example Cube with materials
  • Example B-spline surface
  • Example Cardinal surface
  • Trimming loops and holes
  • Example Cardinal curve
  • Example Merging group
  • Example Bezier curve
  • Example Bezier patch
  • Example Taylor curve
  • Vertex data
  • Square
  • Cube
  • step

References:

    Example Merging group(34), Example Bezier patch(33), Cube_with_negative_reference_numbers(24), Example Approximation technique for a surface(17), Example B-spline surface(17), Example Cardinal surface(17), Example Trimming with special points(15), Example Approximation technique for a curve(13), Example Bezier curve(13), Example Cardinal curve(12), Example Connectivity between two surfaces(10), Example Rational B-spline surface(10), Example Trimmed NURB surface(10), Example Trimming with a special curve(10), Cube(8), Example Cube casting a reflection(8), Example Cube casting a shadow(8), Example Cube with group names(8), Example Cube with materials(8), Example Two adjoining squares with a smoothing group(6), Example Two adjoining squares with vertex normals(6), General forms(6), Example Taylor curve(5), Example Two trimming regions with a hole(5), Referencing groups of vertices(5), Vertex normals and normal mapping(5), bmat(5), step(5), vp(5), Example Texture-mapped square(4), Square(4), Vertex data(4), parm(4), stech(4), surf(4), vt(4), Texture vertices and texture mapping(3), Example Bezier in u direction with B-spline in v direction(2), B-spline, Basis matrix, Bezier, Cardinal, Example Cubic Bezier surface made with a basis matrix, File structure, Free-form curve and surface body statements, Parameter values and knot vectors, Taylor, Trimming loops and holes, bsp, bzp, cdc, cdp, curv, deg, f, l, p, res

Vertex data vp


HC / Vertex data / vp

vp

HC [image] Vertex data [image] vp
v vn

vp u v w

Free-form geometry statement.

Specifies a point in the parameter space of a curve or surface.

The usage determines how many coordinates are required. Special points for curves require a 1D control point (u only) in the parameter space of the curve. Special points for surfaces require a 2D point (u and v) in the parameter space of the surface. Control points for non-rational trimming curves require u and v coordinates. Control points for rational trimming curves require u, v, and w (weight) coordinates.

u is the point in the parameter space of a curve or the first coordinate in the parameter space of a surface.

v is the second coordinate in the parameter space of a surface.

w is the weight required for rational trimming curves. If you do not specify a value for w, it defaults to 1.0.

NOTE: For additional information on parameter vertices, see the curv2 and sp statements

Examples:

  • Example Connectivity between two surfaces
  • Example Two trimming regions with a hole
  • Example Trimming with a special curve
  • Example Trimming with special points
  • Example Trimmed NURB surface
  • Vertex data

References:

    Example Two trimming regions with a hole(16), Example Trimming with a special curve(10), Example Trimming with special points(10), Example Trimmed NURB surface(6), Special point(6), Example Connectivity between two surfaces(4), Vertex data(4), sp(2), File structure, Special points, curv2

v vn


HC / Vertex data / vn

vn

HC [image] Vertex data [image] vn
vp vt

vn i j k

Polygonal and free-form geometry statement.

Specifies a normal vector with components i, j, and k.

Vertex normals affect the smooth-shading and rendering of geometry. For polygons, vertex normals are used in place of the actual facet normals. For surfaces, vertex normals are interpolated over the entire surface and replace the actual analytic surface normal.

When vertex normals are present, they supersede smoothing groups.

i j k are the i, j, and k coordinates for the vertex normal. They are floating point numbers.

Examples:

  • Example Two adjoining squares with vertex normals
  • Referencing groups of vertices
  • Vertex data

References:

    Example Two adjoining squares with vertex normals(6), Referencing groups of vertices(5), Vertex data(4), f(2), surf(2), File structure, s

vp vt


HC / Vertex data / vt

vt

HC [image] Vertex data [image] vt
vn Specifying free-form curves and surfaces

vt u v w

Vertex statement for both polygonal and free-form geometry.

Specifies a texture vertex and its coordinates. A 1D texture requires only u texture coordinates, a 2D texture requires both u and v texture coordinates, and a 3D texture requires all three coordinates.

u is the value for the horizontal direction of the texture.

v is an optional argument.

v is the value for the vertical direction of the texture. The default is 0.

w is an optional argument.

w is a value for the depth of the texture. The default is 0.

Examples:

  • Example Rational B-spline surface
  • Referencing groups of vertices
  • Example Texture-mapped square
  • Vertex data

References:

    Example Rational B-spline surface(9), Referencing groups of vertices(5), Example Texture-mapped square(4), Vertex data(4), f(2), l(2), surf(2), File structure

vn Specifying free-form curves and surfaces


HC / Specifying free-form curves and surfaces

Specifying free-form curves and surfaces

HC [image] Specifying free-form curves and surfaces
vt Data requirements for curves and surfaces

Specifying free-form curves and surfaces

There are three steps involved in specifying a free-form curve or surface element.

o Specify the type of curve or surface (basis matrix, Bezier, B-spline, Cardinal, or Taylor) using free-form curve/surface attributes.

o Describe the curve or surface with element statements.

o Supply additional information, using free-form curve/surface body statements

The next three sections of this appendix provide detailed information on each of these steps.

References:

    Superseded statements, Wavefront Object Files (.obj)

vt Data requirements for curves and surfaces


HC / Data requirements for curves and surfaces

Data requirements for curves and surfaces

HC [image] Data requirements for curves and surfaces
Specifying free-form curves and surfaces Elements

Data requirements for curves and surfaces

All curves and surfaces require a certain set of data. This consists of the following:

Free-form curve/surface attributes

o All curves and surfaces require type data, which is given with the cstype statement.

o All curves and surfaces require degree data, which is given with the deg statement.

o Basis matrix curves or surfaces require a bmat statement.

o Basis matrix curves or surfaces also require a step size, which is given with the step statement.

Specifying free-form curves and surfaces Elements


HC / Elements

Elements

HC [image] Elements
Data requirements for curves and surfaces Free-form curve and surface body statement

Elements

o All curves and surfaces require control points, which are referenced in the curv, curv2, or surf statements.

o 3D curves and surfaces require a parameter range, which is given in the curv and surf statements, respectively.

Examples:

  • Example Two adjoining squares with a smoothing group
  • Example Two adjoining squares with vertex normals
  • Example Cube casting a reflection
  • Example Cube casting a shadow
  • Example Cube with group names
  • Example Cube with materials

References:

    Grouping(5), s(4), Example Cube with group names(2), Free-form curve and surface attributes(2), lod(2), Display and render attributes, Example Cube casting a reflection, Example Cube casting a shadow, Example Cube with materials, Example Two adjoining squares with a smoothing group, Example Two adjoining squares with vertex normals, File structure, Free-Form Elements, Free-form curve and surface body statements, Parameter values and knot vectors, Referencing groups of vertices, Referencing vertex data, Special curve, Trimming loops and holes, Wavefront Object Files (.obj), bevel, f, g, o

Data requirements for curves and surfaces Free-form curve and surface body statement


HC / Free-form curve and surface body statement

Free-form curve and surface body statement

HC [image] Free-form curve and surface body statement
Elements Free-form curve and surface attributes

Free-form curve and surface body statement

o All curves and surfaces require a set of global parameters or a knot vector, both of which are given with the parm statement.

o All curves and surfaces body statements require an explicit end statement.

Error checks

The above set of data starts out empty with no default values when reading of an .obj file begins. While the file is being read, statements are encountered, information is accumulated, and some errors may be reported.

When the end statement is encountered, the following error checks, which involve consistency between various statements, are performed:

o All required information is present.

o The number of control points, number of parameter values (knots), and degree are consistent with the curve or surface type. If the type is bmatrix, the step size is also consistent. (For more information, refer to the parameter vector equations in the section, "Mathematics of free-form curves/ surfaces" at the end of appendix B1.)

o If the type is bmatrix and the degree is n, the size of the basis matrix is (n + 1) x (n + 1).

Note that any information given by the state-setting statements remains in effect from one curve or surface to the next. Information given within a curve or surface body is only effective for the curve or surface it is given with.

Free-form curve and surface body statement

  • Free-form curve and surface attributes
  • Example Cubic Bezier surface made with a basis matrix
  • Example Hermite curve made with a basis matrix
  • Example Bezier in u direction with B-spline in v direction
  • Free-Form Elements
  • Referencing vertex data
  • Referencing groups of vertices
  • Examples for polygonal geometry


HC / Free-form curve and surface body statement / Free-form curve and surface attributes

Free-form curve and surface attributes

HC [image] Free-form curve and surface body statement [image] Free-form curve and surface attributes
Free-form curve and surface body statement cstype

Free-form curve and surface attributes

Five types of free-form geometry are available in the .obj file format:

o Bezier

o basis matrix

o B-spline

o Cardinal

o Taylor

You can apply these types only to curves and surfaces. Each of these five types can be rational or non-rational.

In addition to specifying the type, you must define the degree for the curve or surface. For basis matrix curve and surface elements, you must also specify the basis matrix and step size.

All free-form curve and surface attribute statements are state-setting. This means that once an attribute statement is set, it applies to all elements that follow until it is reset to a different value.

Syntax

The following syntax statements are listed in order of use.

Free-form curve and surface attributes

  • cstype
  • deg
  • bmat
  • step

References:

    File structure, Wavefront Object Files (.obj)

Free-form curve and surface body statement cstype


HC / Free-form curve and surface body statement / Free-form curve and surface attributes / cstype

cstype

HC [image] Free-form curve and surface body statement [image] Free-form curve and surface attributes [image] cstype
Free-form curve and surface attributes deg

cstype rat type

Free-form geometry statement.

Specifies the type of curve or surface and indicates a rational or non-rational form.

rat is an optional argument.

rat specifies a rational form for the curve or surface type. If rat is not included, the curve or surface is non-rational

type specifies the curve or surface type. Allowed types are:

bmatrix basis matrix

bezier Bezier

bspline B-spline

cardinal Cardinal

taylor Taylor

There is no default. A value must be supplied.

Examples:

  • Example Bezier in u direction with B-spline in v direction
  • Example Cubic Bezier surface made with a basis matrix
  • Example Hermite curve made with a basis matrix
  • Example Approximation technique for a surface
  • Example Approximation technique for a curve
  • Free-form curve and surface body statements
  • Example Connectivity between two surfaces
  • Example Two trimming regions with a hole
  • Example Trimming with a special curve
  • Example Trimming with special points
  • Example Rational B-spline surface
  • Example Trimmed NURB surface
  • Example B-spline surface
  • Example Cardinal surface
  • Trimming loops and holes
  • Example Cardinal curve
  • Example Merging group
  • Example Bezier curve
  • Example Bezier patch
  • Example Taylor curve

References:

    Example Trimming with special points(3), Example Trimmed NURB surface(2), Example Trimming with a special curve(2), Example Two trimming regions with a hole(2), Data requirements for curves and surfaces, Example Approximation technique for a curve, Example Approximation technique for a surface, Example B-spline surface, Example Bezier curve, Example Bezier in u direction with B-spline in v direction, Example Bezier patch, Example Cardinal curve, Example Cardinal surface, Example Connectivity between two surfaces, Example Cubic Bezier surface made with a basis matrix, Example Hermite curve made with a basis matrix, Example Merging group, Example Rational B-spline surface, Example Taylor curve, File structure, Free-form curve and surface body statements, General forms, Special point, Trimming loops and holes

Free-form curve and surface attributes deg


HC / Free-form curve and surface body statement / Free-form curve and surface attributes / deg

deg

HC [image] Free-form curve and surface body statement [image] Free-form curve and surface attributes [image] deg
cstype bmat

deg degu degv

Free-form geometry statement.

Sets the polynomial degree for curves and surfaces.

degu is the degree in the u direction. It is required for both curves and surfaces.

degv is the degree in the v direction. It is required only for surfaces. For Bezier, B-spline, Taylor, and basis matrix, there is no default; a value must be supplied. For Cardinal, the degree is always 3. If some other value is given for Cardinal, it will be ignored.

Examples:

  • Example Bezier in u direction with B-spline in v direction
  • Example Cubic Bezier surface made with a basis matrix
  • Example Hermite curve made with a basis matrix
  • Example Approximation technique for a surface
  • Example Approximation technique for a curve
  • Free-form curve and surface body statements
  • Example Connectivity between two surfaces
  • Example Two trimming regions with a hole
  • Example Trimming with a special curve
  • Example Trimming with special points
  • Example Rational B-spline surface
  • Example Trimmed NURB surface
  • Example B-spline surface
  • Example Cardinal surface
  • Trimming loops and holes
  • Example Cardinal curve
  • Example Merging group
  • Example Bezier curve
  • Example Bezier patch
  • Example Taylor curve

References:

    Example Trimmed NURB surface(2), Example Trimming with a special curve(2), Example Trimming with special points(2), Example Two trimming regions with a hole(2), Data requirements for curves and surfaces, Example Approximation technique for a curve, Example Approximation technique for a surface, Example B-spline surface, Example Bezier curve, Example Bezier in u direction with B-spline in v direction, Example Bezier patch, Example Cardinal curve, Example Cardinal surface, Example Connectivity between two surfaces, Example Cubic Bezier surface made with a basis matrix, Example Hermite curve made with a basis matrix, Example Merging group, Example Rational B-spline surface, Example Taylor curve, File structure, Free-form curve and surface body statements, Trimming loops and holes, bmat

cstype bmat


HC / Free-form curve and surface body statement / Free-form curve and surface attributes / bmat

bmat

HC [image] Free-form curve and surface body statement [image] Free-form curve and surface attributes [image] bmat
deg step

bmat u matrix
bmat v matrix

Free-form geometry statement.

Sets the basis matrices used for basis matrix curves and surfaces. The u and v values must be specified in separate bmat statements.

NOTE: The deg statement must be given before the bmat statements and the size of the matrix must be appropriate for the degree.

u specifies that the basis matrix is applied in the u direction.

v specifies that the basis matrix is applied in the v direction.

matrix lists the contents of the basis matrix with column subscript j varying the fastest. If n is the degree in the given u or v direction, the matrix (i,j) should be of size (n + 1) x (n + 1).

There is no default. A value must be supplied.

NOTE: The arrangement of the matrix is different from that commonly found in other references. For more information, see the examples at the end of this section and also the section, "Mathematics for free-form curves and surfaces."

Examples:

  • Example Bezier in u direction with B-spline in v direction
  • Example Cubic Bezier surface made with a basis matrix
  • Example Hermite curve made with a basis matrix

References:

    Example Bezier in u direction with B-spline in v direction(2), Example Cubic Bezier surface made with a basis matrix(2), Data requirements for curves and surfaces, Example Hermite curve made with a basis matrix, File structure

deg step


HC / Free-form curve and surface body statement / Free-form curve and surface attributes / step

step

HC [image] Free-form curve and surface body statement [image] Free-form curve and surface attributes [image] step
bmat Example Cubic Bezier surface made with a basis matrix

step stepu stepv

Free-form geometry statement.

Sets the step size for curves and surfaces that use a basis matrix.

stepu is the step size in the u direction. It is required for both curves and surfaces that use a basis matrix.

stepv is the step size in the v direction. It is required only for surfaces that use a basis matrix. There is no default. A value must be supplied.

When a curve or surface is being evaluated and a transition from one segment or patch to the next occurs, the set of control points used is incremented by the step size. The appropriate step size depends on the representation type, which is expressed through the basis matrix, and on the degree.

That is, suppose we are given a curve with k control points:
{v , ... v }
  1       k

If the curve is of degree n, then n + 1 control points are needed for each polynomial segment. If the step size is given as s, then the ith polynomial segment, where i = 0 is the first segment, will use the control points:
{v    ,...,v      }
  is+1      is+n+1

For example, for Bezier curves, s = n .

For surfaces, the above description applies independently to each parametric direction.

When you create a file which uses the basis matrix type, be sure to specify a step size appropriate for the current curve or surface representation.

Examples:

  • Example Bezier in u direction with B-spline in v direction
  • Example Cubic Bezier surface made with a basis matrix
  • Example Hermite curve made with a basis matrix

References:

    Basis matrix(2), Data requirements for curves and surfaces(2), File structure(2), Example Bezier in u direction with B-spline in v direction, Example Cubic Bezier surface made with a basis matrix, Example Hermite curve made with a basis matrix, Free-form curve and surface attributes, Free-form curve and surface body statement

bmat Example Cubic Bezier surface made with a basis matrix


HC / Free-form curve and surface body statement / Example Cubic Bezier surface made with a basis matrix

Example Cubic Bezier surface made with a basis matrix

HC [image] Free-form curve and surface body statement [image] Example Cubic Bezier surface made with a basis matrix
step Example Hermite curve made with a basis matrix

Example Cubic Bezier surface made with a basis matrix

To create a cubic Bezier surface:

cstype bmatrix
deg 3 3
step 3 3
bmat u  1       -3      3       -1      \
    0       3       -6      3       \
    0       0       3       -3      \
    0       0       0       1
bmat v  1       -3      3       -1      \
    0       3       -6      3       \
    0       0       3       -3      \
    0       0       0       1


HC / Free-form curve and surface body statement / Example Hermite curve made with a basis matrix

Example Hermite curve made with a basis matrix

HC [image] Free-form curve and surface body statement [image] Example Hermite curve made with a basis matrix
Example Cubic Bezier surface made with a basis matrix Example Bezier in u direction with B-spline in v direction

Example Hermite curve made with a basis matrix

To create a Hermite curve:

cstype bmatrix
deg 3
step 2
bmat u  1     0     -3      2      0       0       3      -2 \
    0     1     -2      1      0       0      -1       1


HC / Free-form curve and surface body statement / Example Bezier in u direction with B-spline in v direction

Example Bezier in u direction with B-spline in v direction

HC [image] Free-form curve and surface body statement [image] Example Bezier in u direction with B-spline in v direction
Example Hermite curve made with a basis matrix Free-Form Elements

Example Bezier in u direction with B-spline in v direction

made with a basis matrix

To create a surface with a cubic Bezier in the u direction and cubic uniform B-spline in the v direction:

cstype bmatrix
deg 3 3
step 3 1
bmat u  1      -3       3      -1 \
    0       3      -6       3 \
    0       0       3      -3 \
    0       0       0       1
bmat v  0.16666 -0.50000  0.50000 -0.16666 \
    0.66666  0.00000 -1.00000  0.50000 \
    0.16666  0.50000  0.50000 -0.50000 \
    0.00000  0.00000  0.00000  0.16666


HC / Free-form curve and surface body statement / Free-Form Elements

Free-Form Elements

HC [image] Free-form curve and surface body statement [image] Free-Form Elements
Example Bezier in u direction with B-spline in v direction Referencing vertex data

Free-Form Elements

For polygonal geometry, the element types available in the .obj file are:

o points

o lines

o faces

For free-form geometry, the element types available in the .obj file are:

o curve

o 2D curve on a surface

o surface

All elements can be freely intermixed in the file.

Reference:

    Grouping

Example Bezier in u direction with B-spline in v direction Referencing vertex data


HC / Free-form curve and surface body statement / Referencing vertex data

Referencing vertex data

HC [image] Free-form curve and surface body statement [image] Referencing vertex data
Free-Form Elements Referencing groups of vertices

Referencing vertex data

For all elements, reference numbers are used to identify geometric vertices, texture vertices, vertex normals, and parameter space vertices.

Each of these types of vertices is numbered separately, starting with 1. This means that the first geometric vertex in the file is 1, the second is 2, and so on. The first texture vertex in the file is 1, the second is 2, and so on. The numbering continues sequentially throughout the entire file. Frequently, files have multiple lists of vertex data. This numbering sequence continues even when vertex data is separated by other data.

In addition to counting vertices down from the top of the first list in the file, you can also count vertices back up the list from an element's position in the file. When you count up the list from an element, the reference numbers are negative. A reference number of -1 indicates the vertex immediately above the element. A reference number of -2 indicates two references above and so on.

Free-Form Elements Referencing groups of vertices


HC / Free-form curve and surface body statement / Referencing groups of vertices

Referencing groups of vertices

HC [image] Free-form curve and surface body statement [image] Referencing groups of vertices
Referencing vertex data p

Referencing groups of vertices

Some elements, such as faces and surfaces, may have a triplet of numbers that reference vertex data.These numbers are the reference numbers for a geometric vertex, a texture vertex, and a vertex normal.

Each triplet of numbers specifies a geometric vertex, texture vertex, and vertex normal. The reference numbers must be in order and must separated by slashes (/).

o The first reference number is the geometric vertex.

o The second reference number is the texture vertex. It follows the first slash.

o The third reference number is the vertex normal. It follows the second slash.

There is no space between numbers and the slashes. There may be more than one series of geometric vertex/texture vertex/vertex normal numbers on a line.

The following is a portion of a sample file for a four-sided face element:

f 1/1/1 2/2/2 3/3/3 4/4/4

Using v, vt, and vn to represent geometric vertices, texture vertices, and vertex normals, the statement would read:

f v/vt/vn v/vt/vn v/vt/vn v/vt/vn

If there are only vertices and vertex normals for a face element (no texture vertices), you would enter two slashes (//). For example, to specify only the vertex and vertex normal reference numbers, you would enter:

f 1//1 2//2 3//3 4//4

When you are using a series of triplets, you must be consistent in the way you reference the vertex data. For example, it is illegal to give vertex normals for some vertices, but not all.

The following is an example of an illegal statement.

f 1/1/1 2/2/2 3//3 4//4

Syntax

The following syntax statements are listed in order of complexity of geometry.

Referencing groups of vertices

  • p
  • l
  • f
  • curv
  • curv2
  • surf


HC / Free-form curve and surface body statement / Referencing groups of vertices / p

p

HC [image] Free-form curve and surface body statement [image] Referencing groups of vertices [image] p
Referencing groups of vertices l

p v1 v2 v3 ...

Polygonal geometry statement.

Specifies a point element and its vertex. You can specify multiple points with this statement. Although points cannot be shaded or rendered, they are used by other Advanced Visualizer programs.

v is the vertex reference number for a point element. Each point element requires one vertex. Positive values indicate absolute vertex numbers. Negative values indicate relative vertex numbers.

References:

    File structure, General forms, Special curves, parm

Referencing groups of vertices l


HC / Free-form curve and surface body statement / Referencing groups of vertices / l

l

HC [image] Free-form curve and surface body statement [image] Referencing groups of vertices [image] l
p f

l v1/vt1 v2/vt2 v3/vt3 ...

Polygonal geometry statement.

Specifies a line and its vertex reference numbers. You can optionally include the texture vertex reference numbers. Although lines cannot be shaded or rendered, they are used by other Advanced Visualizer programs.

The reference numbers for the vertices and texture vertices must be separated by a slash (/). There is no space between the number and the slash.

v is a reference number for a vertex on the line. A minimum of two vertex numbers are required. There is no limit on the maximum. Positive values indicate absolute vertex numbers. Negative values indicate relative vertex numbers.

vt is an optional argument.

vt is the reference number for a texture vertex in the line element. It must always follow the first slash.

Reference:

    File structure

p f


HC / Free-form curve and surface body statement / Referencing groups of vertices / f

f

HC [image] Free-form curve and surface body statement [image] Referencing groups of vertices [image] f
l curv

f v1/vt1/vn1 v2/vt2/vn2 v3/vt3/vn3 ...

Polygonal geometry statement.

Specifies a face element and its vertex reference number. You can optionally include the texture vertex and vertex normal reference numbers.

The reference numbers for the vertices, texture vertices, and vertex normals must be separated by slashes (/). There is no space between the number and the slash.

v is the reference number for a vertex in the face element. A minimum of three vertices are required.

vt is an optional argument.

vt is the reference number for a texture vertex in the face element. It always follows the first slash.

vn is an optional argument.

vn is the reference number for a vertex normal in the face element. It must always follow the second slash.

Face elements use surface normals to indicate their orientation. If vertices are ordered counterclockwise around the face, both the face and the normal will point toward the viewer. If the vertex ordering is clockwise, both will point away from the viewer. If vertex normals are assigned, they should point in the general direction of the surface normal, otherwise unpredictable results may occur.

If a face has a texture map assigned to it and no texture vertices are assigned in the f statement, the texture map is ignored when the element is rendered.

NOTE: Any references to fo (face outline) are no longer valid as of version 2.11. You can use f (face) to get the same results. References to fo in existing .obj files will still be read, however, they will be written out as f when the file is saved.

Examples:

  • Example Two adjoining squares with a smoothing group
  • Example Two adjoining squares with vertex normals
  • Cube_with_negative_reference_numbers
  • Example Cube casting a reflection
  • Referencing groups of vertices
  • Display and render attributes
  • Example Cube casting a shadow
  • Example Cube with group names
  • Example Texture-mapped square
  • Example Cube with materials
  • Grouping
  • Square
  • Cube

References:

    Cube(6), Cube_with_negative_reference_numbers(6), Example Cube casting a reflection(6), Example Cube casting a shadow(6), Example Cube with group names(6), Example Cube with materials(6), Referencing groups of vertices(4), Example Two adjoining squares with a smoothing group(2), Example Two adjoining squares with vertex normals(2), Display and render attributes, Example Texture-mapped square, File structure, Grouping, Square

l curv


HC / Free-form curve and surface body statement / Referencing groups of vertices / curv

curv

HC [image] Free-form curve and surface body statement [image] Referencing groups of vertices [image] curv
f curv2

curv u0 u1 v1 v2 ...

Element statement for free-form geometry.

Specifies a curve, its parameter range, and its control vertices. Although curves cannot be shaded or rendered, they are used by other Advanced Visualizer programs.

u0 is the starting parameter value for the curve. This is a floating point number.

u1 is the ending parameter value for the curve. This is a floating point number.

v is the vertex reference number for a control point. You can specify multiple control points. A minimum of two control points are required for a curve.

For a non-rational curve, the control points must be 3D. For a rational curve, the control points are 3D or 4D. The fourth coordinate (weight) defaults to 1.0 if omitted.

Examples:

  • Example Approximation technique for a surface
  • Example Approximation technique for a curve
  • Example Trimming with special points
  • Example B-spline surface
  • Example Cardinal curve
  • Example Bezier curve
  • Example Taylor curve
  • ctech
  • stech

References:

    Elements(2), Example Approximation technique for a curve, Example Approximation technique for a surface, Example B-spline surface, Example Bezier curve, Example Cardinal curve, Example Taylor curve, Example Trimming with special points, File structure, Free-form curve and surface body statements, ctech, end, stech

f curv2


HC / Free-form curve and surface body statement / Referencing groups of vertices / curv2

curv2

HC [image] Free-form curve and surface body statement [image] Referencing groups of vertices [image] curv2
curv surf

curv2 vp1 vp2 vp3 ...

Free-form geometry statement.

Specifies a 2D curve on a surface and its control points. A 2D curve is used as an outer or inner trimming curve, as a special curve, or for connectivity.

vp is the parameter vertex reference number for the control point. You can specify multiple control points. A minimum of two control points is required for a 2D curve.

The control points are parameter vertices because the curve must lie in the parameter space of some surface. For a non-rational curve, the control vertices can be 2D. For a rational curve, the control vertices can be 2D or 3D. The third coordinate (weight) defaults to 1.0 if omitted.

Examples:

  • Example Connectivity between two surfaces
  • Example Two trimming regions with a hole
  • Example Trimming with a special curve
  • Example Trimming with special points
  • Example Trimmed NURB surface

References:

    Example Two trimming regions with a hole(4), Connectivity between free-form surfaces(2), Example Trimming with a special curve(2), Elements, Example Connectivity between two surfaces, Example Trimmed NURB surface, Example Trimming with special points, File structure, Free-form curve and surface body statements, Special point, ctech, end, hole, scrv, trim, vp

curv surf


HC / Free-form curve and surface body statement / Referencing groups of vertices / surf

surf

HC [image] Free-form curve and surface body statement [image] Referencing groups of vertices [image] surf
curv2 Examples for polygonal geometry

surf s0 s1 t0 t1 v1/vt1/vn1 v2/vt2/vn2 ...

Element statement for free-form geometry.

Specifies a surface, its parameter range, and its control vertices. The surface is evaluated within the global parameter range from s0 to s1 in the u direction and t0 to t1 in the v direction.

s0 is the starting parameter value for the surface in the u direction.

s1 is the ending parameter value for the surface in the u direction.

t0 is the starting parameter value for the surface in the v direction.

t1 is the ending parameter value for the surface in the v direction.

v is the reference number for a control vertex in the surface.

vt is an optional argument.

vt is the reference number for a texture vertex in the surface. It must always follow the first slash.

vn is an optional argument.

vn is the reference number for a vertex normal in the surface. It must always follow the second slash.

For a non-rational surface, the control vertices are 3D. For a rational surface the control vertices can be 3D or 4D. The fourth coordinate (weight) defaults to 1.0 if ommitted.

NOTE: For more information on the ordering of control points for survaces, refer to the section on surfaces and control points in "mathematics of free-form curves/surfaces" at the end of this appendix.

Examples:

  • Example Approximation technique for a surface
  • Free-form curve and surface body statements
  • Example Connectivity between two surfaces
  • Example Two trimming regions with a hole
  • Example Trimming with a special curve
  • Example Trimming with special points
  • Example Rational B-spline surface
  • Example Trimmed NURB surface
  • Example Cardinal surface
  • Trimming loops and holes
  • Example Merging group
  • Example Bezier patch
  • Grouping

References:

    Elements(2), Example Connectivity between two surfaces(2), Example Merging group(2), Free-form curve and surface body statements(2), Grouping(2), Control points, Example Approximation technique for a surface, Example Bezier patch, Example Cardinal surface, Example Rational B-spline surface, Example Trimmed NURB surface, Example Trimming with a special curve, Example Trimming with special points, Example Two trimming regions with a hole, File structure, Trimming loops and holes, end

curv2 Examples for polygonal geometry


HC / Free-form curve and surface body statement / Examples for polygonal geometry

Examples for polygonal geometry

HC [image] Free-form curve and surface body statement [image] Examples for polygonal geometry
surf Square

Examples for polygonal geometry

For examples using free-form geometry, see the examples at the end of the next section, "Free-form curve/surface body statements."

Examples for polygonal geometry

  • Square
  • Cube
  • Cube_with_negative_reference_numbers


HC / Free-form curve and surface body statement / Examples for polygonal geometry / Square

Square

HC [image] Free-form curve and surface body statement [image] Examples for polygonal geometry [image] Square
Examples for polygonal geometry Cube

Square

This example shows a square that measures two units on each side and faces in the positive direction (toward the camera). Note that the ordering of the vertices is counterclockwise. This ordering determines that the square is facing forward.

v 0.000000 2.000000 0.000000
v 0.000000 0.000000 0.000000
v 2.000000 0.000000 0.000000
v 2.000000 2.000000 0.000000
f 1 2 3 4

Example:

  • Grouping

References:

    Example Texture-mapped square(3), Example Two adjoining squares with vertex normals, Grouping

Examples for polygonal geometry Cube


HC / Free-form curve and surface body statement / Examples for polygonal geometry / Cube

Cube

HC [image] Free-form curve and surface body statement [image] Examples for polygonal geometry [image] Cube
Square Cube_with_negative_reference_numbers

Cube

This is a cube that measures two units on each side. Each vertex is shared by three different faces.

v 0.000000 2.000000 2.000000
v 0.000000 0.000000 2.000000
v 2.000000 0.000000 2.000000
v 2.000000 2.000000 2.000000
v 0.000000 2.000000 0.000000
v 0.000000 0.000000 0.000000
v 2.000000 0.000000 0.000000
v 2.000000 2.000000 0.000000
f 1 2 3 4
f 8 7 6 5
f 4 3 7 8
f 5 1 4 8
f 5 6 2 1
f 2 6 7 3

Examples:

  • Example Cube casting a reflection
  • Example Cube casting a shadow
  • Example Cube with group names

References:

    Example Cube with group names(8), Example Cube casting a reflection(4), Example Cube casting a shadow(4), Cube_with_negative_reference_numbers, Example Cube with materials

Square Cube_with_negative_reference_numbers


HC / Free-form curve and surface body statement / Examples for polygonal geometry / Cube_with_negative_reference_numbers

Cube_with_negative_reference_numbers

HC [image] Free-form curve and surface body statement [image] Examples for polygonal geometry [image] Cube_with_negative_reference_numbers
Cube Free-form curve and surface body statements

Cube_with_negative_reference_numbers

This is a cube with negative vertex reference numbers. Each element references the vertices stored immediately above it in the file. Note that vertices are not shared.

v 0.000000 2.000000 2.000000
v 0.000000 0.000000 2.000000
v 2.000000 0.000000 2.000000
v 2.000000 2.000000 2.000000
f -4 -3 -2 -1

v 2.000000 2.000000 0.000000
v 2.000000 0.000000 0.000000
v 0.000000 0.000000 0.000000
v 0.000000 2.000000 0.000000
f -4 -3 -2 -1

v 2.000000 2.000000 2.000000
v 2.000000 0.000000 2.000000
v 2.000000 0.000000 0.000000
v 2.000000 2.000000 0.000000
f -4 -3 -2 -1

v 0.000000 2.000000 0.000000
v 0.000000 2.000000 2.000000
v 2.000000 2.000000 2.000000
v 2.000000 2.000000 0.000000
f -4 -3 -2 -1

v 0.000000 2.000000 0.000000
v 0.000000 0.000000 0.000000
v 0.000000 0.000000 2.000000
v 0.000000 2.000000 2.000000
f -4 -3 -2 -1

v 0.000000 0.000000 2.000000
v 0.000000 0.000000 0.000000
v 2.000000 0.000000 0.000000
v 2.000000 0.000000 2.000000
f -4 -3 -2 -1


HC / Free-form curve and surface body statements

Free-form curve and surface body statements

HC [image] Free-form curve and surface body statements
Cube_with_negative_reference_numbers Parameter values and knot vectors

Free-form curve and surface body statements

You can specify additional information for free-form curve and surface elements using a series of statements called body statements. The series is concluded by an end statement.

Body statements are valid only when they appear between the free-form element statement (curv, curv2, surf) and the end statement. If they are anywhere else in the .obj file, they do not have any effect.

You can use body statements to specify the following values:

o parameter

o knot vector

o trimming loop

o hole

o special curve

o special point

You cannot use any other statements between the free-form curve or surface statement and the end statement. Using any other of type of statement may cause unpredictable results.

This portion of a sample file shows the knot vector values for a rational B-spline surface with a trimming loop. Notice the end statement to conclude the body statements.

cstype rat bspline
deg 2 2
surf -1.0 2.5 -2.0 2.0 -9 -8 -7 -6 -5 -4 -3 -2 -1
parm u -1.00 -1.00 -1.00 2.50 2.50 2.50
parm v -2.00 -2.00 -2.00 -2.00 -2.00 -2.00
trim 0.0 2.0 1
end

Free-form curve and surface body statements

  • Parameter values and knot vectors
  • Trimming loops and holes
  • Special curve
  • Special point
  • Example Taylor curve
  • Example Bezier curve
  • Example B-spline surface
  • Example Cardinal surface
  • Example Rational B-spline surface
  • Example Trimmed NURB surface
  • Example Two trimming regions with a hole
  • Example Trimming with a special curve
  • Example Trimming with special points

References:

    File structure, Wavefront Object Files (.obj)

Cube_with_negative_reference_numbers Parameter values and knot vectors


HC / Free-form curve and surface body statements / Parameter values and knot vectors

Parameter values and knot vectors

HC [image] Free-form curve and surface body statements [image] Parameter values and knot vectors
Free-form curve and surface body statements Trimming loops and holes

Parameter values and knot vectors

All curve and surface elements require a set of parameter values.

For polynomial curves and surfaces, this specifies global parameter values. For B-spline curves and surfaces, this specifies the knot vectors.

For surfaces, the parameter values must be specified for both the u and v directions. For curves, the parameter values must be specified for only the u direction.

If multiple parameter value statements for the same parametric direction are used inside a single curve or surface body, the last statement is used.

Free-form curve and surface body statements Trimming loops and holes


HC / Free-form curve and surface body statements / Trimming loops and holes

Trimming loops and holes

HC [image] Free-form curve and surface body statements [image] Trimming loops and holes
Parameter values and knot vectors Special curve

Trimming loops and holes

The trimming loop statement builds a single outer trimming loop as a sequence of curves which lie on a given surface.

The hole statement builds a single inner trimming loop as a sequence of curves which lie on a given surface. The inner loop creates a hole.

The curves are referenced by number in the same way vertices are referenced by face elements.

The individual curves must lie end-to-end to form a closed loop which does not intersect itself and which lies within the parameter range specified for the surface. The loop as a whole may be oriented in either direction (clockwise or counterclockwise).

To cut one or more holes in a region, use a trim statement followed by one or more hole statements. To introduce another trimmed region in the same surface, use another trim statement followed by one or more hole statements. The ordering that associates holes and the regions they cut is important and must be maintained.

If the first trim statement in the sequence is omitted, the enclosing outer trimming loop is taken to be the parameter range of the surface. If no trim or hole statements are specified, then the surface is trimmed at its parameter range.

This portion of a sample file shows a non-rational Bezier surface with two regions, each with a single hole:

cstype bezier
deg 1 1
surf 0.0 2.0 0.0 2.0 1 2 3 4
parm u 0.00 2.00
parm v 0.00 2.00
trim 0.0 4.0 1
hole 0.0 4.0 2
trim 0.0 4.0 3
hole 0.0 4.0 4
end


HC / Free-form curve and surface body statements / Special curve

Special curve

HC [image] Free-form curve and surface body statements [image] Special curve
Trimming loops and holes Special point

Special curve

A special curve statement builds a single special curve as a sequence of curves which lie on a given surface.

The curves are referenced by number in the same way vertices are referenced by face elements.

A special curve is guaranteed to be included in any triangulation of the surface. This means that the line formed by approximating the special curve with a sequence of straight line segments will actually appear as a sequence of triangle edges in the final triangulation.

Example:

  • Example Trimming with a special curve

References:

    scrv(4), Example Trimming with a special curve(2), Special curves(2), File structure, Free-form curve and surface body statements, curv2

Trimming loops and holes Special point


HC / Free-form curve and surface body statements / Special point

Special point

HC [image] Free-form curve and surface body statements [image] Special point
Special curve parm

Special point

A special point statement specifies that special geometric points are to be associated with a curve or surface. For space curves and trimming curves, the parameter vertices must be 1D. For surfaces, the parameter vertices must be 2D.

These special points will be included in any linear approximation of the curve or surface.

For space curves, this means that the point corresponding to the given curve parameter is included as one of the vertices in an approximation consisting of a sequence of line segments.

For surfaces, this means that the point corresponding to the given surface parameters is included as a triangle vertex in the triangulation.

For trimming curves, the treatment is slightly different: a special point on a trimming curve is essentially the same as a special point on the surface it trims.

The following portion of a sample files shows special points for a rational Bezier 2D curve on a surface.

vp -0.675 1.850 3.000 vp 0.915 1.930 vp 2.485 0.470 2.000 vp 2.485 -1.030 vp 1.605 -1.890 10.700 vp -0.745 -0.654 0.500 cstype rat bezier curv2 -6 -5 -4 -3 -2 -1 -6 parm u 0.00 1.00 2.00 sp 2 3 end

Syntax

The following syntax statement are listed in order of normal use.

Special point

  • parm
  • trim
  • hole
  • scrv
  • sp
  • end

Example:

  • Example Trimming with special points

References:

    Example Trimming with special points(2), File structure, Free-form curve and surface body statements, Special points, sp

Special curve parm


HC / Free-form curve and surface body statements / Special point / parm

parm

HC [image] Free-form curve and surface body statements [image] Special point [image] parm
Special point trim

parm u p1 p2 p3 ...
parm v p1 p2 p3 ...

Body statement for free-form geometry.

Specifies global parameter values. For B-spline curves and surfaces, this specifies the knot vectors.

u is the u direction for the parameter values.

v is the v direction for the parameter values.

To set u and v values, use separate command lines.

p is the global parameter or knot value. You can specify multiple values. A minimum of two parameter values are required. Parameter values must increase monotonically. The type of surface and the degree dictate the number of values required.

Examples:

  • Example Approximation technique for a surface
  • Example Approximation technique for a curve
  • Free-form curve and surface body statements
  • Example Connectivity between two surfaces
  • Example Two trimming regions with a hole
  • Example Trimming with a special curve
  • Example Trimming with special points
  • Example Rational B-spline surface
  • Example Trimmed NURB surface
  • Example B-spline surface
  • Example Cardinal surface
  • Trimming loops and holes
  • Example Cardinal curve
  • Example Merging group
  • Example Bezier curve
  • Example Bezier patch
  • Example Taylor curve

References:

    Example Two trimming regions with a hole(6), Example Connectivity between two surfaces(5), Example Merging group(4), Example Trimming with a special curve(4), Example Trimming with special points(4), Example Trimmed NURB surface(3), Example Approximation technique for a surface(2), Example B-spline surface(2), Example Bezier patch(2), Example Cardinal surface(2), Example Rational B-spline surface(2), Free-form curve and surface body statements(2), General forms(2), Trimming loops and holes(2), B-spline, Basis matrix, Bezier, Cardinal, Example Approximation technique for a curve, Example Bezier curve, Example Cardinal curve, Example Taylor curve, File structure, Free-form curve and surface body statement, Special point, Taylor

Special point trim


HC / Free-form curve and surface body statements / Special point / trim

trim

HC [image] Free-form curve and surface body statements [image] Special point [image] trim
parm hole

trim u0 u1 curv2d u0 u1 curv2d ...

Body statement for free-form geometry.

Specifies a sequence of curves to build a single outer trimming loop.

u0 is the starting parameter value for the trimming curve curv2d.

u1 is the ending parameter value for the trimming curve curv2d.

curv2d is the index of the trimming curve lying in the parameter space of the surface. This curve must have been previously defined with the curv2 statement.

Examples:

  • Free-form curve and surface body statements
  • Example Connectivity between two surfaces
  • Example Two trimming regions with a hole
  • Example Trimming with a special curve
  • Example Trimming with special points
  • Example Trimmed NURB surface
  • Trimming loops and holes

References:

    Trimming loops and holes(6), Example Connectivity between two surfaces(2), Example Two trimming regions with a hole(2), Example Trimmed NURB surface, Example Trimming with a special curve, Example Trimming with special points, File structure, Free-form curve and surface body statements

parm hole


HC / Free-form curve and surface body statements / Special point / hole

hole

HC [image] Free-form curve and surface body statements [image] Special point [image] hole
trim scrv

hole u0 u1 curv2d u0 u1 curv2d ...

Body statement for free-form geometry.

Specifies a sequence of curves to build a single inner trimming loop (hole).

u0 is the starting parameter value for the trimming curve curv2d.

u1 is the ending parameter value for the trimming curve curv2d.

curv2d is the index of the trimming curve lying in the parameter space of the surface. This curve must have been previously defined with the curv2 statement.

Examples:

  • Example Two trimming regions with a hole
  • Trimming loops and holes

References:

    Trimming loops and holes(8), Example Two trimming regions with a hole(5), File structure, Free-form curve and surface body statements, ctech

trim scrv


HC / Free-form curve and surface body statements / Special point / scrv

scrv

HC [image] Free-form curve and surface body statements [image] Special point [image] scrv
hole sp

scrv u0 u1 curv2d u0 u1 curv2d ...

Body statement for free-form geometry.

Specifies a sequence of curves which lie on the given surface to build a single special curve.

u0 is the starting parameter value for the special curve curv2d.

u1 is the ending parameter value for the special curve curv2d.

curv2d is the index of the special curve lying in the parameter space of the surface. This curve must have been previously defined with the curv2 statement.

Example:

  • Example Trimming with a special curve

References:

    Example Trimming with a special curve, File structure

hole sp


HC / Free-form curve and surface body statements / Special point / sp

sp

HC [image] Free-form curve and surface body statements [image] Special point [image] sp
scrv end

sp vp1 vp ...

Body statement for free-form geometry.

Specifies special geometric points to be associated with a curve or surface. For space curves and trimming curves, the parameter vertices must be 1D. For surfaces, the parameter vertices must be 2D.

vp is the reference number for the parameter vertex of a special point to be associated with the parameter space point of the curve or surface.

Example:

  • Example Trimming with special points

References:

    Example Trimming with special points(3), File structure, Special point, vp

scrv end


HC / Free-form curve and surface body statements / Special point / end

end

HC [image] Free-form curve and surface body statements [image] Special point [image] end
sp Example Taylor curve

end

Body statement for free-form geometry.

Specifies the end of a curve or surface body begun by a curv, curv2, or surf statement.

Examples:

  • Example Approximation technique for a surface
  • Example Approximation technique for a curve
  • Free-form curve and surface body statements
  • Example Connectivity between two surfaces
  • Example Two trimming regions with a hole
  • Example Trimming with a special curve
  • Example Trimming with special points
  • Example Rational B-spline surface
  • Example Trimmed NURB surface
  • Example B-spline surface
  • Example Cardinal surface
  • Trimming loops and holes
  • Example Cardinal curve
  • Example Merging group
  • Example Bezier curve
  • Example Bezier patch
  • Example Taylor curve

References:

    Example Two trimming regions with a hole(5), Free-form curve and surface body statements(5), Example Connectivity between two surfaces(3), Example Trimming with a special curve(3), Example Trimming with special points(3), Free-form curve and surface body statement(3), Trimming loops and holes(3), Example Merging group(2), Example Trimmed NURB surface(2), File structure(2), Wavefront Object Files (.obj)(2), Example Approximation technique for a curve, Example Approximation technique for a surface, Example B-spline surface, Example Bezier curve, Example Bezier patch, Example Cardinal curve, Example Cardinal surface, Example Rational B-spline surface, Example Taylor curve, Examples for polygonal geometry, Special point, bmat, surf

sp Example Taylor curve


HC / Free-form curve and surface body statements / Example Taylor curve

Example Taylor curve

HC [image] Free-form curve and surface body statements [image] Example Taylor curve
end Example Bezier curve

Example Taylor curve

For creating a single-segment Taylor polynomial curve of the form:

                               2         3         4
x =  3.00 +  2.30t +  7.98t  +  8.30t  +  6.34t

                               2         3         4
y =  1.00 - 10.10t +  5.40t  -  4.70t  +  2.03t

                               2         3         4
z = -2.50 +  0.50t -  7.00t  + 18.10t  +  0.08t

and evaluated between the global parameters 0.5 and 1.6:

v       3.000    1.000   -2.500
v       2.300  -10.100    0.500
v       7.980    5.400   -7.000
v       8.300   -4.700   18.100
v       6.340    2.030    0.080
cstype taylor
deg 4
curv 0.500 1.600 1 2 3 4 5
parm u 0.000 2.000
end


HC / Free-form curve and surface body statements / Example Bezier curve

Example Bezier curve

HC [image] Free-form curve and surface body statements [image] Example Bezier curve
Example Taylor curve Example B-spline surface

Example Bezier curve

This example shows a non-rational Bezier curve with 13 control points.

v -2.300000 1.950000 0.000000
v -2.200000 0.790000 0.000000
v -2.340000 -1.510000 0.000000
v -1.530000 -1.490000 0.000000
v -0.720000 -1.470000 0.000000
v -0.780000 0.230000 0.000000
v 0.070000 0.250000 0.000000
v 0.920000 0.270000 0.000000
v 0.800000 -1.610000 0.000000
v 1.620000 -1.590000 0.000000
v 2.440000 -1.570000 0.000000
v 2.690000 0.670000 0.000000
v 2.900000 1.980000 0.000000
# 13 vertices

cstype bezier
ctech cparm 1.000000
deg 3
curv 0.000000 4.000000 1 2 3 4 5 6 7 8 9 10 \
11 12 13
parm u 0.000000 1.000000 2.000000 3.000000  \
4.000000
end
# 1 element


HC / Free-form curve and surface body statements / Example B-spline surface

Example B-spline surface

HC [image] Free-form curve and surface body statements [image] Example B-spline surface
Example Bezier curve Example Cardinal surface

Example B-spline surface

This is an example of a cubic B-spline surface.

g bspatch
v -5.000000 -5.000000 -7.808327
v -5.000000 -1.666667 -7.808327
v -5.000000 1.666667 -7.808327
v -5.000000 5.000000 -7.808327
v -1.666667 -5.000000 -7.808327
v -1.666667 -1.666667 11.977780
v -1.666667 1.666667 11.977780
v -1.666667 5.000000 -7.808327
v 1.666667 -5.000000 -7.808327
v 1.666667 -1.666667 11.977780
v 1.666667 1.666667 11.977780
v 1.666667 5.000000 -7.808327
v 5.000000 -5.000000 -7.808327
v 5.000000 -1.666667 -7.808327
v 5.000000 1.666667 -7.808327
v 5.000000 5.000000 -7.808327
# 16 vertices

cstype bspline
stech curv 0.5 10.000000
deg 3 3
8surf 0.000000 1.000000 0.000000 1.000000 13 14 \ 15 16 9 10 11 12 5 6
7 8 1 2 3 4
parm u -3.000000 -2.000000 -1.000000 0.000000  \
1.000000 2.000000 3.000000 4.000000
parm v -3.000000 -2.000000 -1.000000 0.000000  \
1.000000 2.000000 3.000000 4.000000
end
# 1 element


HC / Free-form curve and surface body statements / Example Cardinal surface

Example Cardinal surface

HC [image] Free-form curve and surface body statements [image] Example Cardinal surface
Example B-spline surface Example Rational B-spline surface

Example Cardinal surface

This example shows a Cardinal surface.

v -5.000000 -5.000000 0.000000
v -5.000000 -1.666667 0.000000
v -5.000000 1.666667 0.000000
v -5.000000 5.000000 0.000000
v -1.666667 -5.000000 0.000000
v -1.666667 -1.666667 0.000000
v -1.666667 1.666667 0.000000
v -1.666667 5.000000 0.000000
v 1.666667 -5.000000 0.000000
v 1.666667 -1.666667 0.000000
v 1.666667 1.666667 0.000000
v 1.666667 5.000000 0.000000
v 5.000000 -5.000000 0.000000
v 5.000000 -1.666667 0.000000
v 5.000000 1.666667 0.000000
v 5.000000 5.000000 0.000000
# 16 vertices

cstype cardinal
stech cparma 1.000000 1.000000
deg 3 3
surf 0.000000 1.000000 0.000000 1.000000 13 14 \
15 16 9 10 11 12 5 6 7 8 1 2 3 4
parm u 0.000000 1.000000
parm v 0.000000 1.000000
end
# 1 element


HC / Free-form curve and surface body statements / Example Rational B-spline surface

Example Rational B-spline surface

HC [image] Free-form curve and surface body statements [image] Example Rational B-spline surface
Example Cardinal surface Example Trimmed NURB surface

Example Rational B-spline surface

This example creates a second-degree, rational B-spline surface using open, uniform knot vectors. A texture map is applied to the surface.

v -1.3 -1.0  0.0
v  0.1 -1.0  0.4  7.6
v  1.4 -1.0  0.0  2.3
v -1.4  0.0  0.2
v  0.1  0.0  0.9  0.5
v  1.3  0.0  0.4  1.5
v -1.4  1.0  0.0  2.3
v  0.1  1.0  0.3  6.1
v  1.1  1.0  0.0  3.3
vt 0.0  0.0
vt 0.5  0.0
vt 1.0  0.0
vt 0.0  0.5
vt 0.5  0.5
vt 1.0  0.5
vt 0.0  1.0
vt 0.5  1.0
vt 1.0  1.0
cstype rat bspline
deg 2 2
surf 0.0 1.0 0.0 1.0 1/1 2/2 3/3 4/4 5/5 6/6 \
7/7 8/8 9/9
parm u 0.0 0.0 0.0 1.0 1.0 1.0
parm v 0.0 0.0 0.0 1.0 1.0 1.0
end


HC / Free-form curve and surface body statements / Example Trimmed NURB surface

Example Trimmed NURB surface

HC [image] Free-form curve and surface body statements [image] Example Trimmed NURB surface
Example Rational B-spline surface Example Two trimming regions with a hole

Example Trimmed NURB surface

This is a complete example of a file containing a trimmed NURB surface with negative reference numbers for vertices.

# trimming curve
vp -0.675  1.850  3.000
vp  0.915  1.930
vp  2.485  0.470  2.000
vp  2.485 -1.030
vp  1.605 -1.890 10.700
vp -0.745 -0.654  0.500
cstype rat bezier
deg 3
curv2 -6 -5 -4 -3 -2 -1 -6
parm u 0.00 1.00 2.00
end
# surface
v -1.350 -1.030 0.000
v  0.130 -1.030 0.432 7.600
v  1.480 -1.030 0.000 2.300
v -1.460  0.060 0.201
v  0.120  0.060 0.915 0.500
v  1.380  0.060 0.454 1.500
v -1.480  1.030 0.000 2.300
v  0.120  1.030 0.394 6.100
v  1.170  1.030 0.000 3.300
cstype rat bspline
deg 2 2
surf -1.0 2.5 -2.0 2.0 -9 -8 -7 -6 -5 -4 -3 -2 -1
parm u -1.00 -1.00 -1.00 2.50 2.50 2.50
parm v -2.00 -2.00 -2.00 -2.00 -2.00 -2.00
trim 0.0 2.0 1
end


HC / Free-form curve and surface body statements / Example Two trimming regions with a hole

Example Two trimming regions with a hole

HC [image] Free-form curve and surface body statements [image] Example Two trimming regions with a hole
Example Trimmed NURB surface Example Trimming with a special curve

Example Two trimming regions with a hole

This example shows a Bezier surface with two trimming regions, each with a hole in them.

# outer loop of first region
deg 1
cstype bezier
vp 0.100 0.100
vp 0.900 0.100
vp 0.900 0.900
vp 0.100 0.900
curv2 1 2 3 4 1
parm u 0.00 1.00 2.00 3.00 4.00
end
# hole in first region
vp 0.300 0.300
vp 0.700 0.300
vp 0.700 0.700
vp 0.300 0.700
curv2 5 6 7 8 5
parm u 0.00 1.00 2.00 3.00 4.00
end
# outer loop of second region
vp 1.100 1.100
vp 1.900 1.100
vp 1.900 1.900
vp 1.100 1.900
curv2 9 10 11 12 9
parm u 0.00 1.00 2.00 3.00 4.00
end
# hole in second region
vp 1.300 1.300
vp 1.700 1.300
vp 1.700 1.700
vp 1.300 1.700
curv2 13 14 15 16 13
parm u 0.00 1.00 2.00 3.00 4.00
end
# surface
v 0.000 0.000 0.000
v 1.000 0.000 0.000
v 0.000 1.000 0.000
v 1.000 1.000 0.000
deg 1 1
cstype bezier
surf 0.0 2.0 0.0 2.0 1 2 3 4
parm u 0.00 2.00
parm v 0.00 2.00
trim 0.0 4.0 1
hole 0.0 4.0 2
trim 0.0 4.0 3
hole 0.0 4.0 4
end


HC / Free-form curve and surface body statements / Example Trimming with a special curve

Example Trimming with a special curve

HC [image] Free-form curve and surface body statements [image] Example Trimming with a special curve
Example Two trimming regions with a hole Example Trimming with special points

Example Trimming with a special curve

This example is similar to the trimmed NURB surface example (6), except there is a special curve on the surface. This example uses negative vertex numbers.

# trimming curve
vp -0.675  1.850  3.000
vp  0.915  1.930
vp  2.485  0.470  2.000
vp  2.485 -1.030
vp  1.605 -1.890 10.700
vp -0.745 -0.654  0.500
cstype rat bezier
deg 3
curv2 -6 -5 -4 -3 -2 -1 -6
parm u 0.00 1.00 2.00
end
# special curve
vp -0.185  0.322
vp  0.214  0.818
vp  1.652  0.207
vp  1.652 -0.455
curv2 -4 -3 -2 -1
parm u 2.00 10.00
end
# surface
v -1.350 -1.030 0.000
v  0.130 -1.030 0.432 7.600
v  1.480 -1.030 0.000 2.300
v -1.460  0.060 0.201
v  0.120  0.060 0.915 0.500
v  1.380  0.060 0.454 1.500
v -1.480  1.030 0.000 2.300
v  0.120  1.030 0.394 6.100
v  1.170  1.030 0.000 3.300
cstype rat bspline
deg 2 2
surf -1.0 2.5 -2.0 2.0 -9 -8 -7 -6 -5 -4 -3 -2 -1
parm u -1.00 -1.00 -1.00 2.50 2.50 2.50
parm v -2.00 -2.00 -2.00 2.00 2.00 2.00
trim 0.0 2.0 1
scrv 4.2 9.7 2
end


HC / Free-form curve and surface body statements / Example Trimming with special points

Example Trimming with special points

HC [image] Free-form curve and surface body statements [image] Example Trimming with special points
Example Trimming with a special curve Connectivity between free-form surfaces

Example Trimming with special points

This example extends the trimmed NURB surface example (6) to include special points on both the trimming curve and surface. A space curve with a special point is also included. This example uses negative vertex numbers.

# special point and space curve data
vp 0.500
vp 0.700
vp 1.100
vp 0.200 0.950
v  0.300 1.500 0.100
v  0.000  0.000  0.000
v  1.000  1.000  0.000
v  2.000  1.000  0.000
v  3.000  0.000  0.000
cstype bezier
deg 3
curv 0.2 0.9 -4 -3 -2 -1
sp 1
parm u 0.00 1.00
end
# trimming curve
vp -0.675  1.850  3.000
vp  0.915  1.930
vp  2.485  0.470  2.000
vp  2.485 -1.030
vp  1.605 -1.890 10.700
vp -0.745 -0.654  0.500
cstype rat bezier
curv2 -6 -5 -4 -3 -2 -1 -6
parm u 0.00 1.00 2.00
sp 2 3
end
# surface
v -1.350 -1.030 0.000
v  0.130 -1.030 0.432 7.600
v  1.480 -1.030 0.000 2.300
v -1.460  0.060 0.201
v  0.120  0.060 0.915 0.500
v  1.380  0.060 0.454 1.500
v -1.480  1.030 0.000 2.300
v  0.120  1.030 0.394 6.100
v  1.170  1.030 0.000 3.300
cstype rat bspline
deg 2 2
surf -1.0 2.5 -2.0 2.0 -9 -8 -7 -6 -5 -4 -3 -2 -1
parm u -1.00 -1.00 -1.00 2.50 2.50 2.50
parm v -2.00 -2.00 -2.00 2.00 2.00 2.00
trim 0.0 2.0 1
sp 4
end


HC / Connectivity between free-form surfaces

Connectivity between free-form surfaces

HC [image] Connectivity between free-form surfaces
Example Trimming with special points Example Connectivity between two surfaces

Connectivity between free-form surfaces

Connectivity connects two surfaces along their trimming curves.

The con statement specifies the first surface with its trimming curve and the second surface with its trimming curve. This information is useful for edge merging. Without this surface and curve data, connectivity must be determined numerically at greater expense and with reduced accuracy using the mg statement.

Connectivity between surfaces in different merging groups is ignored. Also, although connectivity which crosses points of C1discontinuity in trimming curves is legal, it is not recommended. Instead, use two connectivity statements which meet at the point of discontinuity.

The two curves and their starting and ending parameters should all map to the same curve and starting and ending points in object space.

Syntax

con surf_1 q0_1 q1_1 curv2d_1 surf_2 q0_2 q1_2 curv2d_2

Free-form geometry statement.

Specifies connectivity between two surfaces.

surf_1 is the index of the first surface.

q0_1 is the starting parameter for the curve referenced by curv2d_1.

q1_1 is the ending parameter for the curve referenced by curv2d_1.

curv2d_1 is the index of a curve on the first surface. This curve must have been previously defined with the curv2 statement.

surf_2 is the index of the second surface.

q0_2 is the starting parameter for the curve referenced by curv2d_2.

q1_2 is the ending parameter for the curve referenced by curv2d_2.

curv2d_2 is the index of a curve on the second surface. This curve must have been previously defined with the curv2 statement.

Connectivity between free-form surfaces

  • Example Connectivity between two surfaces

References:

    File structure, Wavefront Object Files (.obj)

Example Trimming with special points Example Connectivity between two surfaces


HC / Connectivity between free-form surfaces / Example Connectivity between two surfaces

Example Connectivity between two surfaces

HC [image] Connectivity between free-form surfaces [image] Example Connectivity between two surfaces
Connectivity between free-form surfaces Grouping

Example Connectivity between two surfaces

This example shows the connectivity between two surfaces with trimming curves.

cstype bezier
deg 1 1

v 0 0 0
v 1 0 0
v 0 1 0
v 1 1 0

vp 0 0
vp 1 0
vp 1 1
vp 0 1

curv2 1 2 3 4 1
parm u 0.0 1.0 2.0 3.0 4.0
end

surf 0.0 1.0 0.0 1.0 1 2 3 4
parm u 0.0 1.0
parm v 0.0 1.0
trim 0.0 4.0 1
end

v 1 0 0
v 2 0 0
v 1 1 0
v 2 1 0

surf 0.0 1.0 0.0 1.0 5 6 7 8
parm u 0.0 1.0
parm v 0.0 1.0
trim 0.0 4.0 1
end

con 1 2.0 2.0 1 2 4.0 3.0 1


HC / Grouping

Grouping

HC [image] Grouping
Example Connectivity between two surfaces g

Grouping

There are four statements in the .obj file to help you manipulate groups of elements:

o Gropu name statements are used to organize collections of elements and simplify data manipulation for operations in Model.

o Smoothing group statements let you identify elements over which normals are to be interpolated to give those elements a smooth, non-faceted appearance. This is a quick way to specify vertex normals.

o Merging group statements are used to ideneify free-form elements that should be inspected for adjacency detection. You can also use merging groups to exclude surfaces which are close enough to be considered adjacent but should not be merged.

o Object name statements let you assign a name to an entire object in a single file.

All grouping statements are state-setting. This means that once a group statement is set, it alpplies to all elements that follow until the next group statement.

This portion of a sample file shows a single element which belongs to three groups. The smoothing group is turned off.

g square thing all
s off
f 1 2 3 4

This example shows two surfaces in merging group 1 with a merge resolution of 0.5.

mg 1 .5
surf 0.0 1.0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
surf 0.0 1.0 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32

Syntax

Grouping

  • g
  • s
  • mg
  • o
  • Example Cube with group names
  • Example Two adjoining squares with a smoothing group
  • Example Two adjoining squares with vertex normals
  • Example Merging group

References:

    File structure, Wavefront Object Files (.obj)

Example Connectivity between two surfaces g


HC / Grouping / g

g

HC [image] Grouping [image] g
Grouping s

g group_name1 group_name2 ...

Polygonal and free-form geometry statement.

Specifies the group name for the elements that follow it. You can have multiple group names. If there are multiple groups on one line, the data that follows belong to all groups. Group information is optional.

group_name is the name for the group. Letters, numbers, and combinations of letters and numbers are accepted for group names. The default group name is default.

Examples:

  • Example Two adjoining squares with a smoothing group
  • Example Two adjoining squares with vertex normals
  • Example Approximation technique for a surface
  • Example Approximation technique for a curve
  • Example Cube casting a reflection
  • Example Cube casting a shadow
  • Example Cube with group names
  • Example Cube with materials
  • Example B-spline surface
  • Grouping

References:

    Example Cube casting a reflection(6), Example Cube casting a shadow(6), Example Cube with group names(6), Example Cube with materials(6), Example Approximation technique for a surface(2), Example Approximation technique for a curve, Example B-spline surface, Example Two adjoining squares with a smoothing group, Example Two adjoining squares with vertex normals, File structure, Grouping

Grouping s


HC / Grouping / s

s

HC [image] Grouping [image] s
g mg

s group_number

Polygonal and free-form geometry statement.

Sets the smoothing group for the elements that follow it. If you do not want to use a smoothing group, specify off or a value of 0.

To display with smooth shading in Model and PreView, you must create vertex normals after you have assigned the smoothing groups. You can create vertex normals with the vn statement or with the Model program.

To smooth polygonal geometry for rendering with Image, it is sufficient to put elements in some smoothing group. However, vertex normals override smoothing information for Image.

group_number is the smoothing group number. To turn off smoothing groups, use a value of 0 or off. Polygonal elements use group numbers to put elements in different smoothing groups. For free-form surfaces, smoothing groups are either turned on or off; there is no difference between values greater than 0.

See also:

  • Texture vertices and texture mapping
  • Vertex normals and normal mapping
  • Special curves

Examples:

  • Example Two adjoining squares with a smoothing group
  • Example Two adjoining squares with vertex normals
  • Display and render attributes
  • Grouping

References:

    Special curves(3), Basis matrix(2), Vertex normals and normal mapping(2), Wavefront Object Files (.obj)(2), step(2), Display and render attributes, Example Two adjoining squares with a smoothing group, Example Two adjoining squares with vertex normals, File structure, Grouping, Referencing vertex data, Texture vertices and texture mapping

g mg


HC / Grouping / mg

mg

HC [image] Grouping [image] mg
s o

mg group_number res

Free-form geometry statement.

Sets the merging group and merge resolution for the free-form surfaces that follow it. If you do not want to use a merging group, specify off or a value of 0.

Adjacency detection is performed only within groups, never between groups. Connectivity between surfaces in different merging groups is not allowed. Surfaces in the same merging group are merged together along edges that are within the distance res apart.

NOTE: Adjacency detection is an expensive numerical comparison process. It is best to restrict this process to as small a domain as possible by using small merging groups.

group_number is the merging group number. To turn off adjacency detection, use a value of 0 or off.

res is the maximum distance between two surfaces that will be merged together. The resolution must be a value greater than 0. This is a required argument only when using merging groups.

Examples:

  • Example Merging group
  • Grouping

References:

    Connectivity between free-form surfaces, Example Merging group, File structure, Grouping

s o


HC / Grouping / o

o

HC [image] Grouping [image] o
mg Example Cube with group names

o object_name

Polygonal and free-form geometry statement.

Optional statement; it is not processed by any Wavefront programs. It specifies a user-defined object name for the elements defined after this statement.

object_name is the user-defined object name. There is no default.

References:

    File structure(36), Wavefront Object Files (.obj)(14), Free-Form Elements(6), Free-form curve and surface body statements(6), Free-form curve and surface attributes(5), Free-form curve and surface body statement(5), Superseded statements(5), Data requirements for curves and surfaces(4), Grouping(4), Vertex data(4), Referencing groups of vertices(3), Specifying free-form curves and surfaces(3), Elements(2)

mg Example Cube with group names


HC / Grouping / Example Cube with group names

Example Cube with group names

HC [image] Grouping [image] Example Cube with group names
o Example Two adjoining squares with a smoothing group

Example Cube with group names

The following example is a cube with each of its faces placed in a separate group. In addition, all elements belong to the group cube.

v 0.000000 2.000000 2.000000
v 0.000000 0.000000 2.000000
v 2.000000 0.000000 2.000000
v 2.000000 2.000000 2.000000
v 0.000000 2.000000 0.000000
v 0.000000 0.000000 0.000000
v 2.000000 0.000000 0.000000
v 2.000000 2.000000 0.000000
# 8 vertices

g front cube
f 1 2 3 4
g back cube
f 8 7 6 5
g right cube
f 4 3 7 8
g top cube
f 5 1 4 8
g left cube
f 5 6 2 1
g bottom cube
f 2 6 7 3
# 6 elements


HC / Grouping / Example Two adjoining squares with a smoothing group

Example Two adjoining squares with a smoothing group

HC [image] Grouping [image] Example Two adjoining squares with a smoothing group
Example Cube with group names Example Two adjoining squares with vertex normals

Example Two adjoining squares with a smoothing group

This example shows two adjoining squares that share a common edge. The squares are placed in a smoothing group to ensure that their common edge will be smoothed when rendered with Image.

v 0.000000 2.000000 0.000000
v 0.000000 0.000000 0.000000
v 2.000000 0.000000 0.000000
v 2.000000 2.000000 0.000000
v 4.000000 0.000000 -1.255298
v 4.000000 2.000000 -1.255298
# 6 vertices

g all
s 1
f 1 2 3 4
f 4 3 5 6
# 2 elements


HC / Grouping / Example Two adjoining squares with vertex normals

Example Two adjoining squares with vertex normals

HC [image] Grouping [image] Example Two adjoining squares with vertex normals
Example Two adjoining squares with a smoothing group Example Merging group

Example Two adjoining squares with vertex normals

This example also shows two squares that share a common edge. Vertex normals have been added to the corners of each square to ensure that their common edge will be smoothed during display in Model and PreView and when rendered with Image.

v 0.000000 2.000000 0.000000
v 0.000000 0.000000 0.000000
v 2.000000 0.000000 0.000000
v 2.000000 2.000000 0.000000
v 4.000000 0.000000 -1.255298
v 4.000000 2.000000 -1.255298
vn 0.000000 0.000000 1.000000
vn 0.000000 0.000000 1.000000
vn 0.276597 0.000000 0.960986
vn 0.276597 0.000000 0.960986
vn 0.531611 0.000000 0.846988
vn 0.531611 0.000000 0.846988
# 6 vertices

# 6 normals

g all
s 1
f 1//1 2//2 3//3 4//4
f 4//4 3//3 5//5 6//6
# 2 elements


HC / Grouping / Example Merging group

Example Merging group

HC [image] Grouping [image] Example Merging group
Example Two adjoining squares with vertex normals Display and render attributes

Example Merging group

This example shows two Bezier surfaces that meet at a common edge. They have both been placed in the same merging group to ensure continuity at the edge where they meet. This prevents "cracks" from appearing along the seam between the two surfaces during rendering. Merging groups will be ignored during flat-shading, smooth-shading, and material shading of the surface.

v -4.949854 -5.000000 0.000000
v -4.949854 -1.666667 0.000000
v -4.949854 1.666667 0.000000
v -4.949854 5.000000 0.000000
v -1.616521 -5.000000 0.000000
v -1.616521 -1.666667 0.000000
v -1.616521 1.666667 0.000000
v -1.616521 5.000000 0.000000
v 1.716813 -5.000000 0.000000
v 1.716813 -1.666667 0.000000
v 1.716813 1.666667 0.000000
v 1.716813 5.000000 0.000000
v 5.050146 -5.000000 0.000000
v 5.050146 -1.666667 0.000000
v 5.050146 1.666667 0.000000
v 5.050146 5.000000 0.000000
v -15.015566 -4.974991 0.000000
v -15.015566 -1.641658 0.000000
v -15.015566 1.691675 0.000000
v -15.015566 5.025009 0.000000
v -11.682233 -4.974991 0.000000
v -11.682233 -1.641658 0.000000
v -11.682233 1.691675 0.000000
v -11.682233 5.025009 0.000000
v -8.348900 -4.974991 0.000000
v -8.348900 -1.641658 0.000000
v -8.348900 1.691675 0.000000
v -8.348900 5.025009 0.000000
v -5.015566 -4.974991 0.000000
v -5.015566 -1.641658 0.000000
v -5.015566 1.691675 0.000000
v -5.015566 5.025009 0.000000

mg 1 0.500000

cstype bezier
deg 3 3
surf 0.000000 1.000000 0.000000 1.000000 13 14 \
15 16 9 10 11 12 5 6 7 8 1 2 3 4
parm u 0.000000 1.000000
parm v 0.000000 1.000000
end
surf 0.000000 1.000000 0.000000 1.000000 29 30 31 32 25 26 27 28 21 22 \
23 24 17 18 19 20
parm u 0.000000 1.000000
parm v 0.000000 1.000000
end


HC / Display and render attributes

Display and render attributes

HC [image] Display and render attributes
Example Merging group bevel

Display and render attributes

Display and render attributes describe how an object looks when displayed in Model and PreView or when rendered with Image.

Some attributes apply to both free-form and polygonal geometry, such as material name and library, ray tracing, and shadow casting. Interpolation attributes apply only to polygonal geometry. Curve and surface resolutions are used for only free-form geometry.

The following chart shows the display and render statements available for polygonal and free-form geometry.

Table B1-1. Display and render attributes

polygonal only		polygonal or free-form	free-form only
--------------		----------------------	--------------
bevel			lod			ctech
c_interp		usemtl			stech
d_interp		mtllib
            shadow_obj
            trace_obj

All display and render attribute statements are state-setting. This means that once an attribute statement is set, it applies to all elements that follow until it is reset to a different value.

The following sample shows rendering and display statements for a face element.:

s 1
usemtl blue
usemap marble
f 1 2 3 4

Syntax

The following syntax statements are listed by the type of geometry. First are statements for polygonal geometry. Second are statements for both free-form and polygonal geometry. Third are statements for free-form geometry only.

Display and render attributes

  • bevel
  • c_interp
  • d_interp
  • lod
  • maplib
  • usemap
  • usemtl
  • mtllib
  • shadow_obj
  • trace_obj
  • ctech
  • stech
  • Example Cube with materials
  • Example Cube casting a shadow
  • Example Cube casting a reflection
  • Example Texture-mapped square
  • Example Approximation technique for a surface
  • Example Approximation technique for a curve

Reference:

    Wavefront Object Files (.obj)

Example Merging group bevel


HC / Display and render attributes / bevel

bevel

HC [image] Display and render attributes [image] bevel
Display and render attributes c_interp

bevel on/off

Polygonal geometry statement.

Sets bevel interpolation on or off. It works only with beveled objects, that is, objects with sides separated by beveled faces.

Bevel interpolation uses normal vector interpolation to give an illusion of roundness to a flat bevel. It does not affect the smoothing of non-bevelled faces.

Bevel interpolation does not alter the geometry of the original object.

on turns on bevel interpolation.

off turns off bevel interpolation. The default is off.

NOTE: Image cannot render bevel-interpolated elements that have vertex normals.

Example:

  • Display and render attributes

References:

    File structure(2), Display and render attributes

Display and render attributes c_interp


HC / Display and render attributes / c_interp

c_interp

HC [image] Display and render attributes [image] c_interp
bevel d_interp

c_interp on/off

Polygonal geometry statement.

Sets color interpolation on or off.

Color interpolation creates a blend across the surface of a polygon between the materials assigned to its vertices. This creates a blending of colors across a face element.

To support color interpolation, materials must be assigned per vertex, not per element. The illumination models for all materials of vertices attached to the polygon must be the same. Color interpolation applies to the values for ambient (Ka), diffuse (Kd), specular (Ks), and specular highlight (Ns) material properties.

on turns on color interpolation.

off turns off color interpolation. The default is off.

Example:

  • Display and render attributes

References:

    Display and render attributes, File structure

bevel d_interp


HC / Display and render attributes / d_interp

d_interp

HC [image] Display and render attributes [image] d_interp
c_interp lod

d_interp on/off

Polygonal geometry statement.

Sets dissolve interpolation on or off.

Dissolve interpolation creates an interpolation or blend across a polygon between the dissolve (d) values of the materials assigned to its vertices. This feature is used to create effects exhibiting varying degrees of apparent transparency, as in glass or clouds.

To support dissolve interpolation, materials must be assigned per vertex, not per element. All the materials assigned to the vertices involved in the dissolve interpolation must contain a dissolve factor command to specify a dissolve.

on turns on dissolve interpolation.

off turns off dissolve interpolation. The default is off.

Example:

  • Display and render attributes

References:

    Display and render attributes, File structure

c_interp lod


HC / Display and render attributes / lod

lod

HC [image] Display and render attributes [image] lod
d_interp maplib

lod level

Polygonal and free-form geometry statement.

Sets the level of detail to be displayed in a PreView animation. The level of detail feature lets you control which elements of an object are displayed while working in PreView.

level is the level of detail to be displayed. When you set the level of detail to 0 or omit the lod statement, all elements are displayed. Specifying an integer between 1 and 100 sets the level of detail to be displayed when reading the .obj file.

Example:

  • Display and render attributes

References:

    Display and render attributes, File structure

d_interp maplib


HC / Display and render attributes / maplib

maplib

HC [image] Display and render attributes [image] maplib
lod usemap

maplib filename1 filename2...

This is a rendering identifier that specifies the map library file for the texture map definitions set with the usemap identifier. You can specify multiple filenames with maplib. If multiple filenames are specified, the first file listed is searched first for the map definition, the second file is searched next, and so on.

When you assign a map library using the Model program, Model allows only one map library per .obj file. You can assign multiple libraries using a text editor.

filename is the name of the library file where the texture maps are defined. There is no default.


HC / Display and render attributes / usemap

usemap

HC [image] Display and render attributes [image] usemap
maplib usemtl

usemap map_name/off

This is a rendering identifier that specifies the texture map name for the element following it. To turn off texture mapping, specify off instead of the map name.

If you specify texture mapping for a face without texture vertices, the texture map will be ignored.

map_name is the name of the texture map.

off turns off texture mapping. The default is off.

Example:

  • Display and render attributes

References:

    Display and render attributes, maplib

maplib usemtl


HC / Display and render attributes / usemtl

usemtl

HC [image] Display and render attributes [image] usemtl
usemap mtllib

usemtl material_name

Polygonal and free-form geometry statement.

Specifies the material name for the element following it. Once a material is assigned, it cannot be turned off; it can only be changed.

material_name is the name of the material. If a material name is not specified, a white material is used.

Examples:

  • Example Cube casting a reflection
  • Display and render attributes
  • Example Cube casting a shadow
  • Example Texture-mapped square
  • Example Cube with materials

References:

    Example Cube casting a reflection(6), Example Cube casting a shadow(6), Example Cube with materials(6), Display and render attributes(2), Example Texture-mapped square, File structure, mtllib

usemap mtllib


HC / Display and render attributes / mtllib

mtllib

HC [image] Display and render attributes [image] mtllib
usemtl shadow_obj

mtllib filename1 filename2...

Polygonal and free-form geometry statement.

Specifies the material library file for the material definitions set with the usemtl statement. You can specify multiple filenames with mtllib. If multiple filenames are specified, the first file listed is searched first for the material definition, the second file is searched next, and so on.

When you assign a material library using the Model program, only one map library per .obj file is allowed. You can assign multiple libraries using a text editor.

filename is the name of the library file that defines the materials. There is no default.

Examples:

  • Example Cube casting a reflection
  • Display and render attributes
  • Example Cube casting a shadow
  • Example Texture-mapped square
  • Example Cube with materials

References:

    Display and render attributes, Example Cube casting a reflection, Example Cube casting a shadow, Example Cube with materials, Example Texture-mapped square, File structure

usemtl shadow_obj


HC / Display and render attributes / shadow_obj

shadow_obj

HC [image] Display and render attributes [image] shadow_obj
mtllib trace_obj

shadow_obj filename

Polygonal and free-form geometry statement.

Specifies the shadow object filename. This object is used to cast shadows for the current object. Shadows are only visible in a rendered image; they cannot be seen using hardware shading. The shadow object is invisible except for its shadow.

An object will cast shadows only if it has a shadow object. You can use an object as its own shadow object. However, a simplified version of the original object is usually preferable for shadow objects, since shadow casting can greatly increase rendering time.

filename is the filename for the shadow object. You can enter any valid object filename for the shadow object. The object file can be an .obj or .mod file. If a filename is given without an extension, an extension of .obj is assumed.

Only one shadow object can be stored in a file. If more than one shadow object is specified, the last one specified will be used.

Examples:

  • Display and render attributes
  • Example Cube casting a shadow

References:

    Display and render attributes, Example Cube casting a shadow, File structure

mtllib trace_obj


HC / Display and render attributes / trace_obj

trace_obj

HC [image] Display and render attributes [image] trace_obj
shadow_obj ctech

trace_obj filename

Polygonal and free-form geometry statement.

Specifies the ray tracing object filename. This object will be used in generating reflections of the current object on reflective surfaces. Reflections are only visible in a rendered image; they cannot be seen using hardware shading.

An object will appear in reflections only if it has a trace object. You can use an object as its own trace object. However, a simplified version of the original object is usually preferable for trace objects, since ray tracing can greatly increase rendering time.

filename is the filename for the ray tracing object. You can enter any valid object filename for the trace object. You can enter any valid object filename for the shadow object. The object file can be an .obj or .mod file. If a filename is given without an extension, an extension of .obj is assumed.

Only one trace object can be stored in a file. If more than one is specified, the last one is used.

Examples:

  • Example Cube casting a reflection
  • Display and render attributes

References:

    Display and render attributes, Example Cube casting a reflection, File structure

shadow_obj ctech


HC / Display and render attributes / ctech

ctech

HC [image] Display and render attributes [image] ctech
trace_obj stech

ctech technique resolution

Free-form geometry statement.

Specifies a curve approximation technique. The arguments specify the technique and resolution for the curve.

You must select from one of the following three techniques.

ctech cparm res

Specifies a curve with constant parametric subdivision using one resolution parameter. Each polynomial segment of the curve is subdivided n times in parameter space, where n is the resolution parameter multiplied by the degree of the curve.

res is the resolution parameter. The larger the value, the finer the resolution. If res has a value of 0, each polynomial curve segment is represented by a single line segment.

ctech cspace maxlength

Specifies a curve with constant spatial subdivision. The curve is approximated by a series of line segments whose lengths in real space are less than or equal to the maxlength.

maxlength is the maximum length of the line segments. The smaller the value, the finer the resolution.

ctech curv maxdist maxangle

Specifies curvature-dependent subdivision using separate resolution parameters for the maximum distance and the maximum angle.

The curve is approximated by a series of line segments in which 1) the distance in object space between a line segment and the actual curve must be less than the maxdist parameter and 2) the angle in degrees between tangent vectors at the ends of a line segment must be less than the maxangle parameter.

maxdist is the distance in real space between a line segment and the actual curve.

maxangle is the angle (in degrees) between tangent vectors at the ends of a line segment.

The smaller the values for maxdist and maxangle, the finer the resolution.

NOTE: Approximation information for trimming, hole, and special curves is stored in the corresponding surface. The ctech statement for the surface is used, not the ctech statement applied to the curv2 statement. Although untrimmed surfaces have no explicit trimming loop, a loop is constructed which bounds the legal parameter range. This implicit loop follows the same rules as any other loop and is approximated according to the ctech information for the surface.

Examples:

  • Example Approximation technique for a curve
  • Display and render attributes
  • Example Bezier curve

References:

    Example Approximation technique for a curve(2), Display and render attributes, Example Bezier curve, File structure

trace_obj stech


HC / Display and render attributes / stech

stech

HC [image] Display and render attributes [image] stech
ctech Example Cube with materials

stech technique resolution

Free-form geometry statement.

Specifies a surface approximation technique. The arguments specify the technique and resolution for the surface.

You must select from one of the following techniques:

stech cparma ures vres

Specifies a surface with constant parametric subdivision using separate resolution parameters for the u and v directions. Each patch of the surface is subdivided n times in parameter space, where n is the resolution parameter multiplied by the degree of the surface.

ures is the resolution parameter for the u direction.

vres is the resolution parameter for the v direction.

The larger the values for ures and vres, the finer the resolution. If you enter a value of 0 for both ures and vres, each patch is approximated by two triangles.

stech cparmb uvres

Specifies a surface with constant parametric subdivision, with refinement using one resolution parameter for both the u and v directions.

An initial triangulation is performed using only the points on the trimming curves. This triangulation is then refined until all edges are of an appropriate length. The resulting triangles are not oriented along isoparametric lines as they are in the cparma technique.

uvres is the resolution parameter for both the u and v directions. The larger the value, the finer the resolution.

stech cspace maxlength

Specifies a surface with constant spatial subdivision.

The surface is subdivided in rectangular regions until the length in real space of any rectangle edge is less than the maxlength. These rectangular regions are then triangulated.

maxlength is the length in real space of any rectangle edge. The smaller the value, the finer the resolution.

stech curv maxdist maxangle

Specifies a surface with curvature-dependent subdivision using separate resolution parameters for the maximum distance and the maximum angle.

The surface is subdivided in rectangular regions until 1) the distance in real space between the approximating rectangle and the actual surface is less than the maxdist (approximately) and 2) the angle in degrees between surface normals at the corners of the rectangle is less than the maxangle. Following subdivision, the regions are triangulated.

maxdist is the distance in real space between the approximating rectangle and the actual surface.

maxangle is the angle in degrees between surface normals at the corners of the rectangle.

The smaller the values for maxdist and maxangle, the finer the resolution.

Examples:

  • Example Approximation technique for a surface
  • Display and render attributes
  • Example B-spline surface
  • Example Cardinal surface

References:

    Example Approximation technique for a surface(2), Display and render attributes, Example B-spline surface, Example Cardinal surface, File structure

ctech Example Cube with materials


HC / Display and render attributes / Example Cube with materials

Example Cube with materials

HC [image] Display and render attributes [image] Example Cube with materials
stech Example Cube casting a shadow

Example Cube with materials

This cube has a different material applied to each of its faces.

mtllib master.mtl

v 0.000000 2.000000 2.000000
v 0.000000 0.000000 2.000000
v 2.000000 0.000000 2.000000
v 2.000000 2.000000 2.000000
v 0.000000 2.000000 0.000000
v 0.000000 0.000000 0.000000
v 2.000000 0.000000 0.000000
v 2.000000 2.000000 0.000000
# 8 vertices

g front
usemtl red
f 1 2 3 4
g back
usemtl blue
f 8 7 6 5
g right
usemtl green
f 4 3 7 8
g top
usemtl gold
f 5 1 4 8
g left
usemtl orange
f 5 6 2 1
g bottom
usemtl purple
f 2 6 7 3
# 6 elements


HC / Display and render attributes / Example Cube casting a shadow

Example Cube casting a shadow

HC [image] Display and render attributes [image] Example Cube casting a shadow
Example Cube with materials Example Cube casting a reflection

Example Cube casting a shadow

In this example, the cube casts a shadow on the other objects when it is rendered with Image. The cube, which is stored in the file cube.obj, references itself as the shadow object.

mtllib master.mtl
shadow_obj cube.obj

v 0.000000 2.000000 2.000000
v 0.000000 0.000000 2.000000
v 2.000000 0.000000 2.000000
v 2.000000 2.000000 2.000000
v 0.000000 2.000000 0.000000
v 0.000000 0.000000 0.000000
v 2.000000 0.000000 0.000000
v 2.000000 2.000000 0.000000
# 8 vertices

g front
usemtl red
f 1 2 3 4
g back
usemtl blue
f 8 7 6 5
g right
usemtl green
f 4 3 7 8
g top
usemtl gold
f 5 1 4 8
g left
usemtl orange
f 5 6 2 1
g bottom
usemtl purple
f 2 6 7 3
# 6 elements


HC / Display and render attributes / Example Cube casting a reflection

Example Cube casting a reflection

HC [image] Display and render attributes [image] Example Cube casting a reflection
Example Cube casting a shadow Example Texture-mapped square

Example Cube casting a reflection

This cube casts its reflection on any reflective objects when it is rendered with Image. The cube, which is stored in the file cube.obj, references itself as the trace object.

mtllib master.mtl
trace_obj cube.obj

v 0.000000 2.000000 2.000000
v 0.000000 0.000000 2.000000
v 2.000000 0.000000 2.000000
v 2.000000 2.000000 2.000000
v 0.000000 2.000000 0.000000
v 0.000000 0.000000 0.000000
v 2.000000 0.000000 0.000000
v 2.000000 2.000000 0.000000
# 8 vertices

g front
usemtl red
f 1 2 3 4
g back
usemtl blue
f 8 7 6 5
g right
usemtl green
f 4 3 7 8
g top
usemtl gold
f 5 1 4 8
g left
usemtl orange
f 5 6 2 1
g bottom
usemtl purple
f 2 6 7 3
# 6 elements


HC / Display and render attributes / Example Texture-mapped square

Example Texture-mapped square

HC [image] Display and render attributes [image] Example Texture-mapped square
Example Cube casting a reflection Example Approximation technique for a surface

Example Texture-mapped square

This example describes a 2 x 2 square. It is mapped with a 1 x 1 square texture. The texture is stretched to fit the square exactly.

mtllib master.mtl

v 0.000000 2.000000 0.000000
v 0.000000 0.000000 0.000000
v 2.000000 0.000000 0.000000
v 2.000000 2.000000 0.000000
vt 0.000000 1.000000 0.000000
vt 0.000000 0.000000 0.000000
vt 1.000000 0.000000 0.000000
vt 1.000000 1.000000 0.000000
# 4 vertices

usemtl wood
f 1/1 2/2 3/3 4/4
# 1 element


HC / Display and render attributes / Example Approximation technique for a surface

Example Approximation technique for a surface

HC [image] Display and render attributes [image] Example Approximation technique for a surface
Example Texture-mapped square Example Approximation technique for a curve

Example Approximation technique for a surface

This example shows a B-spline surface which will be approximated using curvature-dependent subdivision specified by the stech command.

g bspatch
v -5.000000 -5.000000 -7.808327
v -5.000000 -1.666667 -7.808327
v -5.000000 1.666667 -7.808327
v -5.000000 5.000000 -7.808327
v -1.666667 -5.000000 -7.808327
v -1.666667 -1.666667 11.977780
v -1.666667 1.666667 11.977780
v -1.666667 5.000000 -7.808327
v 1.666667 -5.000000 -7.808327
v 1.666667 -1.666667 11.977780
v 1.666667 1.666667 11.977780
v 1.666667 5.000000 -7.808327
v 5.000000 -5.000000 -7.808327
v 5.000000 -1.666667 -7.808327
v 5.000000 1.666667 -7.808327
v 5.000000 5.000000 -7.808327
# 16 vertices

g bspatch
cstype bspline
stech curv 0.5 10.000000
deg 3 3
surf 0.000000 1.000000 0.000000 1.000000 13 14 \ 15 16 9 10 11 12 5 6 7
8 1 2 3 4
parm u -3.000000 -2.000000 -1.000000 0.000000  \
1.000000 2.000000 3.000000 4.000000
parm v -3.000000 -2.000000 -1.000000 0.000000  \
1.000000 2.000000 3.000000 4.000000
end
# 1 element


HC / Display and render attributes / Example Approximation technique for a curve

Example Approximation technique for a curve

HC [image] Display and render attributes [image] Example Approximation technique for a curve
Example Approximation technique for a surface Comments

Example Approximation technique for a curve

This example shows a Bezier curve which will be approximated using constant parametric subdivision specified by the ctech command.

v -2.300000 1.950000 0.000000
v -2.200000 0.790000 0.000000
v -2.340000 -1.510000 0.000000
v -1.530000 -1.490000 0.000000
v -0.720000 -1.470000 0.000000
v -0.780000 0.230000 0.000000
v 0.070000 0.250000 0.000000
v 0.920000 0.270000 0.000000
v 0.800000 -1.610000 0.000000
v 1.620000 -1.590000 0.000000
v 2.440000 -1.570000 0.000000
v 2.690000 0.670000 0.000000
v 2.900000 1.980000 0.000000
# 13 vertices

g default
cstype bezier
ctech cparm 1.000000
deg 3
curv 0.000000 4.000000 1 2 3 4 5 6 7 8 9 10 \
11 12 13
parm u 0.000000 1.000000 2.000000 3.000000  \
4.000000
end
# 1 element


HC / Comments

Comments

HC [image] Comments
Example Approximation technique for a curve Mathematics for free-form curves and surfaces

Comments

Comments can appear anywhere in an .obj file. They are used to annotate the file; they are not processed.

Here is an example:

# this is a comment

The Model program automatically inserts comments when it creates .obj files. For example, it reports the number of geometric vertices, texture vertices, and vertex normals in a file.

# 4 vertices
# 4 texture vertices
# 4 normals

Reference:

    Wavefront Object Files (.obj)

Example Approximation technique for a curve Mathematics for free-form curves and surfaces


HC / Mathematics for free-form curves and surfaces

Mathematics for free-form curves and surfaces

HC [image] Mathematics for free-form curves and surfaces
Comments General forms

Mathematics for free-form curves and surfaces

[I apologize but this section will make absolutely no sense whatsoever without the equations and diagrams and there was just no easy way to include them in a pure ASCII document. You should probably just skip ahead to the section "Superseded statements." -Jim]

Mathematics for free-form curves and surfaces

  • General forms
  • Free-form curve and surface types
  • B-spline
  • Bezier
  • Cardinal
  • Taylor
  • Basis matrix
  • Surface vertex data
  • Control points
  • Texture vertices and texture mapping
  • Vertex normals and normal mapping
  • Curve and surface operations
  • Special points
  • Special curves
  • Connectivity

References:

    Wavefront Object Files (.obj), bmat

Comments General forms


HC / Mathematics for free-form curves and surfaces / General forms

General forms

HC [image] Mathematics for free-form curves and surfaces [image] General forms
Mathematics for free-form curves and surfaces Free-form curve and surface types

General forms

Rational and non-rational curves and surfaces

In general, any non-rational curve segment may be written as:

where K + 1 is the number of control points di are the control points n is the degree of the curve Ni,n(t) are the degree n basis functions Extending this to the bivariate case, any non-rational surface patch may be written as: where: K1 + 1 is the number of control points in the u direction K2 + 1 is the number of control points in the v direction di,j are the control points m is the degree of the surface in the u direction n is the degree of the surface in the v direction Ni,m(u) are the degree m basis functions in the u direction Nj,n(v) are the degree n basis functions in the v direction NOTE: The front of the surface is defined as the side where the u parameter increases to the right and the v parameter increases upward. We may extend this curve to the rational case as:

where wi are the weights associated with the control points di. Similarly, a rational surface may be expressed as: where wi,j are the weights associated with the control points di,j. NOTE: If a curve or surface in an .obj file is rational, it must use the rat option with the cstype statement and it requires some weight values for each control point.

The weights for the rational form are given as a third control point coordinate (for trimming curves) or fourth coordinate (for space curves and surfaces). These weights are optional and default to 1.0 if not given.

This default weight is only reasonable for curves and surfaces whose basis functions sum to 1.0, such as Bezier, Cardinal, and NURB. It does not make sense for Taylor and may or may not make sense for a representation given in basis-matrix form.

For all forms other than B-spline, the final curve or surface is constructed by piecing together the individual curve segments or surface patches. A global parameter space is then defined over the entire composite curve or surface using the parameter vector given with the parm statement.

The parameter vector for a curve is a list of p global parameter values {t1, . . . , tp}. If t1 t < ti+1 is a point in global parameter space, then:

is the corresponding point in local parameter space for the ith polynomial segment. It is this t which is used when evaluating a given segment of the piecewise curve. For surfaces, this mapping from global to local parameter space is applied independently in both the u and v parametric directions.

B-splines require a knot vector rather than a parameter vector, although this is also given with the parm statement. Refer to the description of B-splines below.

The following discussion of each type is expressed in terms of the above definitions.

NOTE: The maximum degree for all curve and surface types is currently set at 20, which is high enough for most purposes.

Mathematics for free-form curves and surfaces Free-form curve and surface types


HC / Mathematics for free-form curves and surfaces / Free-form curve and surface types

Free-form curve and surface types

HC [image] Mathematics for free-form curves and surfaces [image] Free-form curve and surface types
General forms B-spline

Free-form curve and surface types

General forms B-spline


HC / Mathematics for free-form curves and surfaces / B-spline

B-spline

HC [image] Mathematics for free-form curves and surfaces [image] B-spline
Free-form curve and surface types Bezier

B-spline

Type bspline specifies arbitrary degree non-uniform B-splines which are commonly referred to as NURBs in their rational form. The basis functions are defined by the Cox-deBoor recursion formulas as:

and:

where, by convention, 0/0 = 0.

The xi {x0, . . . ,xq} form a set known as the knot vector which is given by the parm statement. It is required that

1. xi xi + 1,

2. x0 < xn + 1,

3. xq -n -1 < xq,

4. xi < xi + n for 0 < i < q - n - 1,

5. xn t min < tmax xK+ 1, where [tmin, tmax] is the parameter over which the B-spline is to be evaluated, and

6. K = q - n - 1.

A knot is said to be of multiplicity r if its value is repeated r times in the knot vector. The second through fourth conditions above restrict knots to be of at most multiplicity n + 1 at the ends of the vector and at most n everywhere else.

The last condition requires that the number of control points is equal to one less than the number of knots minus the degree. For surfaces, all of the above conditions apply independently for the u and v parametric directions.

References:

    bsp(2), Example Approximation technique for a surface, Example B-spline surface, Example Bezier in u direction with B-spline in v direction, Example Rational B-spline surface, File structure, Free-form curve and surface attributes, Free-form curve and surface body statements, General forms, Parameter values and knot vectors, Specifying free-form curves and surfaces, cstype, deg, parm, res

Free-form curve and surface types Bezier


HC / Mathematics for free-form curves and surfaces / Bezier

Bezier

HC [image] Mathematics for free-form curves and surfaces [image] Bezier
B-spline Cardinal

Bezier

Type bezier specifies arbitrary degree Bezier curves and surfaces. This basis function is defined as:

where:

When using type bezier, the number of global parameter values given with the parm statement must be K/n + 1, where K is the number of control points. For surfaces, this requirement applies independently for the u and v parametric directions.

Examples:

  • Example Approximation technique for a curve
  • Example Connectivity between two surfaces
  • Example Two trimming regions with a hole
  • Example Trimming with a special curve
  • Example Trimming with special points
  • Example Trimmed NURB surface
  • Trimming loops and holes
  • Example Merging group
  • Example Bezier curve
  • Example Bezier patch

References:

    Example Bezier patch(6), Cardinal(4), Example Two trimming regions with a hole(3), Example Approximation technique for a curve(2), Example Bezier curve(2), Example Merging group(2), Example Trimming with special points(2), Special point(2), Trimming loops and holes(2), bzp(2), cstype(2), Basis matrix, Control points, Example Bezier in u direction with B-spline in v direction, Example Connectivity between two surfaces, Example Cubic Bezier surface made with a basis matrix, Example Trimmed NURB surface, Example Trimming with a special curve, File structure, Free-form curve and surface attributes, General forms, Specifying free-form curves and surfaces, deg, res, step

B-spline Cardinal


HC / Mathematics for free-form curves and surfaces / Cardinal

Cardinal

HC [image] Mathematics for free-form curves and surfaces [image] Cardinal
Bezier Taylor

Cardinal

Type cardinal specifies a cubic, first derivative, continuous curve or surface. For curves, this interpolates all but the first and last control points. For surfaces, all but the first and last row and column of control points are interpolated.

Cardinal splines, also known as Catmull-Rom splines, are best understood by considering the conversion from Cardinal to Bezier control points for a single curve segment:

Here, the ci variables are the Cardinal control points and the bi variables are the Bezier control points. We see that the second and third Cardinal points are the beginning and ending points for the segment, respectively. Also, the beginning tangent lies along the vector from the first to the third point, and the ending tangent along the vector from the second to the last point.

If we let Bi(t) be the cubic Bezier basis functions (i.e. what was given above for Bezier as Ni,n(t) with n = 3), then we may write the Cardinal basis functions as:

Note that Cardinal splines are only defined for the cubic case.

When using type cardinal, the number of global parameter values given with the parm statement must be K - n + 2, where K is the number of control points. For surfaces, this requirement applies independently for the u and v parametric directions.

Examples:

  • Example Cardinal surface
  • Example Cardinal curve

References:

    Example Cardinal surface(2), cdc(2), cdp(2), cstype(2), deg(2), Example Cardinal curve, File structure, Free-form curve and surface attributes, General forms, Specifying free-form curves and surfaces, res

Bezier Taylor


HC / Mathematics for free-form curves and surfaces / Taylor

Taylor

HC [image] Mathematics for free-form curves and surfaces [image] Taylor
Cardinal Basis matrix

Taylor

Type taylor specifies arbitrary degree Taylor polynomial curves and surfaces. The basis function is simply:

NOTE: The control points in this case are the polynomial coefficients and have no obvious geometric significance.

When using type taylor, the number of global parameter values given with the parm statement must be (K + 1)/(n + 1) + 1, where K is the number of control points. For surfaces, this requirement applies independently for the u and v parametric directions.

Example:

  • Example Taylor curve

References:

    Example Taylor curve(2), cstype(2), File structure, Free-form curve and surface attributes, General forms, Specifying free-form curves and surfaces, deg

Cardinal Basis matrix


HC / Mathematics for free-form curves and surfaces / Basis matrix

Basis matrix

HC [image] Mathematics for free-form curves and surfaces [image] Basis matrix
Taylor Surface vertex data

Basis matrix

Type bmatrix specifies general, arbitrary-degree curves defined through the use of a basis matrix rather than an explicit type such as Bezier. The basis functions are defined as:

where the basis matrix is the bi,j. In order to make the matrix nature of this more obvious, we may also write:

When constructing basis matrices, you should keep this definition in mind, as different authors write this in different ways. A more common matrix representation is:

To use such matrices in the .obj file, simply transpose the matrix and reverse the column ordering.

When using type basis, the number of global parameter values given with the parm statement must be (K - n)/s + 2, where K is the number of control points and s is the step size given with the step statement. For surfaces, this requirement applies independently for the u and v parametric directions.

References:

    step(5), Free-form curve and surface attributes(3), Data requirements for curves and surfaces(2), File structure(2), Example Bezier in u direction with B-spline in v direction, Free-form curve and surface body statement, Specifying free-form curves and surfaces, cstype, deg

Taylor Surface vertex data


HC / Mathematics for free-form curves and surfaces / Surface vertex data

Surface vertex data

HC [image] Mathematics for free-form curves and surfaces [image] Surface vertex data
Basis matrix Control points

Surface vertex data

Basis matrix Control points


HC / Mathematics for free-form curves and surfaces / Control points

Control points

HC [image] Mathematics for free-form curves and surfaces [image] Control points
Surface vertex data Texture vertices and texture mapping

Control points

The control points for a surface consisting of a single patch are listed in the order i = 0 to K1 for j = 0, followed by i = 0 to K1 for j = 1, and so on until j = K2.

For surfaces made up of many patches, which is the usual case, the control points are ordered as if the surface were a single large patch. For example, the control points for a bicubic Bezier surface consisting of four patches would be arranged as follows:

where (m, n) is the global parameter space of the surface and the numbers indicate the ordering of the vertex indices in the surf statement.

References:

    General forms(7), Cardinal(6), curv(4), curv2(4), step(4), Taylor(2), bsp(2), bzp(2), cdp(2), surf(2), vp(2), B-spline, Basis matrix, Bezier, Elements, Example Bezier curve, Free-form curve and surface body statement, Vertex normals and normal mapping, cdc

Surface vertex data Texture vertices and texture mapping


HC / Mathematics for free-form curves and surfaces / Texture vertices and texture mapping

Texture vertices and texture mapping

HC [image] Mathematics for free-form curves and surfaces [image] Texture vertices and texture mapping
Control points Vertex normals and normal mapping

Texture vertices and texture mapping

When texture vertices are not supplied, the original surface parameterization is used for texture mapping. However, if texture vertices are supplied, they are interpreted as additional information to be interpolated or approximated separately from, but using the same interpolation functions as the control vertices.

That is, whereas the surface itself, in the non-rational case, was given in the section "Rational and non-rational curves and surfaces" as:

the texture vertices are interpolated or approximated by:

where ti,j are the texture vertices and the basis functions are the same as for s(u,v). It is T(u,v), rather than the surface parameterization (u,v), which is used when a texture map is applied.

Control points Vertex normals and normal mapping


HC / Mathematics for free-form curves and surfaces / Vertex normals and normal mapping

Vertex normals and normal mapping

HC [image] Mathematics for free-form curves and surfaces [image] Vertex normals and normal mapping
Texture vertices and texture mapping Curve and surface operations

Vertex normals and normal mapping

Vertex normals are treated exactly like texture vertices. When vertex normals are not supplied, the true surface normals are used. If vertex normals are supplied, they are calculated as:

where qi,j are the vertex normals and the basis functions are the same as for s(u,v) and T(u,v).

NOTE: Vertex normals do not affect the shape of the surface; they are simply associated with the triangle vertices in the final triangulation. As with faces, supplying vertex normals only affects lighting calculations for the surface.

The treatment of both texture vertices and vertex normals in the case of rational surfaces is identical. It is important to notice that even when the surface S(u,v) is rational, the texture and normal surfaces, T(u,v) and Q(u,v), are not rational. This is because the control points (the texture vertices and vertex normals) are never rational.

Texture vertices and texture mapping Curve and surface operations


HC / Mathematics for free-form curves and surfaces / Curve and surface operations

Curve and surface operations

HC [image] Mathematics for free-form curves and surfaces [image] Curve and surface operations
Vertex normals and normal mapping Special points

Curve and surface operations

Vertex normals and normal mapping Special points


HC / Mathematics for free-form curves and surfaces / Special points

Special points

HC [image] Mathematics for free-form curves and surfaces [image] Special points
Curve and surface operations Special curves

Special points

The following equations give a more precise description of special points for space curves and discuss the extension to trimming curves and surfaces.

Let C(t) be a space curve with the global parameter t. We can approximate this curve by a set of k-1 line segments which connect the points:

for some set of k global parameter values {t1,...,tk}

Given a special point ts in the parameter space of the curve (referenced by vp), we guarantee that ts {t1, . . . ,tk}. More specifically, we approximate the curve by:

where, at the point i where ts is inserted, we have ti ts < ti+1.

References:

    Special point(2), vp(2), Example Trimming with special points

Curve and surface operations Special curves


HC / Mathematics for free-form curves and surfaces / Special curves

Special curves

HC [image] Mathematics for free-form curves and surfaces [image] Special curves
Special points Connectivity

Special curves

The following equations give a more precise description of a special curve.

Let T(t) be a special curve with the global parameter t. We have:

where (m,n) is a point in the global parameter space of a surface. We can approximate this curve by a set of k-1 line segments which connect the points:

for some set of k global parameter values.

Let s(m,n) be a surface with the global parameters m and n. We can approximate this surface by a triangulation of a set of p points.

which lie on the surface. We further define E as the set of all edges such that ei,j E implies that S(mi,ni) and S(mj,nj) are connected in the triangulation. Finally, we guarantee that there exists some subset of E:

such that the points:

are connected in the triangulation.

Reference:

    ctech

Special points Connectivity


HC / Mathematics for free-form curves and surfaces / Connectivity

Connectivity

HC [image] Mathematics for free-form curves and surfaces [image] Connectivity
Special curves Superseded statements

Connectivity

Recall that the syntax of the con statement is:

con surf_1 q0_1 q1_1 curv2d_1 surf_2 q0_2 q1_2 curv2d_2

If we let:

T1(t1) be the curve referenced by curv2d_1

S1(m1, n1) be the surface referenced by surf1 on which T1(t1) lies

T2(t2) be the curve referenced by curv2d_2

S2(m2, n2) be the surface referenced by surf2 on which T2(t2) lies

then S1(T1(t1)), S2(T2(t2)) must be identical up to reparameterization. Moreover, it must be the case that:

S1(T1(q0_1)) = S2(T2(q0_2))

and:

S1(T1(q1_1)) = S2(T2(q1_2))

It is along the curve S1(T1(t1)) between t1 = q0_1 and t1 = q1_1, and the curve S2(T2(t2)) between t2 = q0_2 and t2 = q1_2 that the surface S1(m1, n1) is connected to the surface S2(m2, n2).

References:

    Connectivity between free-form surfaces(6), Example Connectivity between two surfaces, curv2, mg

Special curves Superseded statements


HC / Superseded statements

Superseded statements

HC [image] Superseded statements
Connectivity bsp

Superseded statements

The new .obj file format has eliminated the need for several patch and curve statements. These statements have been replaced by free-form geometry statements.

In the 3.0 release, the following keywords have been superseded:

o bsp

o bzp

o cdc

o cdp

o res

You can still read these statements in this version 3.0, however, the system will no longer write files in this format.

This release is the last release that will read these statements. If you want to save any data from this format, read in the file and write it out. The system will convert the data to the new .obj format.

For more information on the new syntax statements, see "Specifying free-form curves and surfaces."

Syntax

The following syntax statements are for the superseded keywords.

Superseded statements

  • bsp
  • bzp
  • cdc
  • cdp
  • res

References:

    Wavefront Object Files (.obj)(2), Mathematics for free-form curves and surfaces

Connectivity bsp


HC / Superseded statements / bsp

bsp

HC [image] Superseded statements [image] bsp
Superseded statements bzp

bsp v1 v2 .. v16

Specifies a B-spline patch. B-spline patches have sixteen control points, defined as vertices. Only four of the control points are distributed over the surface of the patch; the remainder are distributed around the perimeter of the patch.

Patches must be tessellated in Model before they can be correctly shaded or rendered.

v is the vertex number for a control point. Sixteen vertex numbers are required. Positive values indicate absolute vertex numbers. Negative values indicate relative vertex numbers.

Reference:

    Superseded statements

Superseded statements bzp


HC / Superseded statements / bzp

bzp

HC [image] Superseded statements [image] bzp
bsp cdc

bzp v1 v2 .. v16

Specifies a Bezier patch. Bezier patches have sixteen control points, defined as vertices. The control points are distributed uniformly over its surface.

Patches must be tessellated in Model before they can be correctly shaded or rendered.

v is the vertex number for a control point. Sixteen vertex numbers are required. Positive values indicate absolute vertex numbers. Negative values indicate relative vertex numbers.

Example:

  • Example Bezier patch

References:

    Example Bezier patch, Superseded statements

bsp cdc


HC / Superseded statements / cdc

cdc

HC [image] Superseded statements [image] cdc
bzp cdp

cdc v1 v2 v3 v4 v5 ...

Specifies a Cardinal curve. Cardinal curves have a minimum of four control points, defined as vertices.

Cardinal curves cannot be correctly shaded or rendered. They can be tessellated and then extruded in Model to create 3D shapes.

v is the vertex number for a control point. A minimum of four vertex numbers are required. There is no limit on the maximum. Positive values indicate absolute vertex numbers. Negative values indicate relative vertex numbers.

Example:

  • Example Cardinal curve

References:

    Example Cardinal curve, Superseded statements

bzp cdp


HC / Superseded statements / cdp

cdp

HC [image] Superseded statements [image] cdp
cdc res

cdp v1 v2 v3 .. v16

Specifies a Cardinal patch. Cardinal patches have sixteen control points, defined as vertices. Four of the control points are attached to the corners of the patch.

Patches must be tessellated in Model before they can be correctly shaded or rendered.

v is the vertex number for a control point. Sixteen vertex numbers are required. Positive values indicate absolute vertex numbers. Negative values indicate relative vertex numbers.

Reference:

    Superseded statements

cdc res


HC / Superseded statements / res

res

HC [image] Superseded statements [image] res
cdp Comparison of 2.11 and 3.0 syntax

res useg vseg

Reference and display statement.

Sets the number of segments for Bezier, B-spline and Cardinal patches that follow it.

useg is the number of segments in the u direction (horizontal or x direction). The minimum setting is 3 and the maximum setting is 120. The default is 4.

vseg is the number of segments in the v direction (vertical or y direction). The minimum setting is 3 and the maximum setting is 120. The default is 4.

Example:

  • ctech

References:

    ctech(3), mg(3), Superseded statements

cdp Comparison of 2.11 and 3.0 syntax


HC / Comparison of 2.11 and 3.0 syntax

Comparison of 2.11 and 3.0 syntax

HC [image] Comparison of 2.11 and 3.0 syntax
res Cardinal curve

Comparison of 2.11 and 3.0 syntax

Comparison of 2.11 and 3.0 syntax

  • Cardinal curve
  • Example Cardinal curve
  • Example Bezier patch


HC / Comparison of 2.11 and 3.0 syntax / Cardinal curve

Cardinal curve

HC [image] Comparison of 2.11 and 3.0 syntax [image] Cardinal curve
Comparison of 2.11 and 3.0 syntax Example Cardinal curve

Cardinal curve

The following example shows the 2.11 syntax and the 3.0 syntax for the same Cardinal curve.

Example:

  • Example Cardinal curve

References:

    Example Cardinal curve(3), cdc

Comparison of 2.11 and 3.0 syntax Example Cardinal curve


HC / Comparison of 2.11 and 3.0 syntax / Example Cardinal curve

Example Cardinal curve

HC [image] Comparison of 2.11 and 3.0 syntax [image] Example Cardinal curve
Cardinal curve Example Bezier patch

Example Cardinal curve

# 2.11 Cardinal Curve

v 2.570000 1.280000 0.000000
v 0.940000 1.340000 0.000000
v -0.670000 0.820000 0.000000
v -0.770000 -0.940000 0.000000
v 1.030000 -1.350000 0.000000
v 3.070000 -1.310000 0.000000
# 6 vertices

cdc 1 2 3 4 5 6

3.0 Cardinal curve:

# 3.0 Cardinal curve

v 2.570000 1.280000 0.000000
v 0.940000 1.340000 0.000000
v -0.670000 0.820000 0.000000
v -0.770000 -0.940000 0.000000
v 1.030000 -1.350000 0.000000
v 3.070000 -1.310000 0.000000
# 6 vertices

cstype cardinal
deg 3
curv 0.000000 3.000000 1 2 3 4 5 6
parm u 0.000000 1.000000 2.000000 3.000000
end
# 1 element


HC / Comparison of 2.11 and 3.0 syntax / Example Bezier patch

Example Bezier patch

HC [image] Comparison of 2.11 and 3.0 syntax [image] Example Bezier patch
Example Cardinal curve

Example Bezier patch

The following example shows the 2.11 syntax and the 3.0 syntax for the same Bezier patch.

2.11 Bezier patch

# 2.11 Bezier Patch
v -5.000000 -5.000000 0.000000
v -5.000000 -1.666667 0.000000
v -5.000000 1.666667 0.000000
v -5.000000 5.000000 0.000000
v -1.666667 -5.000000 0.000000
v -1.666667 -1.666667 0.000000
v -1.666667 1.666667 0.000000
v -1.666667 5.000000 0.000000
v 1.666667 -5.000000 0.000000
v 1.666667 -1.666667 0.000000
v 1.666667 1.666667 0.000000
v 1.666667 5.000000 0.000000
v 5.000000 -5.000000 0.000000
v 5.000000 -1.666667 0.000000
v 5.000000 1.666667 0.000000
v 5.000000 5.000000 0.000000
# 16 vertices

bzp 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
# 1 element

3.0 Bezier patch

#   3.0 Bezier patch

v -5.000000 -5.000000 0.000000
v -5.000000 -1.666667 0.000000
v -5.000000 1.666667 0.000000
v -5.000000 5.000000 0.000000
v -1.666667 -5.000000 0.000000
v -1.666667 -1.666667 0.000000
v -1.666667 1.666667 0.000000
v -1.666667 5.000000 0.000000
v 1.666667 -5.000000 0.000000
v 1.666667 -1.666667 0.000000
v 1.666667 1.666667 0.000000
v 1.666667 5.000000 0.000000
v 5.000000 -5.000000 0.000000
v 5.000000 -1.666667 0.000000
v 5.000000 1.666667 0.000000
v 5.000000 5.000000 0.000000
# 16 vertices

cstype bezier
deg 3 3
surf 0.000000 1.000000 0.000000 1.000000 13 14 \
15 16 9 10 11 12 5 6 7 8 1 2 3 4
parm u 0.000000 1.000000
parm v 0.000000 1.000000
end
# 1 element

Example Cardinal curve