1、 ECMA-363 4th Edition / June 2007 Universal 3D File Format Ecma International Rue du Rhne 114 CH-1204 Geneva T/F: +41 22 849 6000/01 www.ecma-international.org Universal 3D File Format Standard ECMA-363 4th Edition / June 2007 . Brief history In 2004, Ecma International formed Technical Committee 43
2、 (TC43) to specify Universal 3D (U3D) File Format specification. The Universal 3D File Format specification is primarily intended for downstream 3D CAD repurposing and visualization purposes. The 1st Edition of the U3D File Format was adopted by the General Assembly of December 2004. In 2005, TC43 a
3、dded file format extensibility to the 2nd Edition of the U3D File Format specification. The 2nd Edition of the U3D File Format was submitted to ISO/IEC for fast-track processing. In 2006, changes were made as a result of comments received during the ISO/IEC DIS ballot process. In 2007, TC43 added th
4、e Free-Form Curve and Surface Extension to the 4th Edition of the U3D File Format specification that adds support for Uniform and Non-Uniform, Rational and Non-Rational Free-Form Curves and Surfaces. This Ecma Standard has been adopted by the General Assembly of June 2007 . - i - Table of contents 1
5、 Scope 1 2 Conformance 1 3 References 1 4 Definitions 1 5 Notational Conventions 2 5.1 Diagrams and field descriptions 2 5.2 Data types 4 5.2.1 U8 4 5.2.2 U16 4 5.2.3 U32 4 5.2.4 U64 4 5.2.5 I16 4 5.2.6 I32 4 5.2.7 F32 4 5.2.8 F64 4 5.2.9 String 4 5.3 Functional notations 4 5.3.1 rgb(R,G,B) 4 5.3.2
6、rgba(R,G,B,A) 4 5.3.3 InverseQuant(P,S,QPD,IQF) 4 5.4 Matrix, vector and coordinate system conventions 5 6 Acronyms and Abbreviations 5 7 General Description 6 8 Architecture 6 8.1 Execution architecture 6 8.2 Palettes 6 8.3 Node resources 7 8.3.1 Model resource 7 8.3.2 Light resource 7 8.3.3 View r
7、esource 8 8.4 Shading resources 8 8.4.1 Texture resource 8 8.4.2 Material resource 8 8.4.3 Lit texture shader resource 8 - ii - 8.5 Motion resource 9 8.6 Modifier chains 9 8.7 Scene graph 10 8.8 CLOD mesh generator 11 8.8.1 Author mesh 12 8.8.2 Author mesh resolution updates 12 8.8.3 Renderable mesh
8、 13 8.8.4 Renderable mesh resolution updates 14 8.8.5 CLOD modifier 14 8.9 Rendering and Shading 15 8.9.1 Transform Set 15 8.9.2 Renderable Group 15 8.9.3 Renderable Bound 16 8.10 Serialization 17 8.10.1 Object serialization 17 8.10.2 File structure 17 8.10.3 Block structure 17 8.10.4 File reference
9、 17 8.10.5 Declaration block section 18 8.11 Extensibility 18 9 File Format 18 9.1 File structure 18 9.1.1 File Header Block 19 9.1.2 Declaration Block 19 9.1.3 Continuation Block 19 9.2 Block structure 19 9.2.1 U32: Block Type 19 9.2.2 U32: Data Size 20 9.2.3 U32: Meta Data Size 20 9.2.4 Data 20 9.
10、2.5 variable: Data Padding 20 9.2.6 Meta Data 20 9.2.7 variable: Meta Data Padding 21 9.3 Block definitions 21 9.4 File structure blocks 22 9.4.1 File Header (blocktype: 0x00443355) 22 9.4.2 File Reference (blocktype: 0xFFFFFF12) 24 9.4.3 Modifier Chain (blocktype: 0xFFFFFF14) 27 9.4.4 Priority Upda
11、te (blocktype: 0xFFFFFF15) 31 9.4.5 New Object Type (blocktype: 0xFFFFFF16) 31 9.4.6 New Object Block (blocktype: 0x00000100 to 0x00FFFFFF) 34 9.5 Node blocks 35 9.5.1 Group Node (blocktype: 0xFFFFFF21) 35 9.5.2 Model Node (blocktype: 0xFFFFFF22) 37 - iii - 9.5.3 Light Node (blocktype: 0xFFFFFF23) 3
12、7 9.5.4 View Node (blocktype: 0xFFFFFF24) 38 9.6 Geometry generator blocks 45 9.6.1 CLOD Mesh Generator (blocktypes: 0xFFFFFF31; 0xFFFFFF3B; 0xFFFFFF3C) 45 9.6.2 Point Set (blocktypes: 0xFFFFFF36; 0xFFFFFF3E) 84 9.6.3 Line Set (blocktypes: 0xFFFFFF37; 0xFFFFFF3F) 96 9.7 Modifier blocks 104 9.7.1 2D
13、Glyph Modifier (blocktype: 0xFFFFFF41) 104 9.7.2 Subdivision Modifier (blocktype: 0xFFFFFF42) 109 9.7.3 Animation Modifier (blocktype: 0xFFFFFF43) 110 9.7.4 Bone Weight Modifier (blocktype: 0xFFFFFF44) 112 9.7.5 Shading Modifier (blocktype: 0xFFFFFF45) 114 9.7.6 CLOD Modifier (blocktype: 0xFFFFFF46)
14、 116 9.8 Resource blocks 117 9.8.1 Light Resource (blocktype: 0xFFFFFF51) 117 9.8.2 View Resource (blocktype: 0xFFFFFF52) 119 9.8.3 Lit Texture Shader (blocktype: 0xFFFFFF53) 122 9.8.4 Material Resource (blocktype: 0xFFFFFF54) 127 9.8.5 Texture Resource (blocktypes: 0xFFFFFF55; 0xFFFFFF5C) 131 9.8.6
15、 Motion Resource (blocktype: 0xFFFFFF56) 135 10 Bit Encoding Algorithm 143 10.1 Definitions 143 10.2 Acronyms and Abbreviations 144 10.3 Overview 144 10.3.1 Prerequisites and Inputs 144 10.3.2 Description 144 10.4 Encoding Algorithm 145 10.4.1 General Requirements 145 10.4.2 Operations 145 10.4.3 In
16、itialization 145 10.4.4 Algorithm for Writing a Compressed Symbol 146 10.4.5 Algorithm for Writing a Compressed U32 Value 147 10.4.6 Algorithm for Writing a Compressed U16 Value 147 10.4.7 Algorithm for Writing a Compressed U8 Value 147 10.4.8 Algorithm for Writing an Uncompressed U8 Value 147 10.4.
17、9 Algorithm for Updating the Compression Context 148 10.4.10 Algorithm for Flushing the Compression State 148 11 Free-Form Curve and Surface Extension 148 11.1 Overview 148 11.2 Definitions 148 11.3 Architecture 149 11.4 Free-Form Object New Object Type 150 - iv - 11.5 Free-Form Object Declaration 1
18、51 11.5.1 String: Free-Form Object Name 151 11.5.2 U32: Chain Index 151 11.5.3 U32: Free-Form Attributes 151 11.5.4 U32: Surface Count 152 11.5.5 U32: Face Count 152 11.5.6 U32: Edge Count 152 11.5.7 U32: Shading Count 152 11.5.8 Shading Description 152 11.5.9 Skeleton Description 152 11.6 Free-Form
19、 Object Continuation 153 11.6.1 String: Free-Form Object Name 153 11.6.2 U32: Chain Index 153 11.6.3 U32: Surface Start Index 153 11.6.4 U32: Surface End Index 154 11.6.5 Surface Description 154 11.6.6 U32: Face Count 162 11.6.7 Face Description 162 11.6.8 U32: Edge Count 165 11.6.9 Edge Description
20、 165 Annex A (informative) Bit Encoding Algorithm An Implementation 169 - 1 - 1 Scope This Standard defines the syntax and semantics of the Universal 3D file format, an extensible format for downstream 3D CAD repurposing and visualization, useful for many mainstream business applications. Salient fe
21、atures of the U3D file format described in this document include: execution architecture that facilitates optimal run-time modification of geometry, continuous-level-of-detail, domain-specific compression, progressive data streaming and playback, free-form surfaces, key-frame and bones-based animati
22、on, and extensibility of U3D format and run-time. The U3D file format specification does not address issues regarding rendering of 3D content. The U3D file format specification does not address issues regarding reliability of the transport layer or communications channel. It is assumed that reliabil
23、ity issues will be addressed by a different protocol layer. The U3D file format specification does not address run-time extensibility of an implementation of the U3D architecture. 2 Conformance A conforming implementation complies with all the mandatory clauses in this Standard. 3 References IEEE Co
24、mputer Society (1985), IEEE Standard for Binary Floating-Point Arithmetic, IEEE Std 754-1985. IETF RFC 3629: UTF-8, a transformation format of ISO 10646. November 2003, http:/www.faqs.org/rfcs/rfc3629.html. ISO/IEC IS 10918-1 | ITU-T Recommendation T.81: JPEG, 1994, http:/www.jpeg.org/jpeg. TIFF 6.0
25、 Specification, Adobe Systems Incorporated, June 1992. W3C Recommendation on 1st October, 1996: Portable Network Graphics (PNG), ISO/IEC 15948:2003 (E)., http:/www.w3.org/Graphics/PNG/. 4 Definitions For the purpose of this Standard the following definitions apply. Term Definition Glyph A symbolic f
26、igure, image, or shape that conveys information. Mandatory clauses All portions of the specification except those marked “Informative”. New Position A position that is added to the mesh, point set, or line set. One Point projection Working in a similar manner to a bellows camera, with one point proj
27、ection the orientation of the image plane is completely independent of the view direction. An advantage of one point projection is that of dimensional correctness. That is, if the image plane is parallel to a plane of the model, then the dimensions of the model in that plane are to scale. This enabl
28、es creation of an image that has both depth and dimensional correctness in the selected plane. Resolution Level of detail. - 2 - Term Definition Screen Drawing area available for rendering. Split Position A position in a mesh, point set or line set from which the new position will be created. The ne
29、w position is described relative to the split position. Third Position A new face added to an author mesh uses three positions: the New Position, the Split Position, and the Third Position. Three point projection Is the most natural projection, and is used for conventional images. In this projection
30、, the image plane is normal to the direction of the view, as in a conventional camera. 5 Notational Conventions 5.1 Diagrams and field descriptions Boxes represent information stored as one of the basic data types described in 5.2 Data types. Ovals represent a logical collection of more than one of
31、the basic data types. The information is grouped for clarity and the basic data types that compose the grouping are described explicitly in a following subsection of the document. Boxes with the right side corners cut off represent information that is compressed. Arrows convey ordering information.
32、Each entry in the diagram is further documented below the diagram. The logical groups are noted by name only. Basic data types are noted by an abbreviated data type symbol (defined in the next section) and the field name. The compressed data is documented as basic data type; followed by an open brac
33、ket “”, the compression context, and a close bracket, “”; followed by the field name. The compression context identifies symbols with similar frequency statistics. The compression routine adapts to the frequency of symbols encountered with adaptive contexts. Adaptive context labels are prefixed with
34、 “c”. The compression routine can take advantage of range limitation information. A range context indicates the symbols only use a limited portion of the range of the data type. Range contexts are not adaptive. Range context labels are prefixed with “r”; followed by the range size. Clause 10 Bit Enc
35、oding Algorithm contains details regarding compression requirements. Example: The following diagram and field description shows Data A, an unsigned 8-bit integer; followed by Data B, a grouping of multiple fields; followed by Data C, a compressed unsigned 32-bit integer with an adaptive context “cCc
36、ontext”; followed by Data D, a compressed unsigned 8-bit integer with a range context of 0 to 6. A B C D - 3 - The fields are then noted as follows: 1.1.1.1.1 U8: A 1.1.1.1.2 B 1.1.1.1.3 U32 cCcontext: C 1.1.1.1.4 U8 r7: D An arrow with a branch in its shaft represents two or more options for inform
37、ation to be stored in the file. Example: The following diagram shows C followed by D followed by G, or C followed by E followed by F followed by G. If the same data type repeats several times, a loop is used. The number of iterations appears next to the loop arrow. The number of iterations may depen
38、d on information presented earlier in the file. Example: The following diagram shows data H followed by X data I. Numbers: By default, all numbers are decimal (base 10). Numbers prefixed with “0x” are hexadecimal numbers (base 16). For example, the number “0x10” is a hexadecimal number equivalent to
39、 the decimal number “16”. X I H D C E F G - 4 - 5.2 Data types The binary file will contain the following types: U8, U16, U32, U64, I16, I32, F32, F64, and String. Clause 10 contains encoding requirements for these types. 5.2.1 U8 An unsigned 8-bit integer value. 5.2.2 U16 An unsigned 16-bit integer
40、 value. 5.2.3 U32 An unsigned 32-bit integer value. 5.2.4 U64 An unsigned 64-bit integer value. 5.2.5 I16 A signed twos complement 16-bit integer value. 5.2.6 I32 A signed twos complement 32-bit integer value. 5.2.7 F32 An IEEE 32-bit floating-point number. 5.2.8 F64 An IEEE 64-bit double precision
41、floating-point number. 5.2.9 String The String type starts with an unsigned 16-bit integer that defines how many bytes of character data the string contains. The character encoding is defined per file in the file header block. Strings are always handled as case sensitive. The empty string contains z
42、ero bytes of character data. The empty string is used to indicate the name of a default palette entry. A field may use the empty string as a name referring to the default entry. The empty string shall not be used as the name of an object defined by a block in the file. 5.3 Functional notations Some
43、text descriptions use a functional notation for color values or quantized values. Those functions are described in this section. 5.3.1 rgb(R,G,B) A color value with red, green, and blue components can be described using rgb(R,G,B). The values for R, G, and B indicate the intensity of that component.
44、 A value of 0.0 indicates black and a value of +1.0 indicates full intensity. The ordinary range is 0.0 to +1.0 although values outside this range are allowed. Gray colors are indicated by using the same value for R, G, and B. 5.3.2 rgba(R,G,B,A) A color value with red, green, blue, and alpha compon
45、ents can be described using rgba(R,G,B,A). The values for R, G, and B are the same as in 5.3.1 rgb(R,G,B). The value for A indicates the opacity of the color value. The ordinary range for the alpha component is 0.0 to +1.0. The value 0.0 corresponds to fully transparent and the value +1.0 correspond
46、s to fully opaque. Values outside the ordinary range are allowed. 5.3.3 InverseQuant(P,S,QPD,IQF) Reconstruction of a quantized value is described using InverseQuant(P,S,QPD,IQF). The reconstructed value RV is calculated as - 5 - RV = P + (1 2*S) * QPD * IQF where P is the predicted value, S is the
47、sign of the prediction difference, QPD is the quantized prediction difference, and IQF is the inverse quantization factor. RV, P and IQF are floating point numbers. S is equal to zero for a positive prediction difference and equal to one for a negative prediction difference. QPD is an unsigned integ
48、er number. The document specifies the inverse quantization function that must be used but does not specify a quantization function. For information only: a suitable quantization function could calculate S and QPD from an original value OV as S = 1 if P OV and S = 0 if P = OV. QPD = (|OV P|) * (1.0 /
49、 IQF) + 0.5. Other quantization functions could be used. 5.4 Matrix, vector and coordinate system conventions By convention, matrices are stored in column major form. Vectors are column vectors. A vector v is multiplied from the right by a matrix M, that is Mv. The homogenizing coordinate of a homogeneous vector or homogeneous matrix representation is the last entry in the vector or matrix representation, respectively. NOTE A consequence of above conventions is that in the common use of 4x4 matrices as transformations the rightmost column vector of a 4x4 matrix acts