spec_obj.txt
来自「最新osg包」· 文本 代码 · 共 2,160 行 · 第 1/5 页
TXT
2,160 行
B1. Object Files (.obj)Object files define the geometry and other properties for objects inWavefront's Advanced Visualizer. Object files can also be used totransfer geometric data back and forth between the Advanced Visualizerand other applications.Object files can be in ASCII format (.obj) or binary format (.mod).This appendix describes the ASCII format for object files. These filesmust have the extension .obj.In this release, the .obj file format supports both polygonal objectsand free-form objects. Polygonal geometry uses points, lines, and facesto define objects while free-form geometry uses curves and surfaces.About this sectionThe .obj appendix is for those who want to use the .obj format totranslate geometric data from other software applications to Wavefrontproducts. It also provides information for Advanced Visualizer userswho want detailed information on the Wavefront .obj file format.If you are a 2.11 user and want to understand the significance of the3.0 release and how it affects your existing files, you may beespecially interested in the section called "Superseded statements" atthe 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 organizedMost of this appendix describes the different parts of an .obj file andhow those parts are arranged in the file. The three sections at the endof the appendix provide background information on the 3.0 release ofthe .obj format.The .obj appendix includes the following sections:o File structureo General statemento Vertex datao Specifying free-form curves/surfaceso Free-form curve/surface attributeso Elementso Free-form curve/surface body statementso Connectivity between free-form surfaceso Groupingo Display/render attributeso Commentso Mathematics for free-form curves/surfaceso Superseded statementso 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.File structureThe following types of data may be included in an .obj file. In thislist, the keyword (in parentheses) follows the data type.Vertex datao geometric vertices (v)o texture vertices (vt)o vertex normals (vn)o parameter space vertices (vp) Free-form curve/surface attributeso 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)Elementso point (p)o line (l)o face (f)o curve (curv)o 2D curve (curv2)o surface (surf)Free-form curve/surface body statementso 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 surfaceso connect (con)Groupingo group name (g)o smoothing group (s)o merging group (mg)o object name (o)Display/render attributeso 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 structureGeneral statementcall 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.csh commandcsh -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.Vertex dataVertex data provides coordinates for:o geometric verticeso texture verticeso vertex normalsFor free-form objects, the vertex data also provides:o parameter space verticesThe vertex data is represented by four vertex lists; one for each typeof vertex coordinate. A right-hand coordinate system is used to specifythe coordinate locations.The following sample is a portion of an .obj file that contains thefour 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.500000When vertices are loaded into the Advanced Visualizer, they aresequentially numbered, starting with 1. These reference numbers areused in element statements.SyntaxThe following syntax statements are listed in order of complexity.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.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 statementsvn 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.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.Specifying free-form curves/surfacesThere are three steps involved in specifying a free-form curve orsurface 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 statementsThe next three sections of this appendix provide detailed informationon each of these steps.Data requirements for curves and surfacesAll curves and surfaces require a certain set of data. This consists ofthe following:Free-form curve/surface attributeso 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.Elementso 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.Free-form curve/surface body statementso 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 checksThe above set of data starts out empty with no default values whenreading of an .obj file begins. While the file is being read,statements are encountered, information is accumulated, and some errorsmay 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 remainsin effect from one curve or surface to the next. Information givenwithin a curve or surface body is only effective for the curve orsurface it is given with.Free-form curve/surface attributesFive types of free-form geometry are available in the .obj file
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?