1024programmer News A detailed explanation of the .obj and .mtl file formats

A detailed explanation of the .obj and .mtl file formats

obj file is a 3D model file format. A standard developed by Alias|Wavefront for the 3D modeling and animation software “Advanced Visualizer”, suitable for mutual guidance between 3D software models, and can also be read and written through Maya.

  • Only supports model triangle surface data and material information, no animation support;
  • The geometric information is provided by the .obj file, and the material information is defined by the .mtl file;
  • The file represents a piece of data in line units, and the subsequent content can be judged according to the characters at the beginning of the line;
  • The # character represents a comment line

Note:
For .obj and .mtl parsing and loading, please refer to:Loading .obj and .mtl in opengl es 2.0

OBJ format


# material file corresponding to obj
# mtllib testvt.mtl
# group name
g default
# o object name(Object name)
o testvt.obj
# vertices
v -0.5 -0.5 0.1
v -0.5 -0.5 -0.1
v 0 0.5 0.1
v 0 0.5 -0.1
v 0.5 -0.5 0.1
v 0.5 -0.5 -0.1
# texture coordinates
vt 0 1
vt 1 1
vt 0.5 0
# vertex normal
vn 0 0 1
vn 0 0 -1
# The material used by the current primitive
usemtl Default
# s Smooth shading across polygons is enabled by smoothing groups.
# Smooth shading can be disabled as well.
s off
># v1/vt1/vn1 v2/vt2/vn2 v3/vt3/vn3 (index starts at 1)
f 1/1/1 5/2/1 3/3/1
f 6/2 /2 2/1/2 4/3/2

This article is from the internet and does not represent1024programmerPosition, please indicate the source when reprinting:https://www.1024programmer.com/a-detailed-explanation-of-the-obj-and-mtl-file-formats/

author: admin

Previous article
Next article

Leave a Reply

Your email address will not be published. Required fields are marked *

Contact Us

Contact us

181-3619-1160

Online consultation: QQ交谈

E-mail: [email protected]

Working hours: Monday to Friday, 9:00-17:30, holidays off

Follow wechat
Scan wechat and follow us

Scan wechat and follow us

Follow Weibo
Back to top
首页
微信
电话
搜索