简单的线框格式?

发布于 2024-07-06 08:41:10 字数 393 浏览 6 评论 0原文

我正在寻找一种用于线框模型的简单文件格式。 我知道 VRML、u3D 等,但这些对于我的需求来说似乎很重要。 我的标准是:

  • 必须有明确的规格。 要么是开放的,要么是非常完善/记录的。
  • 我只需要(想要)简单的模型 - 顶点和边。 我不想处理面孔或物体。 如果格式支持更多,只要我可以忽略它们就可以了。
  • 最终用户工具不是必需的,但会很棒。 如果不是,它必须是人类可读的(并且对于简单模型来说是可编辑的)。
  • 能够注释或至少标记节点会很好(但不是必需的)。
  • 我使用什么语言并不重要,但可能的选择是 Java/C++ 和 Java/C++。 OpenGL

或者我只是更好地将顶点/边列表写入文本文件并完成它?

I'm looking for a simple file format to use for wireframe models. I am aware of VRML, u3D, etc, but these seem heavyweight for my needs. My criterea are:

  • Must have a clear spec. Either open or very well established/documented.
  • I only need (want) simple models - vertices and edges. I don't want to handle faces or objects. If the format supports more, that's fine so long as I can ignore them.
  • End-user tools are not a requirement, but would be great. If not, it must be human readable (and editable for simple models).
  • It would be nice (but not necessary) to be able to annotate or at least label nodes.
  • It shouldn't matter what language I'm using, but probable options are Java/C++ & OpenGL

Or am I just better writing vertices/edge lists to a text file and be done with it?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

水溶 2024-07-13 08:41:10

Wavefront OBJ 是一种非常简单的文本文件格式,用于存储 3D 模型,所有 3D 建模应用程序(例如 Maya、3dsmax、lightwave)都支持它,因此您可以非常轻松地导出和导入模型。

您可以在此处阅读更多信息和规格:

http://www.fileformat.info/format/wavefrontobj/

我建议不要创建自己的文件格式。 Wavefront OBJ 非常简单且明确。

这是 2x2 平面的示例。 v 表示顶点坐标,f 表示面的描述(哪些顶点相连):

v -0.500000 -0.000000 0.500000
v 0.000000 -0.000000 0.500000
v 0.500000 -0.000000 0.500000
v -0.500000 0.000000 0.000000
v 0.000000 0.000000 0.000000
v 0.500000 0.000000 0.000000
v -0.500000 0.000000 -0.500000
v 0.000000 0.000000 -0.500000
v 0.500000 0.000000 -0.500000
v -0.500000 -0.000000 0.500000
v 0.000000 -0.000000 0.500000
v 0.500000 -0.000000 0.500000
v -0.500000 0.000000 0.000000
v 0.000000 0.000000 0.000000
v 0.500000 0.000000 0.000000
v -0.500000 0.000000 -0.500000
v 0.000000 0.000000 -0.500000
v 0.500000 0.000000 -0.500000
f 1/1 2/2 5/5 4/4
f 2/2 3/3 6/6 5/5
f 4/4 5/5 8/8 7/7
f 5/5 6/6 9/9 8/8
f 10/10 11/11 14/14 13/13
f 11/11 12/12 15/15 14/14
f 13/13 14/14 17/17 16/16
f 14/14 15/15 18/18 17/17

Wavefront OBJ is a very simple text file format for storing 3d models and it's supported by all 3d modeling applications (eg. maya, 3dsmax, lightwave) so you can export and import your models very easily.

You can read more and the specs here:

http://www.fileformat.info/format/wavefrontobj/

I would recommend against making your own file format. The Wavefront OBJ is as simple as it gets and well specified.

Here's an example of a 2x2 plane. v is for vertex coordinates, f for description of faces (which vertices are connected):

v -0.500000 -0.000000 0.500000
v 0.000000 -0.000000 0.500000
v 0.500000 -0.000000 0.500000
v -0.500000 0.000000 0.000000
v 0.000000 0.000000 0.000000
v 0.500000 0.000000 0.000000
v -0.500000 0.000000 -0.500000
v 0.000000 0.000000 -0.500000
v 0.500000 0.000000 -0.500000
v -0.500000 -0.000000 0.500000
v 0.000000 -0.000000 0.500000
v 0.500000 -0.000000 0.500000
v -0.500000 0.000000 0.000000
v 0.000000 0.000000 0.000000
v 0.500000 0.000000 0.000000
v -0.500000 0.000000 -0.500000
v 0.000000 0.000000 -0.500000
v 0.500000 0.000000 -0.500000
f 1/1 2/2 5/5 4/4
f 2/2 3/3 6/6 5/5
f 4/4 5/5 8/8 7/7
f 5/5 6/6 9/9 8/8
f 10/10 11/11 14/14 13/13
f 11/11 12/12 15/15 14/14
f 13/13 14/14 17/17 16/16
f 14/14 15/15 18/18 17/17
想你只要分分秒秒 2024-07-13 08:41:10

我不知道有什么格式主动针对线框视图。 (仅限边/顶点)您几乎总是至少必须处理面。 幸运的是,除非您有非常具体的需求,但边缘列表线框渲染可以使用面部列表中的任何 API 来完成。

至于格式,OBJ 很好而且简单,虽然有点过时。 它也可能是最容易找到文档的格式。 Microsoft 的 X 文件非常适合快速而肮脏的渲染,但我一直偏爱 Quake 格式。 不过,它们往往非常面向游戏,因此包含许多您可能不想要的信息。

如果这些都不能满足您的需求,也许可以看看 COLLADA。 它本身可能不适用于您,但您可以将快速导出器编写为您自己的格式,仅包含边/顶点信息,此时您基本上已经支持地球上的每个建模包:)

I don't know of any formats that actively target wireframe views. (Edge/vertex only) You'll almost always have to deal with faces at the very least. The fortunate part there is that unless you have a very specific need for nothing but an edge list wireframe rendering can be done with just about any API from a face list.

As for the format, OBJ is good and simple, if a little outdated. It's also likely the easiest format to find documentation for. Microsoft's X files are great for quick and dirty rendering, but I've always been somewhat partial to the Quake formats. They tend to be very game-oriented, though, and as such include a lot of info you probably don't want.

If none of those meet your needs, maybe look into COLLADA. It probably won't work for you by itself, but you could write a quick exporter into your own format that only contains edge/vertex info, and at that point you essentially have support for every modeling package on the planet :)

任谁 2024-07-13 08:41:10

在文本文件中列出这些列表可能会更容易。 这是我首先想到的事情!

Might just be easier to do those lists in a text file. That's the first thing that came to mind for me!

不美如何 2024-07-13 08:41:10

我认为 POV-Ray 的 RAW 三角形格式最简单的。 在我看来,你真的不能再简单了。 我在几分钟内就实现了一个负载 - 这是一个非常非常简单的格式

POV-Ray's RAW triangle format is what I consider to be the simplest. You really can't get any simpler in my opinion. I implemented a load for this in a matter of minutes - it is a really really simple format.

叫嚣ゝ 2024-07-13 08:41:10

OBJ 是最广泛和最简单的,但如果您需要的不仅仅是顶点位置、法线和单个纹理坐标,它就会崩溃。 它根本不可扩展。 它也是基于文本的,因此在处理大网格时会遇到问题。

GTO 已成为一种新的交换格式。 它简单、快速且可扩展,并且有经过生产验证的开源代码来读取和编写它们:

Gto 文件格式

这已在多个 VFX 和游戏工作室的制作中使用,但编写加载程序的工作量与编写 OBJ 文件的工作量大致相同(其中一个示例是 OBJ 到 GTO 转换器)。

检查一下,帮助阻止 Collada 膨胀病毒的传播。

OBJ is the most widespread and simplest, but it breaks down if you need more than vertex position, normal, and a single texture coordinate. It's not extensible at all. It's also text based so it has trouble with large meshes.

GTO has been emerging as a new interchange format. It's simple, fast, and extensible, and there is a production-proven open source code to read and write them:

Gto File Format

This has been used in production in several VFX and game studios, and yet it's about the same amount of work to write a loader as an OBJ file (and one of the samples is an OBJ to GTO converter).

Check it out, and help stop the spread of the Collada bloat-virus.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文