• Stars
    star
    420
  • Rank 103,194 (Top 3 %)
  • Language
    TypeScript
  • License
    Apache License 2.0
  • Created over 8 years ago
  • Updated 5 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Validator for 3D Tiles 🚦

3D Tiles Validator

A validator for 3D Tiles.

A note about the repository structure

This repository originally contained multiple projects. Now, these projects are maintained in separate repositories:

Overview

The 3D Tiles validator can be used to validate 3D Tiles tilesets and their associated tile content data. It supports version 1.0 and version 1.1 of the 3D Tiles specification. The validator can be used as a command line tool, or as a library.

Note: Some of the implementation and interfaces may still change. This refers to the source code as well as details of the command line interface and report format.

Implemented Features

  • Validation of the JSON structure of the tileset.json file
  • Validation of the 3D Tiles Tile Formats
    • The supported tile formats are: Batched 3D Model (b3dm), Instanced 3D Model (i3dm), Point Cloud (pnts), Composite (cmpt)
    • glTF tile content is validated with the glTF Validator
  • Validation of implicit tilesets
  • Validation of 3D Tiles Metadata
    • This includes the validation of the JSON structure of the metadata, as well as the structure and ranges of metadata values, both for the JSON based representation and for the binary metadata that is stored in property tables
  • A basic validation of the 3DTILES_bounding_volume_S2 extension
  • Validation of tilesets that are contained in 3D Tiles package files (3TZ and 3DTILES files)

Installation

In order to install the validator locally into a directory, run

npm install 3d-tiles-validator

(If you want to work directly with a clone of the Git repository, see Developer Setup)

Command Line Usage

Validate a single tileset file

npx 3d-tiles-validator --tilesetFile specs/data/Samples/SparseImplicitQuadtree/tileset.json

The input file can either be a tileset JSON file, or one of the known tileset package files. The known package file formats are 3TZ (a package format based on ZIP), and 3DTILES (a package format based on SQLite). The type of the input is determined from the file extension, which may be .3tz or .3dtiles (case-insensitively). For example, to validate a 3TZ file:

npx 3d-tiles-validator --tilesetFile ./specs/data/tilesets/packages/validTilesetPackage.3tz

Validate a set of tileset files

npx 3d-tiles-validator --tilesetsDirectory specs/data/Samples/

This will validate all tileset files in the given directory and all its subdirectories. The tileset files are identified by matching the file name against the glob pattern **/*tileset*.json. The pattern can be configured with the tilesetGlobPattern parameter. For example, in order to treat all .json files as tileset files:

npx 3d-tiles-validator --tilesetsDirectory specs/data/Samples/ --tilesetGlobPattern **/*.json

Report Files

By default, validation reports are printed to the console.

When validating a single file, then the reportFile argument can be used to specify the output file for the validation report. For example:

npx 3d-tiles-validator --tilesetFile specs/data/Samples/TilesetWithFullMetadata/tileset.json --reportFile MY_REPORT.json

Alternatively, or when validating multiple files, the writeReports argument can be used to write report files into the same directory as the input files. The name of the report file will be derived from the input file name.

npx 3d-tiles-validator --tilesetsDirectory specs/data/Samples/ --writeReports

Option Files

Options for the validation process can be specified in a file that is given via the --optionsFile argument:

npx 3d-tiles-validator --optionsFile exampleOptions.json

The options represent the properties of the ValidationOptions class. For example, using the following exampleOptions.json file, then the validator will only validate the tileset JSON structure, but no tile content data:

{
  "validateContentData": false,
}

The following options will cause the validator to include B3DM- and GLB files in the validation process, but ignore all other content types:

{
  "includeContentTypes": [ "CONTENT_TYPE_B3DM", "CONTENT_TYPE_GLB" ]
}

The following options will cause the validator to exclude tileset files (i.e. external tilesets) during the validation:

{
  "excludeContentTypes": [ "CONTENT_TYPE_TILESET" ]
}

The options can also be part of a configuration file, as described in the next section.

Configuration Files

The command line arguments for a validator run can be summarized in a configuration file that is given with the --configFile argument. For example, when running the validator with

npx 3d-tiles-validator --configFile exampleConfig.json

using the following exampleConfig.json file

{
  "tilesetsDirectory": "specs/data/tilesets",
  "tilesetGlobPattern": "**/*.json"
}

then the validator will validate all files in the given directory that match the given glob pattern.

The configuration can also contain an options object. This object summarizes the validation options, as described in the Option Files section. For example:

{
  "tilesetsDirectory": "specs/data/tilesets",
  "tilesetGlobPattern": "**/*.json",
  "options": {
    "includeContentTypes": [ "CONTENT_TYPE_B3DM", "CONTENT_TYPE_GLB" ]
  }
}

This will cause the validator to validate all JSON files in the specified directory, but only consider B3DM- and GLB tile content data during the validation.

Developer Setup

When the validator is not installed as a package from NPM, but supposed to be used directly in a cloned repository, then the command line usage is as follows:

  • Clone the repository into the current directory:
    git clone https://github.com/CesiumGS/3d-tiles-validator
    
  • Change into the directory of the cloned repository:
    cd 3d-tiles-validator
    
  • Install the validator and all its dependencies:
    npm install
    

After this, ts-node can be used to directly execute the validator, using the same command line options as described above - for example, to validate a single tileset file:

npx ts-node src/main.ts --tilesetFile specs/data/Samples/SparseImplicitQuadtree/tileset.json

Library Usage

The basic usage of the validator as a library is shown here:

const { Validators } = require("3d-tiles-validator");

const resultPromise = Validators.validateTilesetFile("example.json");
resultPromise.then((result) => {
  console.log(result.serialize());
});

The Validators.validateTilesetFile receives a file name, and returns a promise to the ValidationResult, which can then be printed to the console. The second (optional) parameter is a ValidationOptions object that summarizes the options for the validation process (also see Option Files).

Validaton Result Filtering

Clients can perform basic filtering operations on a ValidationResult, in order to remove validation issues that are below a certain severity level, or warnings that are anticipated in a certain application context.

For example, a given validation result can be filtered to

  • include validation issues that have the severity ERROR
  • exclude validation issues that have the type EXTENSION_NOT_SUPPORTED

An example of applying such a filter to a given validation result is shown here:

const { Validators, ValidationIssueFilters, ValidationIssueSeverity } = require("3d-tiles-validator");

const resultPromise = Validators.validateTilesetFile("example.json");
resultPromise.then((result) => {
  const filteredResult = result
    .filter(ValidationIssueFilters.byIncludedSeverities(ValidationIssueSeverity.ERROR))
    .filter(ValidationIssueFilters.byExcludedTypes("EXTENSION_NOT_SUPPORTED"));
  console.log(filteredResult.serialize());
});

Note: The type strings that are used for describing and categorizing the validation issues are not part of the core API. These strings might change between minor- or patch releases. But changes will be pointed out in the change log.

Implementation Notes

See IMPLEMENTATION.md for implementation notes.

More Repositories

1

cesium

An open-source JavaScript library for world-class 3D globes and maps 🌎
JavaScript
12,828
star
2

3d-tiles

Specification for streaming massive heterogeneous 3D geospatial datasets 🌎
Batchfile
2,110
star
3

gltf-pipeline

Content pipeline tools for optimizing glTF assets. 🌐
JavaScript
1,915
star
4

obj2gltf

Convert OBJ assets to glTF
JavaScript
1,706
star
5

cesium-unreal

Bringing the 3D geospatial ecosystem to Unreal Engine
C++
924
star
6

cesium-native

C++
423
star
7

webglreport

A web page that reports a browser's WebGL capabilities, including supported extensions and implementation specific capabilities, such as the maximum number of texture units.
JavaScript
401
star
8

cesium-unity

Bringing the 3D geospatial ecosystem to Unity
C#
349
star
9

3d-tiles-tools

TypeScript
295
star
10

3d-tiles-samples

Sample tilesets for learning how to use 3D Tiles πŸ“š
JavaScript
274
star
11

cesium-webpack-example

The minimal recommended setup for an application using Cesium with Webpack.
JavaScript
246
star
12

quantized-mesh

Specification for streaming massive terrain datasets for 3D visualization.
238
star
13

cesium-unity-samples

Sample project for Cesium for Unity
C#
229
star
14

cesium-threejs-experiment

A small example for using Three JS on Cesium to emulate a combined scene.
JavaScript
187
star
15

cesium-unreal-samples

Getting Started Sample Project for Cesium for Unreal
183
star
16

cesium-workshop

An example application that visualizes and annotates a 3D city using the Cesium platform.
JavaScript
164
star
17

wetzel

Generate Markdown documentation from JSON Schema
JavaScript
133
star
18

cesium-google-earth-examples

Google Earth plugin API samples ported to Cesium
JavaScript
94
star
19

cesium-materials-pack

A Cesium plugin with procedurally-shaded materials such as bricks, wood, and noise patterns
JavaScript
85
star
20

cdb-to-3dtiles

Convert CDB to 3D Tiles
C++
76
star
21

cesium-o3de

Cesium for O3DE
C++
74
star
22

cesium-omniverse

Bringing the 3D geospatial ecosystem to Omniverse
C++
56
star
23

cesium-ion-rest-api-examples

Code examples for using the Cesium ion REST API 🌎
JavaScript
35
star
24

cesium-vite-example

The minimal recommended setup for an application using Cesium with Vite.
JavaScript
34
star
25

cesium-unreal-vr-tutorial

Unreal Engine project, assets, and code used in the Cesium for Unreal VR Tutorial Series
33
star
26

cesium-ion-blender-addon

Blender add-on for uploading and tiling models with Cesium ion. https://cesium.com
Python
22
star
27

collada2gltf-web-service

Simple Node.js web service to convert 3D models from COLLADA to glTF
JavaScript
20
star
28

cesium-ion-3ds-max-plugin

Autodesk 3DS Max plugin for uploading and tiling models with Cesium ion.
MAXScript
15
star
29

cesium-omniverse-samples

Sample projects for Cesium for Omniverse
14
star
30

3d-tiles-samples-generator

TypeScript
12
star
31

webstorm-plugin

Kotlin
8
star
32

cesium-ion-sketchup-extension

SketchUp extension for uploading and tiling models with Cesium ion.
Ruby
8
star
33

OpenPhillyGlobe

"Google Earth for Philadelphia" with open source and open data.
JavaScript
7
star
34

cesium-o3de-samples

Samples project for Cesium for O3DE
CMake
6
star
35

cesium-concierge

I automate common GitHub tasks
JavaScript
6
star
36

strip-pragma-loader

JavaScript
4
star
37

eslint-config-cesium

ESLint Configuration for Cesium
JavaScript
1
star
38

cesium-ion-plugin-template

1
star