当前位置:网站首页>obj文件格式与.mtl文件格式
obj文件格式与.mtl文件格式
2022-07-25 05:21:00 【Super__Idol】
1.OBJ是一种3D模型文件,因此不包含动画、材质特性、贴图路径、动力学、粒子等信息。但是可以读取.mtl文件来获得材质信息。
2.OBJ文件使用【关键字根据数据类型排列,每个关键字有一段简短描述】
顶点数据(Vertex data):
v 几何体顶点 (Geometric vertices)
vt贴图坐标点 (Texture vertices)
vn顶点法线 (Vertex normals)
vp参数空格顶点 (Parameter space vertices)
3.在Maya中创建一个多边形立方体,选中这个立方体,导出格式为OBJ,文件名为"cube.obj".(如果没有此格式,请在Plug-in Manager中载入"objExport.mll") 用写字板打开"cube.obj"。例如下文:
usemtl initialShadingGroup
v 0.500000 -0.500000 -0.500000
vt 1.000000 0.000000vn 0.000000 0.000000 -1.000000
s off
f 1 2 3
f 1/3 2/5 3/4
f 1/3/4 2/5/6 3/4/2
解释一下:
"v 0.500000 -0.500000 -0.500000"这句"v"代表点的坐标。
"vt 1.000000 0.000000"这句"vt"代表点的贴图坐标。
"vn 0.000000 0.000000 -1.000000"这句"vn"代表点的法线。
"s off"表示关闭光滑组。
"usemtl initialShadingGroup"表示使用的材质。
"f 1 2 3"这样的行表示以第1、2、3号顶点组成一个三角形。
"f 1/3 2/5 3/4"这样的行表示以第1、2、3号顶点组成一个三角形,其中第一个顶点的纹理坐标的索引值为3,第二个顶点的纹理坐标的索引值为5,第三个顶点的纹理坐标的索引值为4。
"f 1/3/4 2/5/6 3/4/2"这样的行表示以第1、2、3号顶点组成一个三角形,其中第一个顶点的纹理坐标的索引值为3,其法线的索引值是4;第二个顶点的纹理坐标的索引值为5,其法线的索引值是6;第三个顶点的纹理坐标的索引值为6,其法线的索引值是2。
4.说说.mtl文件吧
三维模型处理会要读取.mtl文件来获得材质信息。
mtl文件(Material Library File)是材质库文件,描述的是物体的材质信息,ASCII存储,任何文本编辑器可以将其打开和编辑。一个.mtl文件可以包含一个或多个材质定义,对于每个材质都有其颜色,纹理和反射贴图的描述,应用于物体的表面和顶点。
以下是一个材质库文件的基本结构:
newmtl mymtl_1
材质颜色光照定义
纹理贴图定义
反射贴图定义
newmtl mymtl_2
材质颜色光照定义
纹理贴图定义
反射贴图定义
注释:每个材质库可含多个材质定义,每个材质都有一个材质名。用newmtl mtlName来定义一个材质。对于每个材质,可定义它的颜色光照纹理反射等描述特征。
主要的定义格式如下文所示:
材质颜色光照
1。环境反射有以下三种描述格式,三者是互斥的,不能同时使用。Ka r g b \\用RGB颜色值来表示,g和b两参数是可选的,如果只指定了r的值,则g和b的值都等于r的值。三个参数一般取值范围为0.0~1.0,在此范围外的值则相应的增加或减少反射率;
Ka spectral file.rfl factor \\用一个rfl文件来表示。factor是一个可选参数,表示.rfl文件中值的乘数,默认为1.0;
Ka xyz x y z \\用CIEXYZ值来表示,x,y,z是CIEXYZ颜色空间的各分量值。y和z两参数是可选的,如果只指定了x的值,则y和z的值都等于r的值。三个参数一般取值范围为0~1。2。漫反射描述的三种格式:
Kd r g b
Kd spectral file.rfl factor
Kd xyz x y z3。镜反射描述的三种格式:
Ks r g b
Ks spectral file.rfl factor
Ks xyz x y z4。滤光透射率描述的三种格式:
Tf r g b
Tf spectral file.rfl factor
Tf xyz x y z5。光照模型描述格式:
illum illum_#
指定材质的光照模型。illum后面可接0~10范围内的数字参数。
5.下载3D模型的网站:https://free3d.com/
6.更多,请参考
obj文件解析 - giser_xupf - 博客园
OBJ 模型文件与MTL材质文件 介绍_长江很多号的博客-CSDN博客_mtl材质
边栏推荐
- China trifluoroethanol industry research and investment forecast report (2022 Edition)
- Matter's Unified Smart Home connection standard enables local automatic interaction between smart devices
- STL notes (VI): container vector
- 85 distributed project construction
- The price is 17300! Why does Huawei mate x face Samsung fold?
- js 页面增加过渡层
- Render Optimization: repaint and reflow
- 使用getifaddrs获取本机网口IP地址
- 微服务 - 远程调用(Feign组件)
- 弹性布局总结
猜你喜欢

一篇文章带你读懂Redis的哨兵模式

Game 302 of leetcode

HMS core discovery Episode 16 live broadcast preview | play AI's new "sound" state with tiger pier

LeetCode 15:三数之和

Teach you three ways to optimize the performance from 20s to 500ms

基于云原生的私有化 PaaS 平台交付实践

Why does the official not recommend using UUID as MySQL primary key
![[globally unique ID] how to handle the ID primary key after dividing the database and table?](/img/a1/800ee868b74ce5d98956d4a0e2c075.png)
[globally unique ID] how to handle the ID primary key after dividing the database and table?

深圳随到随考,科目四随到随考,科三理论第二理论随到随考说明

Implementation principle of epoll
随机推荐
[cloud co creation] design Huawei cloud storage architecture with the youngest cloud service hcie (Part 1)
Forwarding and sharing function of wechat applet
Typera+picgo+ Alibaba cloud OSS setup and error reporting solution [reprint]
Small case of data analysis: visualize recruitment data and view the most needed technologies in the field~
systemVerilog中automatic用法
STM32 Development Notes 118: using CMSIS DSP Library in stm32cube IDE
STL notes (IV): String
批量下载视频小技巧
Game 302 of leetcode
Dragon Dragon community released the first Anolis OS Security Guide to escort users' business systems
VPP cannot load up status interface
项目管理工具——阿里云Projex介绍与实战
Three schemes for finclip to realize wechat authorized login
[globally unique ID] how to handle the ID primary key after dividing the database and table?
Build keyword driven automated testing framework
Sword finger offer II 014. anagrams in strings
In depth understanding of pre post + +, -- and negative modulus
JWT(json web token)
OpenFegin远程调用丢失请求头问题
Implement is by yourself_ base_ of