Skip to main content

3D Tiles Loaders

The 3D Tiles category defines a generalized representation of hierarchical geospatial data structures. Specific loaders for tiled 3D data return a standardized representation.

The 3D Tiles category can represent the major tiled 3D formats:

LoaderNotes
Tiles3DLoader
CesiumIonLoader
I3SLoader
PotreeLoader

Concepts

  • Tile Header Hierarchy - An initial, "minimal" set of data listing the hierarchy of available tiles, with minimal information to allow an application to determine which tiles need to be loaded based on a certain viewing position in 3d space.
  • Tile Header - A minimal header describing a tiles bounding volume and a screen space error tolerance (allowing the tile to be culled if it is distant), as well as the URL to load the tile's actual content from.
  • Tile Cache - Since the number of tiles in big tilesets often exceed what can be loaded into available memory, it is important to have a system that releases no-longer visible tiles from memory.
  • Tileset Traversal - Dynamically loading and rendering 3D tiles based on current viewing position, possibly triggering loads of new tiles and unloading of older, no-longer visible tiles.

Helper Classes

The @loaders.gl/tiles module provides classes that facilitate working with 3D Tiles loader category data.

Tileset Traversal Support

To start loading tiles once a top-level tileset file is loaded, the application can instantiate the Tileset3D class and start calling tileset3D.update(viewport).

Since 3D tiled data sets tend to be very big, the key idea is to only load the tiles actually needed to show a view from the current camera position.

The Tileset3D allows callbacks (onTileLoad, onTileUnload) to be registered that notify the app when the set of tiles available for rendering has changed. This is important because tile loads complete asynchronously, after the tileset3D.update(...) call has returned.

Coordinate Systems

To help applications process the position data in the tiles, 3D Tiles category loaders are expected to provide matrices are provided to enable tiles to be used in both fixed frame or cartographic (long/lat-relative, east-north-up / ENU) coordinate systems:

  • cartesian WGS84 fixed frame coordinates
  • cartographic tile geometry positions to ENU meter offsets from cartographicOrigin.

Position units in both cases are in meters.

For cartographic coordinates, tiles come with a pre chosen cartographic origin and precalculated model matrix. This cartographic origin is "arbitrary" (chosen based on the tiles bounding volume center). A different origin can be chosen and a transform can be calculated, e.g. using the math.gl Ellipsoid class.

Data Format

Loaders in the 3D Tiles category load data into a standardized format. This section specifies the data formats of objects loaded by 3D Tile category loaders.

Loaded data is typically returned in the form of pure data structures (rather than JavaScript classes), however for complex formats like 3D tiles, helper classes are provided which can be instantiated on the loaded data.

Data FormatHelper classDescription
TilesetContains "global" metadata about the tileset.
TileMetadata for one tile. Includes bounding volumes required to determine if tile content needs to be loaded in a given viewport.
Tile ContentActual content of a tile (geometry attributes etc).

Tileset Object

A single metadata object that needs to be loaded for each tileset. It contains "global" metadata and information that applies to all tiles in the tileset as well as information needed to correctly load additional tiles. The application is expected to keep a reference to the tileset object for each loaded tileset.

FieldTypeContents
typestringIndicates the type of the tileset, for instance i3s tileset.
urlstringThe url of this tileset
rootObjectThe root tile header object
lodMetricTypestringRoot's level of detail (LoD) metric type, which is used to decide if a tile is sufficient for current viewport. Only support maxScreenThreshold for now. Check I3S lodSelection for more details.
lodMetricValueNumberRoot's level of detail (LoD) metric value.

Tile Object

The following fields are guaranteed. Additionally, the loaded tile object will contain all the data fetched from the provided url.

Tiles are often loaded in bulk, however they may be loaded in pages or

FieldTypeContents
typestringE.g. mesh.
idstringIdentifier of the tile, unique in a tileset
refinestringRefinement type of the tile ADD or REPLACE
urlstringThe url of this tile.
contentUrlstringThe url of this tile.
featureUrlstringThe url of this tile.
textureUrlstringThe url of this tile.
boundingVolumeObjectA bounding volume in Cartesian coordinates converted from i3s node's mbs that encloses a tile or its content. Exactly one box, region, or sphere property is required.
lodMetricTypestringLevel of Detail (LoD) metric type, which is used to decide if a tile is sufficient for current viewport. Only support maxScreenThreshold for now. Check I3S lodSelection for more details.
lodMetricValuestringLevel of Detail (LoD) metric value.
childrenArrayAn array of objects that define child tiles. Each child tile content is fully enclosed by its parent tile's bounding volume and, generally, has more details than parent. for leaf tiles, the length of this array is zero, and children may not be defined.
contentstringThe actual payload of the tile or the url point to the actual payload. If option.loadContent is enabled, content will be populated with the loaded value following the Tile Content section

Tile Content

After content is loaded, the following fields are guaranteed. But different tiles may have different extra content fields.

FieldTypeContents
cartesianOriginNumber[3]"Center" of tile geometry in WGS84 fixed frame coordinates
cartographicOriginNumber[3]"Origin" in lng/lat (center of tile's bounding volume)
modelMatrixNumber[16]Transforms tile geometry positions to fixed frame coordinates
vertexCountNumberTransforms tile geometry positions to fixed frame coordinates
attributesObjectBinary typed arrays containing the geometry of the tile.
textureObjectLoaded texture by loaders.gl/image
featureDataObjectLoaded feature data for parsing the geometies (Will be deprecated in 2.x)

attributes contains following fields

FieldTypeContents
attributes.positionsObject{value, type, size, normalized}
attributes.normalsObject{value, type, size, normalized}
attributes.colorsObject{value, type, size, normalized}
attributes.texCoordsObject{value, type, size, normalized}

Each attribute follows luma.gl accessor properties.