OBJ

From The VG Resource Wiki
Jump to: navigation, search

Wavefront's OBJ (.obj) is a very common 3D model format and one of the oldest still in use today. It does not support rigging, and materials are defined in an external MTL file, but it is stored as plain text and maintains a relatively low file size. Because of this, OBJ models are good for sharing simple objects across modeling platforms.

OBJ is one of the two preferred model formats on The Models Resource. Please note that OBJ submissions with MTL files will not be accepted.

Limitations

OBJ models do not support model rigging. Any model exported to the OBJ format will lose its rigging information and not have any bones included (unless converted into meshes by the exporter).

Material definitions are handled by an external MTL file, though the materials' names are defined within the OBJ file.

MTL File

Material definitions for the model, including the material's color, specular shine, and textures used, are handled by an external MTL (.mtl) file. Like the OBJ format, it is stored as plain text and is easily human readable. The name of the desired MTL file is specified by the OBJ itself, though usually it is safe to assume the name matches that of the model. Be aware that not all programs will be able to load MTL files correctly if the name includes a space.

Without a MTL file, OBJ models will load with blank materials, requiring the user to have to manually re-texture the model. Depending on what the model is being used for, this may not be possible for the user, making the model unusable.

Texture Paths

The most common problem with OBJ files is having improper texture path names in the MTL file. Some modeling software will use absolute file paths when defining the name of the texture. This will cause the textures to fail to load when the model is imported. The reason for this, and the reason why it can be hard to catch, is that the textures will import fine only on the computer where the OBJ was created. (Or, if you want to get technical, on any computer with the exact same folder setup.) For the model to properly be able to import textures, the file path should be a relative path from the MTL file's location.

Because the format is stored as plain text, it is possible to fix texture path problems using any text editor (such as Notepad or Notepad++) without having to re-export the model. Texture paths are stored on lines marked with "map_Kd" (complex materials can have other textures defined with similar labels) followed by the path. If the material is located in the same directory as the model, the texture path should be changed to leave only the name of the texture and its file extension. Please note that not all programs will correctly load textures with spaces in the file name.

Before:

map_Kd C:\Users\Owner\Desktop\King Dedede\FitDedede_Hammer.png

After:

map_Kd FitDedede_Hammer.png