Wavefront .obj file

Wavefront .obj file
OBJ geometry format
Filename extension .obj
Internet media type application/x-tgif?
Developed by Wavefront Technologies
Type of format 3D model format

OBJ (or .OBJ) is a geometry definition file format first developed by Wavefront Technologies for its Advanced Visualizer animation package. The file format is open and has been adopted by other 3D graphics application vendors. For the most part it is a universally accepted format.

The OBJ file format is a simple data-format that represents 3D geometry alone — namely, the position of each vertex, the UV position of each texture coordinate vertex, normals, and the faces that make each polygon defined as a list of vertices, and texture vertices. Vertices are stored in a counter-clockwise order by default, making explicit declaration of normals unnecessary.

Contents

File format

Lines beginning with a hash character (#) are comments.

  # this is a comment

An OBJ file contains several types of definitions:

  # List of Vertices, with (x,y,z[,w]) coordinates, w is optional.
  v 0.123 0.234 0.345 1.0
  v ...
  ...

  # Texture coordinates, in (u,v[,w]) coordinates, w is optional.
  vt 0.500 -1.352 [0.234]
  vt ...
  ...

  # Normals in (x,y,z) form; normals might not be unit.
  vn 0.707 0.000 0.707
  vn ...
  ...

  # Face Definitions (see below)
  f 1 2 3
  f 3/1 4/2 5/3
  f 6/4/1 3/5/3 7/6/5
  f ...
  ...

Face definitions

Faces are defined using lists of vertex, texture and normal indices. Polygons such as quadrilaterals can be defined by using more than three vertex/texture/normal indices.

OBJ files also support free form curved surface objects, such as NURB surfaces.

There are several ways to define a face, but each face line definition starts with "f" character.

Vertex

A valid vertex index starts from 1 and matches the corresponding vertex elements of a previously defined vertex list. Each face can contain more than three elements.

 f v1 v2 v3 v4 ...

Vertex/texture-coordinate

Optionally, texture coordinate indices can be used to specify texture coordinates when defining a face. To add a texture coordinate index to a vertex index when defining a face, one must put a slash immediately after the vertex index and then put the texture coordinate index. No spaces are permitted before or after the slash. A valid texture coordinate index starts from 1 and matches the corresponding element in the previously defined list of texture coordinates. Each face can contain more than three elements.

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

Vertex/texture-coordinate/normal

Optionally, normal indices can be used to specify normal vectors for vertices when defining a face. To add a normal index to a vertex index when defining a face, one must put a second slash after the texture coordinate index and then put the normal index. A valid normal index starts from 1 and matches the corresponding element in the previously defined list of normals. Each face can contain more than three elements.

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

Vertex/normal

As texture coordinates are optional, one can define geometry without them, but one must put two slashes after the vertex index before putting the normal index.

  f v1//vn1 v2//vn2 v3//vn3 ...

Referencing materials

Materials that describe the visual aspects of the polygons are stored in external .mtl files. The .mtl file may contain one or more named material definitions.

  mtllib [external .mtl file name]
  ...

Named objects, polygon groups and material groups are specified via the following tags.

  o [object name]
  ...
  g [group name]
  ...
  usemtl [material name]
  ...

The material name matches a named material definition in an external .mtl file. Each tag applies to all faces following, until another tag of the same type appears. The texture coordinate can be left out if the current material definition does not include a texture.

  f v1//vn1 v2//vn2 v3//vn3 
  ...

Smooth shading across polygons is enabled by smoothing groups.

  s 1
  ...
  # Smooth shading can be disabled as well.
  s off
  ...

More than one external MTL material file may be referenced from within the OBJ file.

Relative and absolute indices

OBJ files, due to their list structure, are able to reference vertices, normals, etc. either by their absolute (1-indexed) list position, or relatively by using negative indices and counting backwards. However, not all software supports the latter approach, and conversely some software inherently writes only the latter form (due to the convenience of appending elements without needing to recalculate vertex offsets, etc.), leading to occasional incompatibilities.

Material template library

MTL material format
Filename extension .mtl
Developed by Wavefront Technologies
Type of format 3D texture format

Synopsis

In 3D Computer Graphics, one of the most common geometry interchange file formats is the OBJ. The .MTL File Format is a companion file format that describes surface shading (material) properties of objects within one or more .OBJ files. A .OBJ file references one or more .MTL files (called "material libraries"), and from there, references one or more material descriptions by name.

Introduction

The Material Template Library format (MTL) is a standard defined by Wavefront Technologies for ASCII files that define the light reflecting properties of a surface for the purposes of computer rendering, and according to the Phong reflection model. The standard has widespread support among different computer software packages, making it a useful format for interchange of materials.

MTL files are commonly accompanied by and referenced from OBJ files that define geometry upon which the materials of the MTL file are mapped.

The MTL format, although still widely used, is outdated and does not fully support later technologies such as specular maps and parallax maps. However due to the open and intuitive nature of the format, these can easily be added with a custom MTL file generator.

The MTL format defines a number of formats.[1][2]

Basic materials

A single .mtl file may define multiple materials. Materials are defined one after another in the file, each starting with the newmtl command:

   # define a material named 'Colored'
   newmtl Colored

The ambient color of the material is declared using Ka. Color definitions are in RGB where each channel's value is between 0 and 1.

   Ka 1.000 1.000 1.000     # white

Similarly, the diffuse color is declared using Kd.

   Kd 1.000 1.000 1.000     # white

The specular color is declared using Ks, and weighted using the specular coefficient Ns.

   Ks 0.000 0.000 0.000     # black (off)
   Ns 10.000                # ranges between 0 and 1000

Materials can be transparent. This is referred to as being dissolved. Unlike real transparency, the result does not depend upon the thickness of the object.

   d 0.9                    # some implementations use 'd'
   Tr 0.9                   # others use 'Tr'

Multiple illumination models are available, per material. These are enumerated as follows:

0. Color on and Ambient off
1. Color on and Ambient on
2. Highlight on
3. Reflection on and Ray trace on
4. Transparency: Glass on, Reflection: Ray trace on
5. Reflection: Fresnel on and Ray trace on
6. Transparency: Refraction on, Reflection: Fresnel off and Ray trace on
7. Transparency: Refraction on, Reflection: Fresnel on and Ray trace on
8. Reflection on and Ray trace off
9. Transparency: Glass on, Reflection: Ray trace off
10. Casts shadows onto invisible surfaces
   illum 2

Texture maps

Textured materials use the same properties as above, and additionally define texture maps.

   newmtl Textured
   Ka 1.000 1.000 1.000
   Kd 1.000 1.000 1.000
   Ks 0.000 0.000 0.000
   d 1.0
   illum 2
   map_Ka lenna.tga           # the ambient texture map
   map_Kd lenna.tga           # the diffuse texture map (most of the time, it will
                              # be the same as the ambient texture map)
   map_Ks lenna.tga           # the specular texture map
   map_d lenna_alpha.tga      # the alpha texture map
   map_bump lenna_bump.tga    # the bump map
   bump lenna_bump.tga        # some implementations use 'bump' instead of 'map_Bump'

See also

References

External links


Wikimedia Foundation. 2010.

Игры ⚽ Поможем сделать НИР

Look at other dictionaries:

  • OBJ — or OBJ may refer to: Object file, an organized machine code file created by a compiler with .obj file extension Relocatable Object Module Format, an Object file for Intel microprocessors with .obj file extension Wavefront .obj file, a 3D geometry …   Wikipedia

  • Obj — (or .OBJ) is a geometry definition file format first developed by Wavefront Technologies for its Advanced Visualizer animation package. The file format is open and has been adopted by other 3D graphics application vendors and can be… …   Wikipedia

  • OBJ — OBJect (Medical » Physiology) **** Objective (Medical » Physiology) **** Objective (Governmental » Military) * Objection (Community » Law) * Ottawa Business Journal (Community » Media) * Object (Wavefront) (Computing » File Extensions) * Compiled …   Abbreviations dictionary

  • List of file formats — This is an incomplete list, which may never be able to satisfy particular standards for completeness. You can help by expanding it with reliably sourced entries. See also: List of file formats (alphabetical) This is a list of file formats… …   Wikipedia

  • MakeHuman — Developer(s) The MakeHuman team. Stable release 1.0 alpha6 / April 1, 2011; 7 months ago (2011 04 01) Written in Python, C …   Wikipedia

  • Comparison of 3D computer graphics software — 3D computer graphics software refers to programs used to create 3D computer generated imagery. Contents 1 General information 2 Operating system support 3 Features 4 …   Wikipedia

  • Radiance (software) — Infobox Software name = Radiance caption = developer = Greg Ward released = ? frequently updated = yes programming language = C operating system = Unix, Linux, Mac OS X, Windows language = ? genre = license = website = http://www.radiance… …   Wikipedia

  • 3D Canvas — Infobox Software name = 3D Canvas caption = A screenshot of 3D Canvas Pro running on Windows XP Professional developer = Amabilis latest release version = 7.1.1.2 latest release date = December 26th, 2007 operating system = Windows genre = 3D… …   Wikipedia

  • Список расширений имени файла/S — / * A B C D E F G H I J K L M N O P Q R S T U V W X Y Z Примечание: Поскольку расширение имени файла может быть любым, представленный список не является полным …   Википедия

  • BRL-CAD — Infobox Software name = BRL CAD http://brlcad.org/gallery/images/galleryLogo sm.gifBRL CAD Logo] http://brlcad.org/gallery/d/235 2/MGED.jpgMGED Screenshot] caption = author = Mike Muuss developer = Army Research Laboratory released = 1984 latest… …   Wikipedia

Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”