glTF-Validator
Tool to validate glTF assets.
Validation is performed against glTF 2.0 specification.
Validator writes a validation report (in JSON-format) with all found issues and asset stats.
Live drag-n-drop tool: http://github.khronos.org/glTF-Validator
NPM package: https://www.npmjs.com/package/gltf-validator
Implemented features
- JSON syntax check and GLBv2 file format correctness.
- Asset description validation
- All properties and their types from JSON-Schemas (including implicit limitations on valid values).
- Validity and compatibility of internal references.
- Correctness of
Data URIencoding.
- Binary buffers validation
- Forbidden or incorrect accessor values (e.g.,
NaN, invalid quaternions, indecomposable matrices, etc). accessor.minandaccessor.maxvalues.- Sparse accessors encoding.
- Animation inputs and outputs.
- Forbidden or incorrect accessor values (e.g.,
- Images validation
- Warning on non-power-of-two dimensions.
- Full list of detectable issues.
Usage
You can use hosted web front-end tool. It works completely in the browser without any server-side processing.
Command-line tool
Installing from source code
Prerequisites
- Download and install Dart SDK for your platform.
- Add Dart SDK
binfolder to your PATH. - Add packages
binfolder to your PATH (~/.pub-cache/binfor Linux and Mac;%APPDATA%\Pub\Cache\binfor Windows).
glTF-Validator
- Clone this repository,
masterbranch. - From the repository root folder, run
pub getto get dependencies. - Run
pub global activate --source path ./to addgltf_validatorexecutable to your PATH.
Installing from behind a corporate firewall
pub get downloads dependencies from Google's pub.dartlang.org server over HTTPS. If you need to specify a proxy, follow these steps:
- Set
https_proxyorHTTPS_PROXYenvironment variable in formhostname:port. - If the proxy requires credentials, use this syntax:
username:password@hostname:port.
pub get validates server's SSL certificate. If your corporate network interferes with SSL connections, follow these steps to get pub running.
- Save your corporate self-signed root certificate as X.509 file.
- (Linux only) Try to add your cert to
/etc/pki/tls/certs/ca-bundle.crtor/etc/ssl/certs. - If that doesn't work or if you're on Windows, add environment variable
DART_VM_OPTIONSwith value--root-certs-file=<cert_file>.
After doing this, pub get should be able to download dependencies successfully.
Usage
Usage: gltf_validator [<options>] <input>
Validation report will be written to `<asset_filename>_report.json`.
If <input> is a directory, validation reports will be recursively created for each glTF asset.
Validation log will be printed to stderr.
Shell return code will be non-zero if at least one error was found.
-r, --[no-]validate-resources Validate contents of embedded and/or referenced resources (buffers, images).
-p, --[no-]plain-text Print issues in plain text form to stderr.
-a, --[no-]all-issues Print all issues to plain text output.
-c, --config YAML configuration file with validation options. See docs/config-example.yaml for details.
Building
Drag-n-Drop Web Tool
To build a drag-n-drop online validation tool (as hosted here), follow these steps after installation:
- Run
pub run grinder web. - All needed files will be written to
build/webdirectory.
Dart Snapshot
To build a source snapshot for more convenient deployment, follow these steps after installation:
- Run
pub run grinder snapshot. - Snapshot will be written to
build/bin/gltf_validator.snapshot.
It may be used like this:
$ dart gltf_validator.snapshot -r -p -a ./path_to_models/
Note, that you have to use the same Dart SDK version for building and running the snapshot. For deployment, you will need only two files: the snapshot and dart executable.
You may opt to build an application snapshot for better start-up time. Keep in mind that application snapshots are CPU architecture and operating system specific so a snapshot created, e.g., on a IA32 Linux VM cannot run on an x64 macOS VM. To build an application snapshot, follow these steps after installation:
- Run
pub run grinder snapshot-app. - Snapshot will be written to
build/bin/gltf_validator.snapshot.
NPM Package
To build an npm package for use in Node.js environment, follow these steps after installation:
- Run
pub run grinder npm. gltf-validatornpm package will be written tobuild/node.
Refer to the npm package documentation for additional information.
Publishing
To publish an npm package, follow these steps after installation:
- Run
pub run grinder npm-publish. gltf-validatornpm package will be built tobuild/nodeand published to npm registry usingnpm publish.
Validation Issues List
To generate ISSUES.md, follow these steps after installation:
- Run
pub run grinder issues. ISSUES.mdfile will be written to the repo root.
Known Issues
- Web and npm versions cannot differentiate between JSON integers and floats of the same value, e.g.,
1vs1.0. - JSON charset encoding restrictions are not enforced.
