其他分享
首页 > 其他分享> > Unity Ply网格读取

Unity Ply网格读取

作者:互联网

Unity Ply网格读取

Ply格式说明

The version 1.0 PLY format, 详细参见:https://ww2.mathworks.cn/help/vision/ug/the-ply-format.html

File Header

文件头示例’{}‘为说明:

ply                             {文件头}
format binary_big_endian 1.0    {数据格式以及版本}
element vertex 9200             {定义vertex元素}
property float x                {定义属性}
property float y
property float z
element face 18000              {定义面元素}
property list uchar int vertex_indices
end_header                      {这行后面就是数据了}

其中,format <data format> <PLY version> 中的<data format>支持(little/big endian refers to the byte ordering of multi-byte data):

元素定义方式如下:

element <element name> <number in file>
property <data type> <property name 1>
property <data type> <property name 2>
property <data type> <property name 3>
...

其中对应的<data type>有:

Name Type
char (8-bit) character
uchar (8-bit) unsigned character
short (16-bit) short integer
ushort (16-bit) unsigned short integer
int (32-bit) integer
uint (32-bit) unsigned integer
float (32-bit) single-precision float
double (64-bit) double-precision float

对于list的属性为:

property list <count data type> <data type> <property name> 

在文件头里面还可以添加注释,具体格式如下:

comment <comment text>

Data

header之后存数据。按照之前约定的元素顺序和属性类型,依次存储。

Common Elements and Properties

常见元素和属性为:

Required Core Property Element Property Data Type Property Description
vertex x float x,y,z coordinates
y float
z float
nx float x,y,z of normal
ny float
nz float
red uchar vertex color
green uchar
blue uchar
alpha uchar amount of transparency
material_index int index to list of materials
face vertex_indices list of int indices to vertices
back_red uchar backside color
back_green uchar
back_blue uchar
edge vertex1 int index to vertex
vertex2 int index to other vertex
crease_tag uchar crease in subdivision surface
material red uchar material color
green uchar
blue uchar
alpha uchar amount of transparency
reflect_coeff float amount of light reflected
refract_coeff float amount of light refracted
refract_index float index of refraction
extinct_coeff float extinction coefficent

Unity Ply Reader

附上项目路径:https://github.com/grassofsky/PlyImporter

PlyImporter

原始项目的说明见:https://github.com/3DBear/PlyImporter

在原来基础上的改动主要有

TODO

标签:uchar,list,float,vertex,网格,Ply,Unity,bit,property
来源: https://www.cnblogs.com/grass-and-moon/p/14029778.html