GithubHelp home page GithubHelp logo

cesiumgs / 3d-tiles-validator Goto Github PK

View Code? Open in Web Editor NEW
409.0 34.0 157.0 9.39 MB

Validator for 3D Tiles :vertical_traffic_light:

Home Page: https://cesium.com

License: Apache License 2.0

JavaScript 0.23% TypeScript 99.77%
3d-tiles

3d-tiles-validator's Introduction

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

Validate a tile content file

npx 3d-tiles-validator --tileContentFile specs/data/gltfExtensions/FeatureIdAttributeAndPropertyTableFeatureIdNotInRange.gltf

The input file can be any of the content types that are supported by the validator. This includes B3DM, I3DM, PNTS, CMPT, and glTF/GLB files. The type of the file will be determined, and if it is not a known type, then a validation warning will be created.

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.

3d-tiles-validator's People

Contributors

analyticalgraphics avatar austineng avatar bagnell avatar ggetz avatar huiyiqun avatar ianlilleyt avatar javagl avatar judyweng avatar lasalvavida avatar likangning93 avatar lilleyse avatar loshjawrence avatar mramato avatar ottaviohartman avatar pjcozzi avatar rms13 avatar rudraksha20 avatar samulus avatar sanjeetsuhag avatar shehzan10 avatar sumitshyamsukha avatar yvin3d avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

3d-tiles-validator's Issues

Unpack a .3dtiles database file

It would be convenient to have a stage that takes a .3dtiles file and unpacks it to a tileset folder. It should ungzip tiles in the database.

How can I open and read b3dm file?

I'm a totally newbie in this area. I need to read a header of b3dm file. I used eclipse and read the file but I realized I can't read header section cuz it's binary section. Is there some tools to read it? I just want to read a source code of my b3dm file

npm run samples-generator error

Node version: v4.8.3
Also tried with: v6.10.3

$ node bin/3d-tiles-samples-generator.js
Unhandled rejection TypeError: Cannot read property 'webgl2' of undefined
at combineShader (/var/www/html/3d/3d-tiles-tools/samples-generator/node_modules/cesium/Source/Renderer/ShaderSource.js:247:20)
at ShaderSource.createCombinedVertexShader (/var/www/html/3d/3d-tiles-tools/samples-generator/node_modules/cesium/Source/Renderer/ShaderSource.js:334:16)
at patchProgram (/var/www/html/3d/3d-tiles-tools/samples-generator/node_modules/gltf-pipeline/lib/octEncodeNormals.js:169:21)
at /var/www/html/3d/3d-tiles-tools/samples-generator/node_modules/gltf-pipeline/lib/octEncodeNormals.js:94:21
at /var/www/html/3d/3d-tiles-tools/samples-generator/node_modules/gltf-pipeline/lib/getAccessorsForSemantic.js:31:33
at Promise._execute (/var/www/html/3d/3d-tiles-tools/samples-generator/node_modules/bluebird/js/release/debuggability.js:300:9)
at Promise._resolveFromExecutor (/var/www/html/3d/3d-tiles-tools/samples-generator/node_modules/bluebird/js/release/promise.js:483:18)
at new Promise (/var/www/html/3d/3d-tiles-tools/samples-generator/node_modules/bluebird/js/release/promise.js:79:10)
at getAccessorsForSemantic (/var/www/html/3d/3d-tiles-tools/samples-generator/node_modules/gltf-pipeline/lib/getAccessorsForSemantic.js:18:12)
at /var/www/html/3d/3d-tiles-tools/samples-generator/node_modules/gltf-pipeline/lib/octEncodeNormals.js:46:9
at Promise._execute (/var/www/html/3d/3d-tiles-tools/samples-generator/node_modules/bluebird/js/release/debuggability.js:300:9)
at Promise._resolveFromExecutor (/var/www/html/3d/3d-tiles-tools/samples-generator/node_modules/bluebird/js/release/promise.js:483:18)
at new Promise (/var/www/html/3d/3d-tiles-tools/samples-generator/node_modules/bluebird/js/release/promise.js:79:10)
at octEncodeNormals (/var/www/html/3d/3d-tiles-tools/samples-generator/node_modules/gltf-pipeline/lib/octEncodeNormals.js:36:12)
at Function.Pipeline.processJSONWithExtras (/var/www/html/3d/3d-tiles-tools/samples-generator/node_modules/gltf-pipeline/lib/Pipeline.js:116:28)
at /var/www/html/3d/3d-tiles-tools/samples-generator/node_modules/gltf-pipeline/lib/Pipeline.js:60:29

Validator - validateB3dm header

@JudyWeng

Write a lib file called validateB3dm that takes a Buffer containing the contents of a b3dm (like as returned by readTile) and checks that it is valid according the the b3dm spec. For now just check that:

magic is "b3dm"
version is 1
byteLength is equal to the Buffer's length
batchTableJSONByteLength - skip for now, will require more validation later
batchTableBinaryByteLength - skip for now, will require more validation later
batchLength - skip for now, this is dependent on the glTF within the b3dm

This issue will get more involved and will eventually extend to the other tile formats.

Validator - Bounding Volume Spatial Coherence

For CesiumGS/3d-tiles-tools#9
@sumitshyamsukha

Let's do this one now:

tile.content.boundingVolume, when defined, is completely inside tile.boundingVolume (use Cesium's functions)

There are three bounding volume types: region, box, and sphere. They are defined here: https://github.com/AnalyticalGraphicsInc/3d-tiles/blob/master/schema/boundingVolume.schema.json

If a tile has a content bounding volume, check that it is inside it's bounding volume. To visualize what a bounding volume / content bounding volume looks like, go to the 3D Tiles Sandcastle when running the 3d-tiles branch in Cesium and check out the BV On/Off and Contents BV On/Off buttons.

We'll need support the following checks:

  • Region inside region
  • Box inside region
  • Sphere inside region
  • Sphere inside sphere
  • Region inside sphere
  • Box inside sphere
  • Box inside box
  • Region inside box
  • Sphere inside box

I'll update with ideas for solving some of these, but to start region inside region should be pretty straightforward. Just need to check that the west/south/east/north/min/max are within the other's values.

Validator - tileset geometric error

@sumitshyamsukha let's work on this one now.

We're going to start to validate tilesets now that we can read them with readTileset. Create a new file called validateTileset. It will take one argument, a JSON object. It will return a promise that resolves with two parameters - (1) a boolean for whether the tileset is valid (2) the error message if the tileset is not valid. Right now I don't expect the function to be asynchronous, but in the future it definitely will be. To return a promise for now just do return Promise.resolve(valid, errorMessage). This creates a promise and resolves it immediately.

For the actual validation you will need to traverse the tree starting at the root and check the following conditions:

  • Going down the tree, a tile's geometricError must be <= to the parent tile's geometricError.
  • Likewise, root.geometricError must be <= the tileset's geometricError.

This tree traversal will also be used to support more validation later, like checking bounding volumes and other things, so keep it organized.

For more background on geometric error, check out this section of the spec: https://github.com/AnalyticalGraphicsInc/3d-tiles#tilesetjson

In addition create a file called validateTilesetSpec which will test the following cases:

  • Valid tileset - test that a valid tileset JSON passes. Instead of using an existing file, create a test tileset straight in JSON. Example. Since we will have many tileset tests, including a lot of incorrect tilesets, it's better define them directly in the code rather than clog the specs/data folder. An example JSON you can test with is:
{
  "asset": {
    "version": "0.0"
  },
  "geometricError": 240,
  "root": {
    "boundingVolume": {
      "region": [-1.3197209591796106, 0.6988424218, -1.3196390408203893, 0.6989055782, 0, 88]
    },
    "geometricError": 70,
    "refine": "add",
    "children": [
      {
        "boundingVolume": {
          "region": [-1.3197209591796106, 0.6988424218, -1.31968, 0.698874, 0, 20]
        },
        "geometricError": 50,
        "content": {
          "url": "a.b3dm"
        },
        "children": [
          {
            "boundingVolume": {
              "region": [-1.3197209591796106, 0.6988424218, -1.31968, 0.698874, 0, 10]
            },
            "geometricError": 0,
            "content": {
              "url": "b.b3dm"
            }
          }
        ]
      },
      {
        "boundingVolume": {
          "region": [-1.31968, 0.6988424218, -1.3196390408203893, 0.698874, 0, 20]
        },
        "geometricError": 0,
        "content": {
          "url": "c.b3dm"
        }
      }
    ]
  }
}
  • Invalid tileset (1) - use the same example above but change b.b3dm geometric error to 100 so it is greater than its parent. Instead of having multiple large JSONs in the file, use the clone npm package to clone the JSON, modify the geometric error, then run it through validateTileset. Check that the promise returns with valid as false and the appropriate error message.
  • Invalid tileset (2) - Change the root's geometric error to 300 so it is greater than the tileset's geometric error. Do the same steps as above.

As a final step for this pull request, we will want to be able to run the validator from the command line. We want to support a command like node bin/3d-tiles-validator.js specs/data/Tileset/tileset.json which outputs whether the tileset is valid or not to the console. You will want to model bin/3d-tiles-validator.js after https://github.com/AnalyticalGraphicsInc/3d-tiles-tools/blob/master/tools/bin/3d-tiles-tools.js, but keep it simple for now. The steps are: given an input tileset.json file, call readTileset to get the JSON, then call validateTileset. When the validateTileset resolves it should have the boolean and error message from the validation, which you can print to the console. You will also need to update the README, which you can also model after the tools project.

So this PR has several major components to it that will be utilized by all other aspects of the validator. Write validateTileset and validateTilesetSpec first for me to review, and then when that's all set write 3d-tiles-validator.js. Let me know how it goes!

Validator - check asset.version

@Rudraksha20

Every tileset should have a top-level asset property that contains a version property. The version should always be '1.0'.

The code changes will go in validateTileset.js. Also add a test to validateTilesetSpec. You can model the test after returns error message when the top-level geometricError is missing.

Validator - validate batch table JSON against schema

@JudyWeng

From the roadmap:

Validate Batch Table is valid JSON and follows the schema (have a generic validation function for this).

For this you will need to extract the batch table JSON from the buffer, using the batchTableJSONByteOffset field of the header, and then use Node's Buffer class to convert to a string, and then JSON.parse. This whole step of getting the JSON from a buffer and byte offset can be made into its own helper file since it will be used by every tile format.

You should also extract the batch table binary. This doesn't need its own helper function because it should be a one-liner in Node.

Now add a new file called validateBatchTable which takes the batch table JSON and batch table binary. In here the first step will be to validate the JSON against the schema. I think the best idea for getting the schema is getting it directly from the github url where it is hosted. For this you can use Cesium's loadJson function. Once you have the schema, use a node library to validate the batch table JSON against the schema JSON. I believe a good library for this is https://www.npmjs.com/package/ajv.

The batch table schema is located here: https://github.com/AnalyticalGraphicsInc/3d-tiles/blob/master/schema/batchTable.schema.json

b3dm/i3dm to glb

We'd like the opposite of glbtob3dm, which extracts the glb from a b3dm and i3dm. The batch table would be ignored and the batch id vertex attribute could just stay as part of the glb since gltf-pipeline could later be used to optimize it out when this is used for more than just debugging.

Validator - readTileset

@sumitshyamsukha

Write a lib file called readTileset that loads a tileset.json file, check that the contents are valid JSON, and return the JSON object. Throw an error if the JSON is not valid.

Tools - Is there any tool process an entire tileset?

https://github.com/AnalyticalGraphicsInc/3d-tiles-tools/blob/afb9decfcc64f14cb96001168617fc8c10f6298f/tools/lib/glbToB3dm.js#L21

glbToB3dm
Creates a b3dm from a glb with an empty batch table. Since this tool does not process an entire tileset, it cannot be used with the Pipeline tool.

Is there any tool can process an entire tileset?

The B3dm created by current glbToB3dm tool can't generate featuretable and batchtable. So I can't use the getproperty() method to get the model's Name, ID and other properties(The result is shown in Fig.1). However, I can get the cesiumjs.org's model property with the same method(The result is shown in Fig.2).
Is there any tool can convert gltf or glb to complete b3dm file, which contains Feature Table and Batch Table.

getproperty undifined
Fig.1 b3dm converted by glb2b3dm comandline from 3d tiles tools
getproperty success
Fig.2 b3dm file from sandcastle

glbToB3dm

E:\3d-tiles-tools-master\tools>node ./bin/3d-tiles-tools.js glbToB3dm ./specs/data/CesiumTexturedBox/CesiumTexturedBox.glb ./output/CesiumTexturedBox.b3dm
Buffer.alloc is not a function

How to solve this problem?

I found a wrong place.

Under the 3d-tiles-tools-master\samples-generator\lib\createTilesetJsonSingle.js path, Forty-sixth lines,
root:{content:{uri}}, It should be root:{content:{url}}

Validator - check asset.gltfUpAxis

@rms13

A tileset may declare the up-axis used by glTF models embedded in its tiles, for example:

{
    asset: {
        version: '0.0',
        gltfUpAxis: 'Z'
    }
}

If gltfUpAxis is defined its value should either be 'X', 'Y', or 'Z'. Anything else should return an error message.

The code changes will go in validateTileset.js. Also add a test to validateTilesetSpec. You can model the test after returns error message when the top-level geometricError is missing.

3D Tiles Validator Roadmap

Validator roadmap

Validates

This is a non-exhaustive list, please add all corner-cases as you come across them. Also update the spec/schema with cases that they do not cover.

Requirements

Architecture

  • Node.js library and command-line tool
  • Returns JSON object (Node.js) and readable output (command-line tool) with errors/warnings. Base off of the glTF Validator. Include JSON line numbers when possible.
  • Unit tests with outstanding code coverage
  • Reference doc (Node.js library) and usage doc (command-line tool)

tileset.json validation

  • General
    • Valid JSON #10
    • Validate the schema, e.g., required properties, min/max values, allowed datatypes/values, etc.
    • Port any bounding volume tests to Cesium
  • tile (including spatial coherence of the tree)
    • Going down the tree, a tile's geometricError must be <= to the parent tile's geometricError.
    • Likewise, root.geometricError must be <= the tileset's geometricError.
    • Going down the tree, a tile's boundingVolume must be inside/overlap its parent tile's boundingVolume (taking into account applying transforms).
      • The tile's content needs to be strictly inside the parent tile's boundingVolume. See Bounding volume spatial coherence.
        • This is a non-trivial and needs to take into account 3D Tiles transform and glTF node hierarchy (use gltf-pipeline). Get enough experience before tackling this one.
      • When a tile has no content (because it is just used for culling), its boundingVolume must be completely inside its parent tile's boundingVolume. Also update the spec with this.
  • tile.content
    • tile.content.boundingVolume, when defined, is completely inside tile.boundingVolume (use Cesium's functions)
    • tile.content.url points to a file that exists (and a tile/tileset that validates)
    • When tile.content.url is an external tileset, these rules must be followed.

Tile format validation

  • b3dm
    • Validate header #9
    • Validate Batch Table is valid JSON and follows the schema (have a generic validation function for this).
      • Validate offset/length for all properties pointing to the binary body are in range
    • Validate glTF using glTF-Validator.
    • If the tile has a Batch Table, verify that the glTF has a technique parameter semantic _BATCHID.
    • Validate that glTF batchId attributes are in range, i.e., they exist in the Batch Table.
    • Validate batch table hierarchy
  • i3dm
    • Validate header. #22
    • Validate Feature Table is valid JSON and follows the schema.
      • Validate BATCH_ID semantic, if defined, is in range (have a generic validation function for this).
      • If NORMAL_UP/NORMAL_RIGHT (or NORMAL_UP_OCT32P/NORMAL_RIGHT_OCT32P) are defined, verify that they are orthonormal.
      • Validate offset/length for all properties pointing to the binary body are in range
    • Validate Batch Table is valid JSON and follows the schema (have a generic validation function for this).
      • Validate offset/length for all properties pointing to the binary body are in range
    • Validate glTF using glTF-Validator.
  • pnts
    • Validate header. #24
    • Validate Feature Table is valid JSON and follows the schema.
      • Validate BATCH_ID semantic, if defined, is in range (have a generic validation function for this).
      • Validate RGBA/RGB/CONSTANT_RGBA are in range.
      • If NORMAL/NORMAL_OCT16P are defined, verify they are of unit length.
      • Validate offset/length for all properties pointing to the binary body are in range
    • Validate Batch Table is valid JSON and follows the schema (have a generic validation function for this).
      • Validate offset/length for all properties pointing to the binary body are in range
  • vctr
    • Validate header.
    • Validate Feature Table is valid JSON and follows the schema.
      • Validate BATCH_ID semantic, if defined, is in range (have a generic validation function for this).
      • TODO: finish this as the tile format stabilizes.
      • Validate offset/length for all properties pointing to the binary body are in range
    • Validate Batch Table is valid JSON and follows the schema (have a generic validation function for this).
      • Validate offset/length for all properties pointing to the binary body are in range
  • cmpt
    • Validate header. #23
    • Recursively validate inner tiles, including composites of composites. #23

Declarative styling validation

Do this last after the tileset.json and tile formats validation.

  • Valid JSON.
  • Validate the schema.
  • Validate each JavaScript expression (Cesium uses jsep).
    • Cesium does some runtime validation, but the validator needs to be more comprehensive. See Expression.js. The unit tests may also be useful, see ExpressionSpec.js.
    • Carefully read the styling spec and validate all rules related to type compatibility, function/constructor parameters, reg exps, etc.
  • When a tileset and style are validated at the same time, verify that the style references properties that exist in the batch table? Or they should should return undefined?

Validator - Validate tiles referenced in tileset.json

@sumitshyamsukha

When traversing the tileset.json, if the tile's content references a url, load that tile into memory, check its magic to determine its type, and then check if it is valid according to the validateB3dm, validateI3dm, validatePnts, and validateCmpt functions.

validateCmpt is not in yet but should be soon. You can model the functionality here after the code in there.

The trickiest part will be managing the promises. Let me know if you need help with that.

Invalid command crashes app

I accidentally typed unzip instead of ungzip and instead of a friendly error message and command line help, it simply crashed with an unhelpful callstack.

Validator - Check that BATCH_ID values are correct

@rms13

i3dm and pnts tiles contain an optional BATCH_ID semantic in their feature table. If this property exists, its values should be less than BATCH_LENGTH.

To help parse the contents of a feature table, you can require Cesium's Cesium3DTileFeatureTable file similar to how defined and defaultValue are often required.

Later we will also check that the batch id values for a b3dm tile are in range, but that won't be ready until we can parse embedded glb's.

Validator - check "refine" property

@Rudraksha20

Check that the root tile has a "refine" property and its value is either "ADD" or "REPLACE". The "refine" property is not required for other tiles but if exists, also check that the value is correct.

glb to b3dm ?

please anyone tell me how to create a B3DM file only for particular region ?
i have only glb file ... so what can i do to get a b3dm file ... and run it on cesium

like in the gltf we can make a objects(buildings) using sketchup tool .
like a same way how can I make this objects and create a b3dm file of the particular region .
please help.

Abort 3dtiles

How can I make a tileset by my own collada(*.dae)?

Validator - validate cmpt header

Validate composite tiles (cmpt) according to the spec. https://github.com/AnalyticalGraphicsInc/3d-tiles/tree/master/TileFormats/Composite

A composite tile contains other tiles (possibly even other composite tiles). You will need to extract each of these tiles and run them through their respective validator functions, and only return true if all of them pass. You can check out the Cesium function for ideas on how to extract the interior tiles: https://github.com/AnalyticalGraphicsInc/cesium/blob/3d-tiles/Source/Scene/Composite3DTileContent.js#L174-L235.

Validator - check for required properties in tileset.json

@rms13

validateTileset is doing a much better job now, but there are still a lot of loose ends. In the code verify that all required properties are present and are the correct type. This will be a sweeping PR to bring validateTileset to completion and will require looking the spec and tileset.json schema closely.

Validator - validate glb

@Rudraksha20

After the small tileset.json fixes are squared away we will work on validating the glTF models that are embedded within b3dm and i3dm tiles. This will be a multi-part issue that we'll add on to as we go.

Open a PR for each checkbox.

  • Check that the embedded glb is version 2.0. If not return an error message.
  • Check that the glb meets the glTF 2.0 schema. We'll need to use the glTF validator here, probably the dev branch. Most likely the glTF validator will need to be called via a child process.

how to decide the location of generated building samples

I am trying to understand how to locate the generated buildings in "bin/b3d-tiles-samples-generator-original.js" and get confused. In line 41 - 42, it defines:
var longitude = -1.31968;
var latitude = 0.698874;
but that point is in the sea while the generated buildings are located on the land
capture
capture2

The lon and lat values clearly impact to the location of generated buildings, but how it actually works? How can we put the buildings at the exact location? I also checked the created tileset.json, the region in boundingVolume of root looks right.

{
"asset": {
"version": "0.0"
},
"geometricError": 70,
"root": {
"refine": "ADD",
"boundingVolume": {
"region": [
-1.3197004795898053,
0.6988582109,
-1.3196595204101946,
0.6988897891,
0,
20
]
},
"geometricError": 0,
"content": {
"url": "batchedWithBatchTable.b3dm"
}
}
}

npm install error,please help me!~

gyp WARN install got an error, rolling back install
gyp ERR! configure error
gyp ERR! stack Error: read ECONNRESET
gyp ERR! stack at exports.errnoException (util.js:1018:11)
gyp ERR! stack at TLSWrap.onread (net.js:568:26)
gyp ERR! System Windows_NT 6.1.7601
gyp ERR! command "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodej
s\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" "configure" "--f
allback-to-build" "--module=C:\Users\Administrator\Desktop\3d-tiles-tools-ma
ster\tools\node_modules\sqlite3\lib\binding\node-v48-win32-x64\node_sqlit
e3.node" "--module_name=node_sqlite3" "--module_path=C:\Users\Administrator\D
esktop\3d-tiles-tools-master\tools\node_modules\sqlite3\lib\binding\node-
v48-win32-x64"
gyp ERR! cwd C:\Users\Administrator\Desktop\3d-tiles-tools-master\tools\node_mod
ules\sqlite3
gyp ERR! node -v v6.10.3
gyp ERR! node-gyp -v v3.4.0
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute 'node-gyp.cmd configure --fallb
ack-to-build --module=C:\Users\Administrator\Desktop\3d-tiles-tools-master\tools
\node_modules\sqlite3\lib\binding\node-v48-win32-x64\node_sqlite3.node --module

name=node_sqlite3 --module_path=C:\Users\Administrator\Desktop\3d-tiles-tools-ma
ster\tools\node_modules\sqlite3\lib\binding\node-v48-win32-x64' (1)
node-pre-gyp ERR! stack at ChildProcess. (C:\Users\Administrator
Desktop\3d-tiles-tools-master\tools\node_modules\sqlite3\node_modules\node-pre-g
yp\lib\util\compile.js:83:29)
node-pre-gyp ERR! stack at emitTwo (events.js:106:13)
node-pre-gyp ERR! stack at ChildProcess.emit (events.js:191:7)
node-pre-gyp ERR! stack at maybeClose (internal/child_process.js:886:16)
node-pre-gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/chi
ld_process.js:226:5)
node-pre-gyp ERR! System Windows_NT 6.1.7601
node-pre-gyp ERR! command "C:\Program Files\nodejs\node.exe" "C:\Users\Admi
nistrator\Desktop\3d-tiles-tools-master\tools\node_modules\sqlite3\node_mo
dules\node-pre-gyp\bin\node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd C:\Users\Administrator\Desktop\3d-tiles-tools-master\tools
\node_modules\sqlite3
node-pre-gyp ERR! node -v v6.10.3
node-pre-gyp ERR! node-pre-gyp -v v0.6.31
node-pre-gyp ERR! not ok
Failed to execute 'node-gyp.cmd configure --fallback-to-build --module=C:\Users
Administrator\Desktop\3d-tiles-tools-master\tools\node_modules\sqlite3\lib\bindi
ng\node-v48-win32-x64\node_sqlite3.node --module_name=node_sqlite3 --module_path
=C:\Users\Administrator\Desktop\3d-tiles-tools-master\tools\node_modules\sqlite3
\lib\binding\node-v48-win32-x64' (1)
[email protected] C:\Users\Administrator\Desktop\3d-tiles-tools-master\tools

Validator - check that normals are unit length

@rms13

From the roadmap:

i3dm
If NORMAL_UP/NORMAL_RIGHT (or NORMAL_UP_OCT32P/NORMAL_RIGHT_OCT32P) are defined, verify that they are orthonormal.

pnts
If NORMAL/NORMAL_OCT16P are defined, verify they are of unit length.

Use the same Cesium3DTileFeatureTable object to extract the values. Look at https://github.com/AnalyticalGraphicsInc/cesium/blob/master/Source/Scene/Instanced3DModel3DTileContent.js#L363 for reading these values and converting the oct-encoded versions to regular numbers. (The OCT16P version will use a range of 255 instead of 65535 for octDecodeInRange)

load the b3dm file in cesium

I have generated a b3dm file by the glbToB3dm tool.How to load the b3dm file in cesium?I have tried many way,but it didn't work.
Thanks.

Validator - validate that glTF batchId attributes are in range

@Rudraksha20

This will require parsing the gltf model. Each mesh in the gltf has a list of primitives, each of which contains vertex attributes. If the _BATCHID attribute is present, extract those values from the accessor/bufferView/buffer and then check that the values are all less than the BATCH_LENGTH property in the feature table.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.