【问题标题】:How to import VRML 2.0 on Meshlab如何在 Meshlab 上导入 VRML 2.0
【发布时间】:2017-09-22 00:45:22
【问题描述】:

我尝试在 Meshlab 上导入此 VRML 文件的文件:

#VRML 2.0 utf-8
PROTO my_sphere [ exposedField SFFVec3f xyz 0 0 0 ] {
    Transform {
        translation IS xyz
        children [
            Shape {
                appearance Appearance { material Material { 
diffuseColor 1.0 0.05 0.05 } }
                geometry Sphere { radius 0.66 }
            }
        ]
    }
}
my_sphere { xyz 0.0 0.0 0.119 } # 0
my_sphere { xyz 0.0 0.0 0.119 } # 1

我收到了错误:

Error encountered while loading file:
"/my_path/test.wrl"

File: /my_path/test.wrl
Error details: -- line 2 col 32: invalid FieldType
-- line 4 col 42: "{" expected

如何导入此类文件?我可以在 Blender 上轻松完成。

【问题讨论】:

  • 您的列表中 xyz 字段的类型拼写错误,应该是 SFVec3f。但是,即使进行此更改,Meshlab 2016 也不会导入。 Meshlab X3D/VRML 导入可能不支持 PROTO 语句。
  • web3d.org/x3d/content/examples/Basic/X3dSpecifications/… 的 X3D 示例的进一步实验——下载为 VRML97——表明 Meshlab 不支持球体和盒子的原始形状。看来只支持 IndexedTriangleSet 之类的网格节点
  • @VincentMarchetti 哦,那么,如果拼写错误,为什么它可以在 Blender 上工作?它是否被解释为其他东西?

标签: meshlab vrml


【解决方案1】:

除了原始示例中的拼写错误(应该是 SFVec3f,而不是 SFFVec3f)之外,Meshlab 版本 2016.12 不支持原始 Sphere 几何体。 Meshlab 确实支持使用带有 IndexedFaceSet 几何图形的“返回”Shape 的 PROTO 语句。这是一个示例 VRML97 场景,生成两个四面体实例作为网格定义的形状:

#VRML 2.0 utf-8
 PROTO my_tetrahedron [ exposedField SFVec3f xyz 0 0 0 ] {
     Transform {
         translation IS xyz
         children [
      Shape {
        appearance Appearance {
          material Material {
            diffuseColor 0.0 1.0 0.0
          }
        }
        geometry IndexedFaceSet {
          coordIndex [ 3 1 0 -1  3 2 1 -1  3 0 2 -1  0 1 2 -1]
          coord Coordinate {
            point [0.29 0.50 -0.20 0.29 -0.50 -0.20 -0.58 0.00 -0.20 0.00 0.00 0.61]
          }
        }
      }
         ]
     }
 }


# [Scene] ========== ========== ==========


my_tetrahedron { xyz 0.0 0.0 0.0 } 
my_tetrahedron { xyz -1.0 -1.0 -1.0 }

Meshlab 2016 确实将其作为两个网格导入。

建议原始问题的解决方案:将 VMRL 场景中的 Sphere 几何体替换为 IndexedFaceSet 定义的几何体

【讨论】:

    猜你喜欢
    • 2014-05-16
    • 2021-07-25
    • 2018-05-29
    • 1970-01-01
    • 2015-06-26
    • 2021-01-19
    • 2018-04-01
    • 1970-01-01
    • 2014-11-19
    相关资源
    最近更新 更多