I

N

D

E

X

  1. PQO:高仿 3D tiles 规范

  2. tile: Dict 或 String

  3. example

  4. transform: Vector[16]

  5. OBB: Vector[12]

  6. AABB: Vector[6]

  7. sphere: Vector[4]

  8. RTC_CENTER: Vector[3]

  9. geometricError: Vector[1]

  10. uri: String

  11. refine: 枚举string

  12. children: List

  13. 几何变换的顺序

  14. 包围体

PQO:高仿 3D tiles 规范

PQO (Progressive Quantized Object) 是 3D tiles 格式的简化版本,扁平化了一些字典字段,去除了 GIS 相关的属性,增加了 RTC_CENTER 等字段。本格式中所有对象都是 tile,tile 之间通过 children 字典嵌套。

  • 空间直角坐标系:左手(同 UE4),+Z轴向上

  • 所有距离单位:厘米(同UE4)

  • 所有角度单位:弧度

tile: Dict 或 String

tile字典的所有属性:

  • transform: Vector[16]

  • OBB: Vector[12]

  • AABB: Vector[6]

  • sphere: Vector[4]

  • RTC_CENTER: Vector[3]

  • geometricError: Vector[1]

  • uri: String

  • refine: Enum(String)

  • children: List

除此之外,可自定义任何字段。

example

{
  "version": 1,
  "visibleGeometricError":200
  "geometricError": 50,
  "AABB": [-1, -1, -1, 1, 1, 1],
  "RTC_CENTER": [0, 0, 0],
  "pak":pak的路径字符串
  "uri": "pak内部的mesh路径",
  "children": [
    {
      "AABB": [-1, -1, -1, 1, 1, 1],
      "geometricError": 20,
      "uri": "pak内部的mesh路径",
      "transform":字符串,
    },
    {
      "AABB": [-1, -1, -1, 1, 1, 1],
      "geometricError": 20,
      "uri": "pak内部的mesh路径",
      "transform":字符串,
      "children": 
    [
       {
          "AABB": [-1, -1, -1, 1, 1, 1],
          "geometricError": 10,
          "uri": "pak内部的mesh路径",
          "transform":字符串,
        }
    ]
    },
    {
         "AABB": [-1, -1, -1, 1, 1, 1],
       "geometricError": 10,
       "uri": "路径.json",
    }
  ]
}

 

transform: Vector[16]

默认:

[
  1, 0, 0, 0,
  0, 1, 0, 0,
  0, 0, 1, 0,
  0, 0, 0, 1
]

The transform property is a 4x4 affine transformation matrix, stored in column-major order, that transforms from the tile's local coordinate system to the parent tile's coordinate system—or the tileset's coordinate system in the case of the root tile.

OBB: Vector[12]

[
  X, Y, Z,
  length.x, length.y, length.z,
  width.x,  width.y,  width.z,
  height.x, height.y, height.z
]

Oriented Bounding Box:有向包围盒,可任意旋转的长方体。 

OBB由中心点和3个方向向量定义,3个向量相互垂直,分别代表OBB的长宽高的方向与大小(一半)。

AABB: Vector[6]

[
  X, Y, Z,
  length, width, height
]

Axis Aligned Bounding Box:轴对齐包围盒,类似3d tiles中的region类型,但region是由最小顶点和最大顶点的坐标来定义,我们的AABB由中心点和长宽高来定义,目的是与UE保持一致。

sphere: Vector[4]

[x, y, z, radius]

包围球:最简单的包围体,中心点坐标+半径

RTC_CENTER: Vector[3]

[x, y, z]

RelativeToCenter:模型及包围体的原点坐标

geometricError: Vector[1]

和3d tiles一样,几何误差代表当前lod与真实物体的最大差距(估值),需要每一帧计算出屏幕误差(单位:像素),计算公式:

sse = (geometricError ⋅ screenHeight) / (tileDistance ⋅ 2 ⋅ tan(fovy / 2))

The geometricError property is used to quantify the visual error that would occur if the

tileset was not rendered. When the visual error exceeds a certain threshold, then the

tileset and the tiles that it contains are considered for rendering.

uri: String

3D模型文件路径,或者其他json文件的引用。当uri为json的引用时,children字段失效。

refine: 枚举string

refine决定在相机进入子叶后,当前tile是否滞留

default: "REPLACE"

  • "REPLACE": 不滞留

  • "ADD": 滞留

children: List

子成员列表,成员类型可以是一个 tile(字典),也可以是一个 tile 的引用(string)

几何变换的顺序

模型顶点最终的绝对坐标需要经过以下几个步骤得出:

  • 模型内部的变换,如 gltf 的 node 嵌套

  • transform 字段的变换

  • RTC_CENTER 字段的平移

  • 父级的变换...

包围体

与3d tiles包围体的区别:

  • 支持3种包围体:OBB、AABB、sphere。3 选 1。

  • 包围体应当包围transform之后的模型

  • 包围体的原点是RTC_CENTER,而不是世界原点