共需要三個文件:obj文件、mtl文件及一張紋理圖。
1、obj文件需要滿足如下格式:
頂點 v
紋理坐標 vt
法線 vn
面片f Vertex1/Texture1/Normal1 Vertex2/Texture2/Normal2 Vertex3/Texture3/Normal3
例如:
mtllib ./1f2.obj.mtl v 1.458263 -1.366019 1.144059 v 1.444591 -1.369437 1.111344 v 1.460216 -1.349906 1.093766 vt 0.000000 0.000000 vt 0.000000 0.500000 vt 0.500000 0.500000 vn 1.331619 -1.435342 -0.408150 vn 0.665809 -0.717671 -0.204075 vn 1.331619 -1.435342 -0.408150 f 1/1/1 2/2/2 3/3/3
其中第一行指明了對應的mtl文件;
2、mtl文件進行了一些貼圖設置及指定了紋理圖
例如:
# # Wavefront material file # Converted by Meshlab Group # newmtl material_0 Ka 0.200000 0.200000 0.200000 Kd 1.000000 1.000000 1.000000 Ks 1.000000 1.000000 1.000000 Tr 1.000000 illum 2 Ns 0.000000 map_Kd 12.png
3、紋理圖
可以是png、jpg等圖片格式,文件名要按照mtl中指定的文件名來設置。
4、顯示效果