diff options
Diffstat (limited to 'doc/obj-spec.txt')
-rw-r--r-- | doc/obj-spec.txt | 292 |
1 files changed, 292 insertions, 0 deletions
diff --git a/doc/obj-spec.txt b/doc/obj-spec.txt new file mode 100644 index 0000000..2430367 --- /dev/null +++ b/doc/obj-spec.txt | |||
@@ -0,0 +1,292 @@ | |||
1 | Wavefront OBJ | ||
2 | |||
3 | Also Known As: Wavefront Object, OBJ | ||
4 | |||
5 | ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ | ||
6 | |||
7 | Type 3D Vector | ||
8 | Colors Unlimited | ||
9 | Compression Uncompressed | ||
10 | Maximum Image Size Unlimited | ||
11 | Multiple Images Per File Yes | ||
12 | Numerical Format NA | ||
13 | Originator Wavefront | ||
14 | Platform UNIX | ||
15 | Supporting Applications Advanced Visualizer | ||
16 | See Also Wavefront RLA | ||
17 | |||
18 | Usage | ||
19 | Used to store and exchange 3D data. | ||
20 | |||
21 | Comments | ||
22 | The Wavefront OBJ format is a useful standard for representing polygonal data | ||
23 | in ASCII form. | ||
24 | |||
25 | Vendor specifications are available for this format. | ||
26 | |||
27 | ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ | ||
28 | |||
29 | Wavefront OBJ (object) files are used by Wavefront's Advanced Visualizer | ||
30 | application to store geometric objects composed of lines, polygons, and | ||
31 | free-form curves and surfaces. Wavefront is best known for its high-end | ||
32 | computer graphics tools, including modeling, animation, and image compositing | ||
33 | tools. These programs run on powerful workstations such as those made by | ||
34 | Silicon Graphics, Inc. | ||
35 | |||
36 | Wavefront OBJ files are often stored with the extension ".obj" following the | ||
37 | UNIX convention of lowercase letters for filenames. The most recently | ||
38 | documented version of OBJ is v3.0, superseding the previous v2.11 release. | ||
39 | |||
40 | Contents: | ||
41 | File Organization | ||
42 | File Details | ||
43 | For Further Information | ||
44 | |||
45 | In Wavefront's 3D software, geometric object files may be stored in ASCII | ||
46 | format (using the ".obj" file extension) or in binary format (using the .MOD | ||
47 | extension). The binary format is proprietary and undocumented, so only the | ||
48 | ASCII format is described here. | ||
49 | |||
50 | The OBJ file format supports lines, polygons, and free-form curves and | ||
51 | surfaces. Lines and polygons are described in terms of their points, while | ||
52 | curves and surfaces are defined with control points and other information | ||
53 | depending on the type of curve. The format supports rational and non-rational | ||
54 | curves, including those based on Bezier, B-spline, Cardinal (Catmull-Rom | ||
55 | splines), and Taylor equations. | ||
56 | |||
57 | File Organization | ||
58 | |||
59 | OBJ files do not require any sort of header, although it is common to begin the | ||
60 | file with a comment line of some kind. Comment lines begin with a hash mark | ||
61 | (#). Blank space and blank lines can be freely added to the file to aid in | ||
62 | formatting and readability. Each non-blank line begins with a keyword and may | ||
63 | be followed on the same line with the data for that keyword. Lines are read and | ||
64 | processed until the end of the file. Lines can be logically joined with the | ||
65 | line continuation character ( \ ) at the end of a line. | ||
66 | |||
67 | The following keywords may be included in an OBJ file. In this list, keywords | ||
68 | are arranged by data type, and each is followed by a brief description. | ||
69 | |||
70 | Vertex data: | ||
71 | |||
72 | v Geometric vertices | ||
73 | vt Texture vertices | ||
74 | vn Vertex normals | ||
75 | vp Parameter space vertices | ||
76 | |||
77 | Free-form curve/surface attributes: | ||
78 | |||
79 | deg Degree | ||
80 | bmat Basis matrix | ||
81 | step Step size | ||
82 | cstype Curve or surface type | ||
83 | |||
84 | Elements: | ||
85 | |||
86 | p Point | ||
87 | l Line | ||
88 | f Face | ||
89 | curv Curve | ||
90 | curv2 2D curve | ||
91 | surf Surface | ||
92 | |||
93 | Free-form curve/surface body statements: | ||
94 | |||
95 | parm Parameter values | ||
96 | trim Outer trimming loop | ||
97 | hole Inner trimming loop | ||
98 | scrv Special curve | ||
99 | sp Special point | ||
100 | end End statement | ||
101 | |||
102 | Connectivity between free-form surfaces: | ||
103 | |||
104 | con Connect | ||
105 | |||
106 | Grouping: | ||
107 | |||
108 | g Group name | ||
109 | s Smoothing group | ||
110 | mg Merging group | ||
111 | o Object name | ||
112 | |||
113 | Display/render attributes: | ||
114 | |||
115 | bevel Bevel interpolation | ||
116 | c_interp Color interpolation | ||
117 | d_interp Dissolve interpolation | ||
118 | lod Level of detail | ||
119 | usemtl Material name | ||
120 | mtllib Material library | ||
121 | shadow_obj Shadow casting | ||
122 | trace_obj Ray tracing | ||
123 | ctech Curve approximation technique | ||
124 | stech Surface approximation technique | ||
125 | |||
126 | File Details | ||
127 | |||
128 | The most commonly encountered OBJ files contain only polygonal faces. To | ||
129 | describe a polygon, the file first describes each point with the "v" keyword, | ||
130 | then describes the face with the "f" keyword. The line of a face command | ||
131 | contains the enumerations of the points in the face, as 1-based indices into | ||
132 | the list of points, in the order they occurred in the file. For example, the | ||
133 | following describes a simple triangle: | ||
134 | |||
135 | # Simple Wavefront file | ||
136 | v 0.0 0.0 0.0 | ||
137 | v 0.0 1.0 0.0 | ||
138 | v 1.0 0.0 0.0 | ||
139 | f 1 2 3 | ||
140 | |||
141 | It is also possible to reference points using negative indices. This makes it | ||
142 | easy to describe the points in a face, then the face, without the need to store | ||
143 | a large list of points and their indexes. In this way, "v" commands and "f" | ||
144 | commands can be interspersed. | ||
145 | |||
146 | v -0.500000 0.000000 0.400000 | ||
147 | v -0.500000 0.000000 -0.800000 | ||
148 | v -0.500000 1.000000 -0.800000 | ||
149 | v -0.500000 1.000000 0.400000 | ||
150 | f -4 -3 -2 -1 | ||
151 | |||
152 | OBJ files do not contain color definitions for faces, although they can | ||
153 | reference materials that are stored in a separate material library file. The | ||
154 | material library can be loaded using the "mtllib" keyword. The material library | ||
155 | contains the definitions for the RGB values for the material's diffuse, | ||
156 | ambient, and specular colors, along with other characteristics such as | ||
157 | specularity, refraction, transparency, etc. | ||
158 | |||
159 | The OBJ file references materials by name with the "usemtl" keyword. All faces | ||
160 | that follow are given the attributes of this material until the next "usemtl" | ||
161 | command is encountered. | ||
162 | |||
163 | Faces and surfaces can be assigned into named groups with the "g" keyword. This | ||
164 | is used to create convenient sub-objects to make it easier to edit and animate | ||
165 | 3D models. Faces can belong to more than one group. | ||
166 | |||
167 | The following demonstrate more complicated examples of smooth surfaces of | ||
168 | different types, material assignment, line continuation, and grouping. | ||
169 | |||
170 | Cube with Materials | ||
171 | |||
172 | # This cube has a different material | ||
173 | # applied to each of its faces. | ||
174 | mtllib master.mtl | ||
175 | v 0.000000 2.000000 2.000000 | ||
176 | v 0.000000 0.000000 2.000000 | ||
177 | v 2.000000 0.000000 2.000000 | ||
178 | v 2.000000 2.000000 2.000000 | ||
179 | v 0.000000 2.000000 0.000000 | ||
180 | v 0.000000 0.000000 0.000000 | ||
181 | v 2.000000 0.000000 0.000000 | ||
182 | v 2.000000 2.000000 0.000000 | ||
183 | # 8 vertices | ||
184 | g front | ||
185 | usemtl red | ||
186 | f 1 2 3 4 | ||
187 | g back | ||
188 | usemtl blue | ||
189 | f 8 7 6 5 | ||
190 | g right | ||
191 | usemtl green | ||
192 | f 4 3 7 8 | ||
193 | g top | ||
194 | usemtl gold | ||
195 | f 5 1 4 8 | ||
196 | g left | ||
197 | usemtl orange | ||
198 | f 5 6 2 1 | ||
199 | g bottom | ||
200 | usemtl purple | ||
201 | f 2 6 7 3 | ||
202 | # 6 elements | ||
203 | |||
204 | Bezier Patch | ||
205 | |||
206 | # 3.0 Bezier patch | ||
207 | v -5.000000 -5.000000 0.000000 | ||
208 | v -5.000000 -1.666667 0.000000 | ||
209 | v -5.000000 1.666667 0.000000 | ||
210 | v -5.000000 5.000000 0.000000 | ||
211 | v -1.666667 -5.000000 0.000000 | ||
212 | v -1.666667 -1.666667 0.000000 | ||
213 | v -1.666667 1.666667 0.000000 | ||
214 | v -1.666667 5.000000 0.000000 | ||
215 | v 1.666667 -5.000000 0.000000 | ||
216 | v 1.666667 -1.666667 0.000000 | ||
217 | v 1.666667 1.666667 0.000000 | ||
218 | v 1.666667 5.000000 0.000000 | ||
219 | v 5.000000 -5.000000 0.000000 | ||
220 | v 5.000000 -1.666667 0.000000 | ||
221 | v 5.000000 1.666667 0.000000 | ||
222 | v 5.000000 5.000000 0.000000 | ||
223 | # 16 vertices | ||
224 | cstype bezier | ||
225 | deg 3 3 | ||
226 | # Example of line continuation | ||
227 | surf 0.000000 1.000000 0.000000 1.000000 13 14 \ | ||
228 | 15 16 9 10 11 12 5 6 7 8 1 2 3 4 | ||
229 | parm u 0.000000 1.000000 | ||
230 | parm v 0.000000 1.000000 | ||
231 | end | ||
232 | # 1 element | ||
233 | |||
234 | Cardinal Curve | ||
235 | |||
236 | # 3.0 Cardinal curve | ||
237 | v 0.940000 1.340000 0.000000 | ||
238 | v -0.670000 0.820000 0.000000 | ||
239 | v -0.770000 -0.940000 0.000000 | ||
240 | v 1.030000 -1.350000 0.000000 | ||
241 | v 3.070000 -1.310000 0.000000 | ||
242 | # 6 vertices | ||
243 | cstype cardinal | ||
244 | deg 3 | ||
245 | curv 0.000000 3.000000 1 2 3 4 5 6 | ||
246 | parm u 0.000000 1.000000 2.000000 3.000000 end | ||
247 | # 1 element | ||
248 | |||
249 | Texture-Mapped Square | ||
250 | |||
251 | # A 2 x 2 square mapped with a 1 x 1 square | ||
252 | # texture stretched to fit the square exactly. | ||
253 | mtllib master.mtl | ||
254 | v 0.000000 2.000000 0.000000 | ||
255 | v 0.000000 0.000000 0.000000 | ||
256 | v 2.000000 0.000000 0.000000 | ||
257 | v 2.000000 2.000000 0.000000 | ||
258 | vt 0.000000 1.000000 0.000000 | ||
259 | vt 0.000000 0.000000 0.000000 | ||
260 | vt 1.000000 0.000000 0.000000 | ||
261 | vt 1.000000 1.000000 0.000000 | ||
262 | # 4 vertices | ||
263 | usemtl wood | ||
264 | # The first number is the point, | ||
265 | # then the slash, | ||
266 | # and the second is the texture point | ||
267 | f 1/1 2/2 3/3 4/4 | ||
268 | # 1 element | ||
269 | |||
270 | For Further Information | ||
271 | |||
272 | For further information about the Wavefront OBJ format, see the specification. | ||
273 | |||
274 | You can also contact: | ||
275 | |||
276 | Wavefront Technologies | ||
277 | 530 East Montecito Street | ||
278 | Santa Barbara, CA 93103 | ||
279 | Voice: 805-962-8117 | ||
280 | FAX: 805-963-0410 | ||
281 | WWW: http://www.aw.sgi.com/ | ||
282 | |||
283 | Wavefront also maintains a toll-free support number and a BBS for its | ||
284 | customers. There are many Wavefront user groups, too. | ||
285 | |||
286 | ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ | ||
287 | |||
288 | [txtpreva] [txtnexta] [txtupa] [txttoidx] | ||
289 | [btntoc] [btnglos] [btnmain] [btnfmt] [btnsoft] [btninet] [btnbook] | ||
290 | |||
291 | Copyright © 1996, 1994 O'Reilly & Associates, Inc. All Rights Reserved. | ||
292 | |||