3D模型:具有不同UV的顶点
我正在编写一个 python 脚本,它将 3D 模型文件从一种格式解析为另一种格式,并在存储顶点时注意到一个问题。似乎同一顶点在不同的面上可能有不同的 UV。
在编写脚本时,我假设所有顶点都有唯一的 UV,但现在看来这是一个错误的假设。
有没有通用的方法来存储面和顶点?
如果我有一个存储 UV、法线和坐标的顶点字典(暂时不会存储其他任何内容)和一个包含构成面的顶点列表的面字典,那就太好了,但是如果单个顶点在不同的面上呈现不同的 UV 值,则该方法将不起作用。
我一直试图避免存储每个顶点(例如将顶点与面一起存储,而不是引用顶点),但无法想出解决方法。
I am writing a python script that parses a 3D model file from one format to another and noticed a problem when storing vertices. It seems like the same vertex could have different UV's in different faces.
While writing the script I assumed all vertices would have unique UV's, but now it seems like a false assumption.
Is there a general way to store faces and vertices?
It would've been nice if I had a dictionary for vertices that stores UV's, normals, and coords (won't be storing anything else for now) and a dictionary of faces that contain a list of vertices that make up the face, but it won't work if a single vertex takes on different UV values in different faces.
I've been trying to avoid storing every single vertex (like storing the vertices with the faces rather than having references to the vertices) but can't come up with a workaround.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果顶点属于两个面之间的共享边,则需要存储两个面的纹理坐标。我通常将这些信息存储在三角形级别而不是顶点级别。
If the vertex belongs to a shared edge between two faces, you need to store texture coordinates of both faces. I usually store these info at triangle level not at vertex level.