Table of Contents
Chevron DownAPI Reference

Tiles3DLoader

Parses a 3D tile.

LoaderCharacteristic
File Extensions.b3dm,.i3dm, .pnts, .cmpt
File TypeBinary (with linked assets)
File Format3D Tiles
Data FormatData Formats
Decoder TypeAsynchronous
Worker Thread SupportNo
Streaming SupportNo *
SubloadersDracoLoader (.pnts), GLTFLoader (.b3dm, .i3dm)

* Streaming is not supported for individual tiles, however tilesets are streamed by loading only the tiles needed for the

Usage

Load a tileset file.

import {load} from '@loaders.gl/core';
import {Tiles3DLoader} from '@loaders.gl/3d-tiles';
const tilesetUrl = 'https://assets.cesium.com/43978/tileset.json';
const tilesetJson = await load(tilesetUrl, Tiles3DLoader);

To decompress tiles containing Draco compressed glTF models or Draco compressed point clouds:

import {load} from '@loaders.gl/core';
import {Tiles3DLoader} from '@loaders.gl/3d-tiles';
import {DracoWorkerLoader} from '@loaders.gl/draco';
const tileUrl = 'https://assets.cesium.com/43978/1.pnts';
const tile = await load(tileUrl, Tiles3DLoader, {DracoWorkerLoader, decompress: true});

Load a tileset and dynamically load/unload tiles based on viewport with helper class Tileset3D (@loaders.gl/tiles)

import {load} from '@loaders.gl/core';
import {Tileset3D} from '@loaders.gl/tiles';
import {Tiles3DLoader} from '@loaders.gl/3d-tiles';
import WebMercatorViewport from '@math.gl/web-mercator';

const tilesetUrl = 'https://assets.cesium.com/43978/tileset.json';
const tilesetJson = await load(tilesetUrl, Tiles3DLoader);
const tileset3d = new Tileset3D(tilesetJson, {
  onTileLoad: tile => console.log(tile)
});

const viewport = new WebMercatorViewport({latitude, longitude, zoom});
tileset3d.update(viewport);

// visible tiles
const visibleTiles = tileset3d.tiles.filter(tile => tile.selected);
// Note that visibleTiles will likely not immediately include all tiles
// tiles will keep loading and file `onTileLoad` callbacks

Options

OptionTypeDefaultDescription
3d-tiles.isTilesetBoolfalseWhether to load a Tileset file. If not specifies, will infer based on url extension.
3d-tiles.headersObjectnullUsed to load data from server

To enable parsing of DRACO compressed point clouds and glTF tiles, make sure to first register the DracoLoader.

Point cloud tie options

OptionTypeDefaultDescription
3d-tiles.decodeQuantizedPositionsBooleanfalsePre-decode quantized position on CPU

For i3dm and b3dm tiles:

OptionTypeDefaultDescription
3d-tiles.loadGLTFBooleantrueFetch and parse any linked glTF files

If options['3d-tiles'].loadGLTF is true, GLTF loading can be controlled by providing GLTFLoader options via the options.gltf sub options.

Notes about Tile Types

b3dm, i3dm

glTF file into a hierarchical Scenegraph description that can be used to instantiate an actual Scenegraph in most WebGL libraries. Can load both binary .glb files and JSON .gltf files.

Data formats

This section specifies the loaded data formats.

Tileset Object

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

FieldTypeContents
loaderObjectTiles3DLoader
rootObjectThe root tile header object
urlStringThe url of this tileset
typeStringValue is TILES3D. Indicates the returned object is a Cesium 3D Tiles tileset.
lodMetricTypeStringRoot's Level of Detail (LoD) metric type, which is used to decide if a tile is sufficient for current viewport. Used for deciding if this tile is sufficient given current viewport. Cesium use geometricError.
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.

FieldTypeContents
urlStringThe url of this tile.
contentUrlStringThe contentUrl of this tile.
boundingVolumeObjectA bounding volume in Cartesian coordinates that encloses a tile or its content. Exactly one box, region, or sphere property is required. (Reference)
lodMetricTypeStringLevel of Detail (LoD) metric type, which is used to decide if a tile is sufficient for current viewport. Used for deciding if this tile is sufficient given current viewport. Cesium use geometricError.
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.
idStringIdentifier of the tile, unique in a tileset
refineStringRefinement type of the tile, ADD or REPLACE
typeStringType of the tile, one of pointcloud (.pnts), scenegraph (.i3dm, .b3dm)
transformMatrixNumber[16]A matrix 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

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
attributesObjectEach attribute follows luma.gl accessor properties

attributes contains following fields

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

PointCloud Fields

FieldTypeContents
pointCountNumberNumber of points
colorNumber[3] or Number[4]Color of the tile when there are not attributes.colors

Scenegraph Fields

FieldTypeContents
gltfObjectcheck GLTFLoader for detailed spec