Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
T

threedtiles

> 编程语言
Open source

3DTiles viewer for three.js

400 stars0 likes0 views
WebsiteGitHub

About

3DTiles viewer for three.js

T H R E E D T I L E S : http://www.jdultra.com/

A faster 3DTiles viewer for three.js, now with OGC3DTiles 1.1 support.

Oh, also it supports gaussian splats! ( currently via KHR_gaussian_splatting_compression_spz )

contextsplat.xyz is a web tool that let's you convert 3dgs to OGC3DTILES directly in the browser, view them in a geospatial context and download them or a starter three.js app.

sample getting started projects

Getting started vanilla js:
app
code

GettingStarted RTF:
app
code

Demos temporarily down because of digital vandalism

Google Tiles overlay overlay high quality meshes over google tiles with some shader magic to avoid overlap

Windows desktop viewer A viewer for windows based on flutter and this library

Google Map Tile API google tiles in a geospatial framework ULTRAGLOBE

Photogrametry Some tiles converted from OBJ via proprietary ULTRAMESH tool

Point cloud vs Mesh

PBR material (GlTF conversion)

Occlusion culling (IFC conversion) Occlusion culling applied at the tile-loading level. This isn't just GPU occlusion culling, hidden tiles aren't even downloaded.

Instanced Tileset A multitude of identical meshes, each with its own LOD hiearchy but duplicate tiles are instanced

Getting started

DOC

JSDOC

install the library:

bash
npm install three @jdultra/threedtiles

Adding a tileset to a scene is as easy as :

import { OGC3DTile } from '@jdultra/threedtiles';

...

const ogc3DTile = new OGC3DTile({
    url: "https://storage.googleapis.com/ogc-3d-tiles/ayutthaya/tileset.json",
    renderer: renderer
});

scene.add(ogc3DTile);

It's up to the user to call updates on the tileset.

function animate() {
    requestAnimationFrame(animate);
    
    ogc3DTile.update(camera); // computes what tiles need to be refined and what tiles can be disposed.
    ogc3DTile.tileLoader.update(); // downloads, loads and caches tiles in optimal order.
    
    ...

}

It is discouraged to call the update functions outside the render loop in a setInterval for example. While that may work fine on desktop, mobile browsers tend to block an entire frame when a timeout triggers in it.

Mesh, Point-cloud and 3DGS to 3DTiles Converter

If you need to convert meshes to 3DTiles, from small assets to gigabytes of data, contact me for a trial on UltraMesh tool. It works for all types of meshes: photogrametry, BIM, colored or textured meshes with a single texture atlas or many individual textures. There's support for OBJ, IFC, Collada and glTF meshes and las/laz point clouds. I aim for optimal quality in terms of mesh, texture and tileset structure and for optimal streaming speed, with no limit to the size of the input data. Contact: [email protected]

Features

  • Handles nested tileset.json files which are loaded on the fly (a tileset.json may point to another tileset.json file as its child).
  • Allows tilesets transformations. Translate, scale and rotate a tilesets in real-time.
  • callback on loaded geometry to assign a custom material or use the meshes for computations.
  • Optionally load low detail tiles outside of view frustum for correct shadows and basic mesh present when the camera moves quickly.
  • Share a cache between tileset instances
  • Optimal tile load order
  • Occlusion culling
  • Instanced tilesets
  • Center tileset and re-orient geolocated data
  • quantization, draco, mshopt and ktx2 compression support
  • point clouds (only through gltf/glb tiles)
  • loading strategy options ("incremental" or "immediate")
  • Gaussian splats (unofficial gltf extension for now)

OGC3DTiles 1.1 are supported. There is no plan to support .pnts, .i3dm or .cmpt tiles as these formats are deprecated in favor of glb/gltf tiles.

geometric Error Multiplier

The geometric error multiplier allows you to multiply the geometric error by a factor.

tileset.setGeometricErrorMultiplier(1.5);

you may also set this value at initialization:

const ogc3DTile = new OGC3DTile({
    url: "https://storage.googleapis.com/ogc-3d-tiles/ayutthaya/tileset.json",
    renderer: renderer,
    geometricErrorMultiplier: 2.0
});

A lower value will result in lower detail tiles being loaded and a higher value results in higher detail tiles being loaded. A value of 1.0 is the default.

geometricErrorMultiplier vs maxScreenSpaceError

Many viewers use the maxScreenSpaceError instead of a geometric error multiplier and there is a direct correspondance. A geometricErrorMultiplier of 1 corresponds to a maxScreenSpaceError of 16. A geometricErrorMultiplier of 0.5 corresponds to a maxScreenSpaceError of 32.

distance bias

The distance bias allows loading more or less detail close to the camera relative to further away. The distance bias simply applies an exponent on tile distance to the camera so you have to balance it out manually with the geometricErrorMultiplier.

For example, if you want to load more detail close to the camera, you might do something like this:

const ogc3DTile = new OGC3DTile({
    url: "https://storage.googleapis.com/ogc-3d-tiles/ayutthaya/tileset.json",
    renderer: renderer,
    geometricErrorMultiplier: 10.0,
    distanceBias: 1.5
});

In this case the higher distance bias will cause less detail to be loaded overall since all calculated distances get raised to the power 1.5. To compensate, the geometricErrorMultiplier is set at a higher value.

These values need to be adjusted manually based on what is considered relatively close or far from the camera and truly depends on your scene and the relative distance of the camera to the tiles during normal navigation. In other words, it's impossible to have magic bullet values the LOD switch distance can be fine-tuned through those parameters.

You can change the distance bias for a tileset at any time:

tileset.setDistanceBias(1.5);

loading strategy

Incremental

Incremental loading is the default and loads all intermediate levels incrementally and keeps them in memory. While this gives a direct feedback on loading progress, the CPU memory footprint is large and overall loading speed is slower than with "immediate" mode.

To explicitely set the incremental loading strategy:

const ogc3DTile = new OGC3DTile({
    url: "https://storage.googleapis.com/ogc-3d-tiles/ayutthaya/tileset.json",
    renderer: renderer,
    loadingStrategy: "INTERMEDIATE"
});

Immediate

Immediate loading skips intermediate LODs and immediately loads the ideal LOD. Less data is downloaded (faster load time) and less data is kept in CPU memory but holes will appear until the tiles are loaded.

To set the immediate loading strategy:

const ogc3DTile = new OGC3DTile({
    url: "https://storage.googleapis.com/ogc-3d-tiles/ayutthaya/tileset.json",
    renderer: renderer,
    loadingStrategy: "IMMEDIATE"
});

PERLEVEL

PERLEVEL loading loads all required tiles of a given level before moving to the higher level of detail tiles.

To set the PERLEVEL loading strategy:

const ogc3DTile = new OGC3DTile({
    url: "https://storage.googleapis.com/ogc-3d-tiles/ayutthaya/tileset.json",
    renderer: renderer,
    loadingStrategy: "PERLEVEL"
});

load tiles outside of view

By default, only the tiles that intersect the view frustum are loaded. When the camera moves, the scene will have to load the missing tiles and the user might see some holes in the model. Instead of this behaviour, you can force the lowest possible LODs to be loaded for tiles outside the view so that there are no gaps in the mesh when the camera moves. This also allows displaying shadows from parts of the scene that are not in the view.

const ogc3DTile = new OGC3DTile({
    url: "https://storage.googleapis.com/ogc-3d-tiles/ayutthaya/tileset.json",
    renderer: renderer,
    loadOutsideView: true
});

draw bounding volume

Draw bounding volumes around visible tiles

const ogc3DTile = new OGC3DTile({
    url: "https://storage.googleapis.com/ogc-3d-tiles/ayutthaya/tileset.json",
    renderer: renderer,
    drawBoundingVolume: true
});

Google Maps 3D Tiles

Google maps 3DTiles can be loaded similarly. The API key mechanism requires that a token be passed as a query param to all fetched tiles.

const ogc3DTile = new OGC3DTile({
    url: "https://tile.googleapis.com/v1/3dtiles/root.json",
    queryParams: { key: "Insert your own google maps API key here" },
    yUp: false, // this value is normally true by default
    renderer: renderer,
    loadOutsideView: true
});

Copyright info

This is mostly specific to google tiles but may be used by other vendors.

Google requires that, copyright info for producers of the 3D data be displayed. A global function #getOGC3DTilesCopyrightInfo returns the list of vendors that need to be displayed.

import { OGC3DTile, getOGC3DTilesCopyrightInfo } from "@jdultra/threedtiles';

...

animate(){
    requestAnimationFrame( animate );
    googleTiles.update(camera);
    tileLoader.update();
    ...
    console.log(getOGC3DTilesCopyrightInfo());
}

Callback

onLoadCallback

Add a callback that is called once when the first tile is loaded and geometry is available. This can be useful to position the tileset at a specific location when it is not centered on origin for example.

const ogc3DTile = new OGC3DTile({
    url: "https://storage.googleapis.com/ogc-3d-tiles/ayutthaya/tileset.json",
    renderer: renderer,
    onLoadCallback: tileset => {
            console.log(tileset.json.boundingVolume);
        }
});

Note that the callback is called with the OGC3DTile object as parameter and that this object has a "json" property giving you access to the original tileset.json with it's transform, geometric error, bounding volume, etc...

Mesh callback

Add a callback on loaded tiles in order to set a material or do some logic on the meshes.

const ogc3DTile = new OGC3DTile({
    url: "https://storage.googleapis.com/ogc-3d-tiles/ayutthaya/tileset.json",
    renderer: renderer,
    meshCallback: mesh => {
            mesh.material.wireframe = true;
            mesh.material.side = THREE.DoubleSide;
        }
});

Update

Calling OGC3DTile#update gives a direct feedback on the state of the tileset:

function animate() {
    requestAnimationFrame(animate);
    
    ogc3DTile.update(camera); // computes what tiles need to be refined and what tiles can be disposed.
    const state = ogc3DTile.tileLoader.update(); // downloads, loads and caches tiles in optimal order.
}

In the example above, the "state" object may look like this:

{
    numTilesLoaded: 82, 
    numTilesRendered: 82, 
    maxLOD: 9, 
    percentageLoaded: 1
}
  • "numTilesLoaded" gives the number of tiles in the tileset that are loaded and should be visible (including intermediate LODs for the "incremental" loading strategy).
  • "numTilesRendered gives the number of tiles currently rendered.
  • "maxLOD" highest LOD currently rendered
  • "percentageLoaded" property gives an indication of the loading progress. Note that the loading progress may go back and forth a bit while the tree is being expanded but a value of 1 me

Issues· 6 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

JavaScript

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category编程语言
PricingOpen source

> Related tools

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言