[英]How to convert an ASCII JSON 3D model file to binary?
While looking into some webGL examples (mostly Three.js based examples) I noticed large models are loaded via a combination of ASCII+binary JSON. 在研究一些webGL示例(主要是基于Three.js的示例)时,我注意到大型模型是通过ASCII +二进制JSON的组合加载的。 This approach is very attractive to me because of the reduced file size. 由于减小了文件大小,这种方法对我来说非常有吸引力。 The ASCII JSON has the general format of (taken from Three.js example, webgl_geometry_large_mesh.html) : ASCII JSON的通用格式为(取自Three.js示例,webgl_geometry_large_mesh.html):
{
"metadata" :
{
"formatVersion" : 3,
"sourceFile" : "lucy100k.obj",
"generatedBy" : "OBJConverter",
"vertices" : 50002,
"faces" : 100000,
"normals" : 0,
"uvs" : 0,
"materials" : 0
},
"materials": [ {
"DbgColor" : 15658734,
"DbgIndex" : 0,
"DbgName" : "default"
}],
"buffers": "Lucy100k_bin.bin"
}
As seen above, instead of a section containing a truck-load of vertices, normals, UVs, etc it is all packed into the referred binary file. 如上所示,不是包含一个包含大量顶点,法线,UV等的部分,而是全部打包到了引用的二进制文件中。 Does anyone know how to create that binary file? 有人知道如何创建该二进制文件吗? Can I do it with Blender? 我可以用Blender做到吗? If not, is there a script I can use? 如果没有,是否可以使用脚本?
Thanks 谢谢
According to this line: 根据这一行:
"generatedBy" : "OBJConverter"
That file was generated by OBJConverter
(from some .obj and .mtl files). 该文件由OBJConverter
生成(来自某些.obj和.mtl文件)。
OBJConverter
is a Python script called convert_obj_three.py
sited in three.js / utils / converters / obj
. OBJConverter
是一个位于three.js / utils / converters / obj
的Python脚本,名为convert_obj_three.py
。
The own script has a comment about "How to get proper OBJ + MTL files with Blender". 自己的脚本中有关于“如何使用Blender获取正确的OBJ + MTL文件”的注释。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.