Next generation 3dfiles (next) detailed explanation [5] 3dfiles of tile organization form expansion_ bounding_ volume_ S2

Posted by amelhedi on Fri, 21 Jan 2022 10:08:49 +0100

Depend on

3D Tiles 1.0

Optional and required

Must appear in both extensionsUsed and extensionsRequired arrays, i.e. "required".

1. General

S2 It is a program library for defining the grid framework of the unit sphere surface. A grid Cell (also known as Cell, Cell) will be divided into four sub cells by taking half horizontally and half vertically. The four boundary lines of the Cell are geodesics (i.e. "straight lines" along the ground).

The grid hierarchy of the surface defined by S2 has 6 root cells. Each root cell is obtained by projecting the unit cube onto the sphere.

Note to the translator: the description of the projection of the unit cube onto the sphere is actually inaccurate. Strictly speaking, it is the six geodesic quadrilateral obtained by the intersection of the four pyramids formed by the connection of each surface of the unit cube and the center of the sphere. See the figure below in this article.

Usually, the traditional GIS will project the earth ellipsoid onto a plane or a surface (cone, cylinder) that can be developed into a plane. For example, Mercator projection is projected onto a cylinder. Mercator has a well-known problem, that is, the closer to the pole, the greater the deformation.

S2 this projection method improves the problem of Mercator and has other advantages. It divides the ground surface into tiles with no strange endpoints, small deformation and almost equal tiles.

Based on the above characteristics, the 3D Tiles Next extension of the tile hierarchy defined by S2 is particularly suitable for tile data sets across the world.

2. Hierarchy

In the S2 hierarchy, each root grid geodesic quadrilateral (called "cell") can be subdivided into 30 levels. The following figure shows the legend of cell "1" and its 4 sub cells:

Level 0 (root Cell)Level 1 (sub level of root Cell)

The first row is the "1st" Cell and its sub cells of the earth cube, and the second row is the "1st" Cell and its four sub cells on the ellipsoid. The numbers "0c" and "14" on the sub cells are ignored temporarily, and the numbers will be explained in detail in the section "Cell ID" below.

S2 uses the modified Hilbert curve to encode the grid number in one-dimensional order, providing 64 bit ID for any cell at each level, and the cell at the highest level can be accurate to the centimeter space range.

Observe the S2 Hilbert curve as follows:

On the surface of the earth cubeOn the ellipsoid of the earth

3. Cell ID

The cell ID is encoded with 64 bit wide binary bits. The rules for bits from left to right are as follows:

  • Bits 0 ~ 3 are used to encode which root cell it belongs to, with a value range of 0 ~ 5 (6, expressed in binary as 000b to 110b, just)
  • From bit 4 to bit 63, it is the cell code of 29 levels from level 1 to level 30. Every 2 bits from left to right represent one level, because there are only 4 brother cells in the same level, and the two bits just represent the code of 4 cells;
  • Based on the above two rules, a 1 is added to indicate the end
  • To the right, fill in the unused digits with 0. For example, level 8 cells only need 8 × 2 + 3 + 1 = 20 bits

For example (the following i-th starts with 0, that is, 0 is the number of points caused by the cable):

001 1 000000000...000   1st root cell
001 01 10000000...000   The first sub cell of the first root cell
001 01 11 100000...000   The 3rd sub cell of the 1st sub cell of the 1st root cell
001 01 11 00 1000...000   The 1st sub cell of the 1st root cell, the 3rd sub cell, and the 0th sub cell

The above numbers are expressed in decimal, i.e

3458764513820540928
3170534137668829184
3386706919782612992
3332663724254167040

4. Token

In order to express the cell ID more easily and better indicate its level, first convert the binary cell ID to hexadecimal, and remove all trailing zeros, so as to get the token of the cell.

For the example in Section 3, the token is generated according to the above rules, that is:

3
2c
2f
2e4

After the translator's note is converted to hexadecimal, its character length is just the level of the unit (still 0 is the starting point of the index)

5. Space range box

The Cell of S2 describes a quadrilateral area on the ellipsoid of the earth and records the four corners of the quadrilateral. In order to form a spatial range box, the four corners are stretched along its normal direction on the ellipsoid (usually upward perpendicular to the surface).

At this time, minimumHeight is used to represent the bottom height of the cube in the space range, and maximumHeight is used to represent the top height. Note that the 0 value of these two heights is the earth ellipsoid, and the unit is meter.

When this extension described in this article represents the boundingVolume (space range box) of the tile object, the transform attribute of the tile object will be ignored.

If 3dfiles is used_ bounding_ volume_ S2 expansion, then it must be ensured that the tiles must be contiguous in space.

This extension can act on the boundingVolume property of a tile object or the boundingVolume property of the content property of a tile object.

When mapping the earth ellipsoid to the earth cube, S2 library provides three kinds of projections, namely linear, quadratic projection, tangent form and 3dfiles_ bounding_ volume_ S2 uses quadratic projection because it is accurate and effective.

The following is an example. Its cell ID token is in the form of "89c6c7":

Its approximate location is in the central city of Philadelphia, the United States. The minimum height is set to 0 and the maximum height is set to 1000 meters.

The objects in JSON are represented as follows:

"boundingVolume": {
  "extensions": {
    "3DTILES_bounding_volume_S2": {
      "token": "89c6c7",
      "minimumHeight": 0,
      "maximumHeight": 1000
    }
  }
}

Another example:

{
  "asset": {
    "version": "1.0"
  },
  "geometricError": 1000000,
  "extensionsUsed": [
    "3DTILES_bounding_volume_S2"
  ],
  "extensionsRequired": [
    "3DTILES_bounding_volume_S2"
  ],
  "root": {
    "boundingVolume": {
      "extensions": {
        "3DTILES_bounding_volume_S2": {
          "token": "3",
          "minimumHeight": 0,
          "maximumHeight": 1000000
        }
      }
    },
    "refine": "REPLACE",
    "geometricError": 50000,
    "children": [
      {
        "boundingVolume": {
          "extensions": {
            "3DTILES_bounding_volume_S2": {
              "token": "2c",
              "minimumHeight": 0,
              "maximumHeight": 500000
            }
          }
        },
        "refine": "REPLACE",
        "geometricError": 500000,
        "children": [
          {
            "boundingVolume": {
              "extensions": {
                "3DTILES_bounding_volume_S2": {
                  "token": "2f",
                  "minimumHeight": 0,
                  "maximumHeight": 250000
                }
              }
            },
            "refine": "REPLACE",
            "geometricError": 250000,
            "children": [
              {
                "boundingVolume": {
                  "extensions": {
                    "3DTILES_bounding_volume_S2": {
                      "token": "2ec",
                      "minimumHeight": 0,
                      "maximumHeight": 125000
                    }
                  }
                },
                "refine": "REPLACE",
                "geometricError": 125000
              }
            ]
          }
        ]
      }
    ]
  }
}

6. Use with implicit tile extensions

When this extension is associated with 3dfiles_ implicit_ When tiling extensions are used together, especially when the latter uses quadtree to organize tile indexes, the spatial range body of tiles follows the spatial hierarchical range rules defined in S2.

When 3dfiles_ implicit_ When the tiling extension uses an octree to organize the index of tiles, the segmentation of spatial range cuboids can also follow the scheme of S2, but on the basis of quadtree, the segmentation in the vertical direction will be located at the middle point of minimumHeight and maximumHeight. (please savor this point carefully. In the horizontal and vertical direction, the spatial range of octree is the same as that of quadtree, and the maximum and minimum value of cuboid is the same, and the vertical height is divided in half in the middle.)

As shown in the figure below

Cell with ID "04" in Token formatAfter quadtree segmentationAfter octree segmentation

In order to ensure the continuity of the Hilbert curve used in S2, the six projection planes of the earth cube rotate in the direction shown below.

The figure above shows the fourth and first root units. Readers can compare them.

Pay close attention to this point. When cooperating with the implicit tile segmentation scheme, the traversal order of odd faces is opposite to that of even faces.

For example, the first root cell is numbered counterclockwise, and the fourth root cell is numbered clockwise.

Availability information coding

When this extension is associated with 3dfiles_ implicit_ When tiling is used together, the coding order of tile availability data recorded in its subtree file must be consistent according to Morton index order, as shown in the following figure:

Example ①

The following is 3dfiles_ bounding_ volume_ S2 and 3dfiles_ implicit_ JSON examples used with tiling:

{
  "asset": {
    "version": "1.0"
  },
  "geometricError": 10000,
  "extensionsUsed": [
    "3DTILES_implicit_tiling",
    "3DTILES_bounding_volume_S2"
  ],
  "extensionsRequired": [
    "3DTILES_implicit_tiling",
    "3DTILES_bounding_volume_S2"
  ],
  "root": {
    "boundingVolume": {
      "extensions": {
        "3DTILES_bounding_volume_S2": {
          "token": "04",
          "minimumHeight": 0,
          "maximumHeight": 500000
        }
      }
    },
    "refine": "REPLACE",
    "geometricError": 5000,
    "content": {
      "uri": "content/{level}/{x}/{y}.glb"
    },
    "extensions": {
      "3DTILES_implicit_tiling": {
        "subdivisionScheme": "QUADTREE",
        "subtreeLevels": 4,
        "maximumLevel": 7,
        "subtrees": {
          "uri": "subtrees/{level}/{x}/{y}.subtree"
        }
      }
    }
  }
}

Example ②

The following example is 3dfiles_ bounding_ volume_ S2 represents the 6 root element grids of S2, which can obviously cover the whole world evenly:

Its JSON is

{
  "asset": {
    "version": "1.0"
  },
  "geometricError": 10000,
  "extensionsUsed": [
    "3DTILES_implicit_tiling",
    "3DTILES_bounding_volume_S2"
  ],
  "extensionsRequired": [
    "3DTILES_implicit_tiling",
    "3DTILES_bounding_volume_S2"
  ],
  "root": {
    "boundingVolume": {
      "region": [
        -3.141592653589793,
        -1.5707963267948966,
        3.141592653589793,
        1.5707963267948966,
        0,
        250000
      ]
    },
    "refine": "REPLACE",
    "geometricError": 10000,
    "children": [
      {
        "boundingVolume": {
          "extensions": {
            "3DTILES_bounding_volume_S2": {
              "token": "1",
              "minimumHeight": 0,
              "maximumHeight": 1000000
            }
          }
        },
        "refine": "REPLACE",
        "geometricError": 5000,
      },
      {
        "boundingVolume": {
          "extensions": {
            "3DTILES_bounding_volume_S2": {
              "token": "3",
              "minimumHeight": 0,
              "maximumHeight": 1000000
            }
          }
        },
        "refine": "REPLACE",
        "geometricError": 5000,
      },
      {
        "boundingVolume": {
          "extensions": {
            "3DTILES_bounding_volume_S2": {
              "token": "5",
              "minimumHeight": 0,
              "maximumHeight": 1000000
            }
          }
        },
        "refine": "REPLACE",
        "geometricError": 5000,
      },
      {
        "boundingVolume": {
          "extensions": {
            "3DTILES_bounding_volume_S2": {
              "token": "7",
              "minimumHeight": 0,
              "maximumHeight": 1000000
            }
          }
        },
        "refine": "REPLACE",
        "geometricError": 5000,
      },
      {
        "boundingVolume": {
          "extensions": {
            "3DTILES_bounding_volume_S2": {
              "token": "9",
              "minimumHeight": 0,
              "maximumHeight": 1000000
            }
          }
        },
        "refine": "REPLACE",
        "geometricError": 5000,
      },
      {
        "boundingVolume": {
          "extensions": {
            "3DTILES_bounding_volume_S2": {
              "token": "b",
              "minimumHeight": 0,
              "maximumHeight": 1000000
            }
          }
        },
        "refine": "REPLACE",
        "geometricError": 5000,
      }
    ]
  }
}

JSON Schema Specification

Code base implementation related cases

Topics: cesium