Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

First Round of 3D Tiles 1.0 updates #301

Merged
merged 45 commits into from
May 9, 2018
Merged
Show file tree
Hide file tree
Changes from 21 commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
0e22b00
0.0 to 1.0
lilleyse Jun 20, 2017
7cc26a8
Add link to OneSky blog post
pjcozzi Apr 17, 2018
5a62d6f
Merge pull request #300 from AnalyticalGraphicsInc/pjcozzi-patch-1
pjcozzi Apr 17, 2018
59247c4
3D Tiles 1.0 updates
ggetz Apr 17, 2018
101e8a5
copyedit 1
slchow Apr 21, 2018
12d2583
copyedit 2
slchow Apr 21, 2018
7c9d494
figures
slchow Apr 21, 2018
90b53dd
copyedit
slchow Apr 21, 2018
86d05ae
RegExp
slchow Apr 23, 2018
d68fb03
Response to Gabby's comments
slchow Apr 23, 2018
77c87f8
regExp()
ggetz Apr 23, 2018
192a632
Tweaks
lilleyse Apr 23, 2018
9e7dfc7
Merge branch 'master' into copyedit
slchow Apr 24, 2018
5586e25
Sean corrections
slchow Apr 24, 2018
5117393
capitalization
slchow Apr 24, 2018
7169305
Other edits
lilleyse Apr 24, 2018
ba91831
Merge pull request #302 from slchow/copyedit
lilleyse Apr 25, 2018
899b3a3
Merge branch 'master' into tileset.json-edits
ggetz Apr 25, 2018
d3fce88
Spec clarification edits
ggetz Apr 26, 2018
026d7dd
Address CRS, padding, boundingVolumes, geometric error
ggetz May 3, 2018
0f190b1
Move Batch Table hierarchy to an extension
ggetz May 3, 2018
d5c5491
Update schemas
ggetz May 3, 2018
f0e031b
Tweak wording in local coordinate systems
lilleyse May 7, 2018
469a860
Small tweaks
lilleyse May 7, 2018
af25031
Update to 3DTILES_ prefix, updated contributors, fixed figures
ggetz May 7, 2018
4615dcb
Merge branch 'tileset.json-edits' into hierarchy-extension
ggetz May 7, 2018
83f0144
Random edits
lilleyse May 7, 2018
13d6f78
Twwak image, fix link
ggetz May 7, 2018
c3f7c96
Merge pull request #305 from AnalyticalGraphicsInc/hierarchy-extension
lilleyse May 7, 2018
1143bfa
Edits
ggetz May 7, 2018
7b9ae34
Update bounding volume images
ggetz May 7, 2018
e204c9b
Add Refinement section, url->uri, edits, cleanup
ggetz May 8, 2018
082ec85
Misc updates
lilleyse May 8, 2018
fd74204
Stray url to uri
lilleyse May 8, 2018
c02ba37
Other fixes
lilleyse May 8, 2018
ef40a6e
Tweaks to coordinate system and i3dm glb section
lilleyse May 9, 2018
4f6fc68
Fix sentence
lilleyse May 9, 2018
c954b2b
Updated figures
ggetz May 9, 2018
36dde46
Combine crs paragraphs, use some of the original wording, not complet…
lilleyse May 9, 2018
5ba688c
Formatting fix
ggetz May 9, 2018
384e749
Tweaked CRS
ggetz May 9, 2018
98854ad
Merge branch 'tileset.json-edits' into version-upgrade
ggetz May 9, 2018
f5bffdd
Merge pull request #234 from AnalyticalGraphicsInc/version-upgrade
ggetz May 9, 2018
4bc6f90
Add acknowledgements
ggetz May 9, 2018
6dce1a4
Edits
lilleyse May 9, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ As we add more tile formats, 3D Tiles needs to stay consistent.
## Terminology

* Tiles are composed of `sections` such as `header` and `body`. Sections are composed of `fields` such as `magic` and `version`.
* "Feature" - indicates one model in a batch of models (b3dm), one instance in a collection of instances (i3dm), one point in a point cloud (pnts), one polygon in a vector tile (vctr), etc.
* "Feature" - indicates one model in a batch of models (`b3dm`), one instance in a collection of instances (`i3dm`), one point in a point cloud (`pnts`), one polygon in a vector tile (`vctr`), etc.

## Fields

Expand Down
404 changes: 307 additions & 97 deletions README.md

Large diffs are not rendered by default.

141 changes: 67 additions & 74 deletions Styling/README.md

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions Styling/schema/style.condition.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"id" : "style.condition.schema.json",
"title" : "condition",
"type" : "object",
"description" : "A series of conditions evaluated in order like a series of if...else statements that result in an expression being evaluated.",
"description" : "A series of conditions evaluated in order, like a series of if...else statements that result in an expression being evaluated.",
"properties" : {
"conditions" : {
"type" : "array",
Expand All @@ -17,7 +17,7 @@
"minItems" : 2,
"maxItems" : 2
},
"description" : "A series of boolean conditions evaluated in order. For the first one that evaluates to true, its value, the 'result', (which is also an expression) is evaluated and returned. Result expressions must all be the same type. If no condition evaluates to true, the result is `undefined`. When conditions is `undefined`, `null`, or an empty object, the result is `undefined`."
"description" : "A series of boolean conditions evaluated in order. For the first one that evaluates to true, its value, the 'result' (which is also an expression), is evaluated and returned. Result expressions must all be the same type. If no condition evaluates to true, the result is `undefined`. When conditions is `undefined`, `null`, or an empty object, the result is `undefined`."
}
},
"additionalProperties" : false
Expand Down
128 changes: 59 additions & 69 deletions TileFormats/BatchTable/README.md

Large diffs are not rendered by default.

110 changes: 68 additions & 42 deletions TileFormats/Batched3DModel/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,41 @@
* Tom Fili, [@CesiumFili](https://twitter.com/CesiumFili)
* Sean Lilley, [@lilleyse](https://github.com/lilleyse)

## Contents

* [Overview](#overview)
* [Layout](#layout)
* [Padding](#padding)
* [Header](#header)
* [Feature Table](#feature-table)
* [Semantics](#semantics)
* [Feature semantics](#feature-semantics)
* [Global semantics](#global-semantics)
* [Batch Table](#batch-table)
* [Binary glTF](#binary-gltf)
* [Coordinate reference system (CRS)](#coordinate-reference-system-crs)
* [File extension and MIME type](#file-extension-and-mime-type)

## Overview

_Batched 3D Model_ allows offline batching of heterogeneous 3D models, such as different buildings in a city, for efficient streaming to a web client for rendering and interaction. Efficiency comes from transferring multiple models in a single request and rendering them in the least number of WebGL draw calls necessary. Using the core 3D Tiles spec language, each model is a _feature_.

Per-model properties, such as IDs, enable individual models to be identified and updated at runtime, e.g., show/hide, highlight color, etc. Properties may be used, for example, to query a web service to access metadata, such as passing a building's ID to get its address. Or a property might be referenced on-the-fly for changing a model's appearance, e.g., changing highlight color based on a property value.
Per-model properties, such as IDs, enable individual models to be identified and updated at runtime, e.g., show/hide, highlight color, etc. Properties may be used, for example, to query a web service to access metadata, such as passing a building's ID to get its address. Or a property might be referenced on the fly for changing a model's appearance, e.g., changing highlight color based on a property value.

Batched 3D Model, or just the _batch_, is a binary blob in little endian accessed in JavaScript as an `ArrayBuffer`.

## Layout

A tile is composed of two sections: a header immediately followed by a body.

**Figure 1**: Batched 3D Model layout (dashes indicate optional fields).
A tile is composed of two sections: a header immediately followed by a body. The following figure shows the Batched 3D Model layout (dashes indicate optional fields):

![](figures/layout.png)

### Padding

A tile's `byteLength` must be aligned to an 8-byte boundary.

The [binary glTF](#binary-gltf) (if present) must start and end on an 8-byte alignment so that glTF's byte-alignment guarantees are met. This can be done by padding the [Feature Table](../FeatureTable/README.md#padding) or [Batch Table](../BatchTable/README.md#padding) if they are present.

## Header

The 28-byte header contains the following fields:
Expand All @@ -31,16 +50,16 @@ The 28-byte header contains the following fields:
| `magic` | 4-byte ANSI string | `"b3dm"`. This can be used to identify the arraybuffer as a Batched 3D Model tile. |
| `version` | `uint32` | The version of the Batched 3D Model format. It is currently `1`. |
| `byteLength` | `uint32` | The length of the entire tile, including the header, in bytes. |
| `featureTableJSONByteLength` | `uint32` | The length of the feature table JSON section in bytes. Zero indicates there is no feature table. |
| `featureTableBinaryByteLength` | `uint32` | The length of the feature table binary section in bytes. If `featureTableJSONByteLength` is zero, this will also be zero. |
| `batchTableJSONByteLength` | `uint32` | The length of the batch table JSON section in bytes. Zero indicates there is no batch table. |
| `batchTableBinaryByteLength` | `uint32` | The length of the batch table binary section in bytes. If `batchTableJSONByteLength` is zero, this will also be zero. |
| `featureTableJSONByteLength` | `uint32` | The length of the Feature Table JSON section in bytes. Zero indicates there is no Feature Table. |
| `featureTableBinaryByteLength` | `uint32` | The length of the Feature Table binary section in bytes. If `featureTableJSONByteLength` is zero, this will also be zero. |
| `batchTableJSONByteLength` | `uint32` | The length of the Batch Table JSON section in bytes. Zero indicates there is no Batch Table. |
| `batchTableBinaryByteLength` | `uint32` | The length of the Batch Table binary section in bytes. If `batchTableJSONByteLength` is zero, this will also be zero. |

If `featureTableJSONByteLength` equals zero, the tile does not need to be rendered.

The body section immediately follows the header section, and is composed of three fields: `Feature Table`, `Batch Table` and `Binary glTF`.
The body section immediately follows the header section, and is composed of three fields: `Feature Table`, `Batch Table`, and `Binary glTF`.

Code for reading the header can be found in
> Implementation Note: Code for reading the header can be found in
[Batched3DModelTileContent](https://github.com/AnalyticalGraphicsInc/cesium/blob/master/Source/Scene/Batched3DModel3DTileContent.js)
in the Cesium implementation of 3D Tiles.

Expand All @@ -49,86 +68,93 @@ in the Cesium implementation of 3D Tiles.
Contains values for `b3dm` semantics.
More information is available in the [Feature Table specification](../FeatureTable/README.md).

The `b3dm` Feature Table JSON Schema is defined in [b3dm.featureTable.schema.json](../../schema/b3dm.featureTable.schema.json).
The `b3dm` Feature Table JSON schema is defined in [b3dm.featureTable.schema.json](../../schema/b3dm.featureTable.schema.json).

### Semantics

#### Feature Semantics
#### Feature semantics

There are currently no per-feature semantics.

#### Global Semantics
#### Global semantics

These semantics define global properties for all features.

| Semantic | Data Type | Description | Required |
| --- | --- | --- | --- |
| `BATCH_LENGTH` | `uint32` | The number of distinguishable models, also called features, in the batch. If the Binary glTF does not have a `batchId` attribute, this field _must_ be `0`. | :white_check_mark: Yes. |
| `RTC_CENTER` | `float32[3]` | A 3-component array of numbers defining the center position in _z_-up coordinates when positions are defined relative-to-center. | :red_circle: No. |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Drop in z-up coordinates and add a link to the CRS section below.


## Batch Table

The _Batch Table_ contains per-model application-specific metadata, indexable by `batchId`, that can be used for declarative styling and application-specific use cases such as populating a UI or issuing a REST API request. In the Binary glTF section, each vertex has an numeric `batchId` attribute in the integer range `[0, number of models in the batch - 1]`. The `batchId` indicates the model to which the vertex belongs. This allows models to be batched together and still be identifiable.
The _Batch Table_ contains per-model application-specific metadata, indexable by `batchId`, that can be used for [declarative styling](../../Styling/README.md) and application-specific use cases such as populating a UI or issuing a REST API request. In the binary glTF section, each vertex has an numeric `batchId` attribute in the integer range `[0, number of models in the batch - 1]`. The `batchId` indicates the model to which the vertex belongs. This allows models to be batched together and still be identifiable.

See the [Batch Table](../BatchTable/README.md) reference for more information.

## Binary glTF

[glTF](https://www.khronos.org/gltf) is the runtime asset format for WebGL. [Binary glTF](https://github.com/KhronosGroup/glTF/tree/master/extensions/Khronos/KHR_binary_glTF) is an extension defining a binary container for glTF. Batched 3D Model uses glTF 1.0 with the [KHR_binary_glTF](https://github.com/KhronosGroup/glTF/tree/master/extensions/Khronos/KHR_binary_glTF) extension.

The binary glTF immediately follows the feature table and batch table. It may embed all of its geometry, texture, and animations, or it may refer to external sources for some or all of these data.
Batched 3D Model uses [glTF 2.0](https://github.com/KhronosGroup/glTF/tree/master/specification/2.0) to embed model data.

The glTF asset must be 8-byte aligned so that glTF's byte-alignment guarantees are met. This can be done by padding the Feature Table or Batch Table if they are present.
The [binary glTF](https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#binary-gltf-layout) immediately follows the Feature Table and Batch Table. It may embed all of its geometry, texture, and animations, or it may refer to external sources for some or all of these data.

As described above, each vertex has a `batchId` attribute indicating the model to which it belongs. For example, vertices for a batch with three models may look like this:
```
batchId: [0, 0, 0, ..., 1, 1, 1, ..., 2, 2, 2, ...]
position: [xyz, xyz, xyz, ..., xyz, xyz, xyz, ..., xyz, xyz, xyz, ...]
normal: [xyz, xyz, xyz, ..., xyz, xyz, xyz, ..., xyz, xyz, xyz, ...]
```
Vertices do not need to be ordered by `batchId` so the following is also OK:
Vertices do not need to be ordered by `batchId`, so the following is also OK:
```
batchId: [0, 1, 2, ..., 2, 1, 0, ..., 1, 2, 0, ...]
position: [xyz, xyz, xyz, ..., xyz, xyz, xyz, ..., xyz, xyz, xyz, ...]
normal: [xyz, xyz, xyz, ..., xyz, xyz, xyz, ..., xyz, xyz, xyz, ...]
```
Note that a vertex can't belong to more than one model; in that case, the vertex needs to be duplicated so the `batchId`s can be assigned.

The `batchId` is identified by the glTF technique parameter semantic `_BATCHID`. For example:
The `batchId` parameter is specified in a glTF mesh [primitive](https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#reference-primitive) by providing the `_BATCHID` attribute semantic, along with the index of the `batchId` [accessor](https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#accessors). For example,

```JSON
"technique": {
"attributes": {
"a_batchId": "batchId"
},
"parameters": {
"batchId": {
"semantic": "_BATCHID",
"type": 5126
"primitives": [
{
"attributes": {
"_BATCHID": 0
}
}
}
]
```

For this example the attribute is named `a_batchId`, and is declared in the vertex shader as:

```glsl
attribute float a_batchId;
```JSON
{
"accessors": [
{
"bufferView": 1,
"byteOffset": 0,
"componentType": 5125,
"count": 4860,
"max": [2],
"min": [0],
"type": "SCALAR"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Below this example mention that accessor.type must be "SCALAR", but there are no restrictions on the other properties (as long as they are in accordance with glTF).

}
]
}
```

The vertex shader can be modified at runtime to use `a_batchId` to access individual models in the batch, e.g., to change their color.
When a Batch Table is present or the `BATCH_LENGTH` property is greater than `0`, the `_BATCHID` attribute is required; otherwise, it is not.

### Coordinate reference system (CRS)

When a Batch Table is present or the `BATCH_LENGTH` property is greater than `0`, the `batchId` attribute (with the parameter semantic `_BATCHID`) is required; otherwise, it is not.
3D Tiles local coordinate systems use a right-handed 3-axis (x, y, z) Cartesian coordinate system; that is, the cross product of _x_ and _y_ yields _z_. 3D Tiles defines the _z_ axis as up for local Cartesian coordinate systems.

Although not strictly required, clients may find the glTF [CESIUM_RTC](https://github.com/KhronosGroup/glTF/tree/master/extensions/1.0/Vendor/CESIUM_RTC) extension useful for high-precision rendering.
By default, vertex positions of the embedded glTF are defined according to a right-handed coordinate system where the _y_-axis is up, but vertex positions may be defined in a coordinate system where the _z_axis is up by specifying the [`CESIUM_z_up` glTF extension](TODO) in the embedded glTF (see [local coordinate systems](../../README.md#local-coordinate-systems)).

## File Extension
Vertex positions may be defined relative-to-center for high-precision rendering [1]. If defined, `RTC_CENTER` specifies the center position and all vertex positions are treated as relative to this value. The center position provided for `RTC_CENTER` is defined according to a coordinate system where the _z_-axis is up.

`.b3dm`
## File extension and MIME type

The file extension is optional. Valid implementations ignore it and identify a content's format by the `magic` field in its header.
Batched 3D Model tiles use the `.b3dm` extension and `application/octet-stream` MIME type.

## MIME Type
An explicit file extension is optional. Valid implementations may ignore it and identify a content's format by the `magic` field in its header.

_TODO, [#60](https://github.com/AnalyticalGraphicsInc/3d-tiles/issues/60)_
## Resources

`application/octet-stream`
1. [Precisions, Precisions](http://blogs.agi.com/insight3d/index.php/2008/09/03/precisions-precisions/)
35 changes: 22 additions & 13 deletions TileFormats/Composite/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,17 @@
* Sean Lilley, [@lilleyse](https://github.com/lilleyse)
* Patrick Cozzi, [@pjcozzi](https://twitter.com/pjcozzi)

## Contents

* [Overview](#overview)
* [Layout](#layout)
* [Padding](#padding)
* [Header](#header)
* [Inner tiles](#inner-tiles)
* [File extension and MIME type](#file-extension-and-mime-type)
* [Acknowledgments](#acknowledgments)
* [Resources](#resources)

## Overview

The _Composite_ tile format enables concatenating tiles of different formats into one tile.
Expand All @@ -17,10 +28,14 @@ A Composite is a binary blob in little endian accessed in JavaScript as an `Arra

## Layout

**Figure 1**: Composite layout (dashes indicate optional fields).
Composite layout (dashes indicate optional fields):

![](figures/layout.png)

### Padding

A tile's `byteLength` must be aligned to an 8-byte boundary. All tiles contained in a composite tile must also be aligned to an 8-byte boundary.

## Header

The 16-byte header section contains the following fields:
Expand All @@ -34,13 +49,13 @@ The 16-byte header section contains the following fields:

_TODO: code example reading header_

## Inner Tiles
## Inner tiles

Inner tile fields are stored tightly packed immediately following the header section. No additional header is added on top of the tiles' preexisting headers (eg, b3dm or i3dm headers). However, the following information describes general characteristics of the existing contents of relevant files' headers to explain common information which a composite tile reader might exploit to find the boundaries of the inner tiles.
Inner tile fields are stored tightly packed immediately following the header section. No additional header is added on top of the tiles' preexisting headers, e.g., b3dm or i3dm headers. However, the following information describes general characteristics of the existing contents of relevant files' headers to explain common information that a Composite tile reader might exploit to find the boundaries of the inner tiles:

* Each tile starts with a 4-byte ANSI string, `magic`, that can be used to determine the tile format for further parsing. See the [main 3D Tiles spec](../../README.md) for a list of tile formats. Composite tiles can contain Composite tiles.
* Each tile's header contains a `uint32` `byteLength`, which defines the length of the inner tile, including its header, in bytes. This can be used to traverse the inner tiles.
* For any tile format's version 1, the first 12-bytes of all tiles is the following fields:
* For any tile format's version 1, the first 12 bytes of all tiles is the following fields:

|Field name|Data type|Description|
|----------|---------|-----------|
Expand All @@ -50,17 +65,11 @@ Inner tile fields are stored tightly packed immediately following the header sec

Refer to the spec for each tile format for more details.

## File Extension

`.cmpt`

The file extension is optional. Valid implementations ignore it and identify a content's format by the `magic` field in its header.

## MIME Type
## File extension and MIME type

_TODO, [#60](https://github.com/AnalyticalGraphicsInc/3d-tiles/issues/60)_
Composite tiles use the `.cmpt` extension and `application/octet-stream` MIME type.

`application/octet-stream`
An explicit file extension is optional. Valid implementations may ignore it and identify a content's format by the `magic` field in its header.

## Acknowledgments

Expand Down
Loading