Skip to content

Commit

Permalink
Breakdown of transform steps
Browse files Browse the repository at this point in the history
  • Loading branch information
lilleyse committed May 10, 2018
1 parent f6651a6 commit c7c8614
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
13 changes: 10 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -216,9 +216,16 @@ For consistency with the _z_-up coordinate system of 3D Tiles, glTFs must be tra
]
```

Note that glTF defines its own node hierarchy, where each node has a transform. These transforms are applied before the coordinate system transform is applied.
Note that glTF defines its own node hierarchy, where each node has a transform. These transforms are applied before the coordinate system transform is applied. More broadly the order of transformations is:

> **Implementation note:** when working with source data that is inherently _z_-up, such as data in WGS 84 coordinates or a local _z_-up coordinate system, a common workflow is:
1. glTF node hierarchy
2. glTF _y_-up to _z_-up transform (above)
3. Tile-specific transform. Some examples are:
* [Batched 3D Model](TileFormats/Batched3DModel/README.md) Feature Table may define `RTC_CENTER` which is used to translate model vertices.
* [Instanced 3D Model](TileFormats/Instanced3DModel/README.md) Feature Table defines per-instance position, normals, and scales. These are used to create per-instance 4x4 affine transform matrices that are applied to each instance.
4. [Tile transform](#tile-transform)

> **Implementation note:** when working with source data that is inherently _z_-up, such as data in WGS 84 coordinates or in a local _z_-up coordinate system, a common workflow is:
> * Mesh data, including positions and normals, are not modified - they remain _z_-up.
> * The root node matrix specifies a column-major _z_-up to _y_-up transform. This transforms the source data into a _y_-up coordinate system as required by glTF.
> * At runtime the glTF is transformed back from _y_-up to _z_-up with the matrix above. Effectively the transforms cancel out.
Expand Down Expand Up @@ -401,7 +408,7 @@ Therefore, the full computed transforms for the above example are:
* `T1`: `[T0][T1]`
* `T2`: `[T0][T2][pnts-specific transform, including RTC_CENTER (if defined)]`
* `T3`: `[T0][T1][T3][b3dm-specific transform, including RTC_CENTER (if defined), coordinate system transform, and glTF node hierarchy]`
* `T4`: `[T0][T1][T4][i3dm-specific transform, including per-instance Feature Table properties-derived transform, coordinate system transform, and glTF node hierarchy]`
* `T4`: `[T0][T1][T4][i3dm-specific transform, including per-instance transform, coordinate system transform, and glTF node hierarchy]

#### Implementation example

Expand Down
2 changes: 1 addition & 1 deletion TileFormats/Batched3DModel/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ When a Batch Table is present or the `BATCH_LENGTH` property is greater than `0`

By default embedded glTFs use a right handed coordinate system where the _y_-axis is up. For consistency with the _z_-up coordinate system of 3D Tiles, glTFs must be transformed at runtime. See [coordinate reference system](../../README.md#gltf) for more details.

Vertex positions may be defined relative-to-center for high-precision rendering, see [Precisions, Precisions](http://help.agi.com/AGIComponents/html/BlogPrecisionsPrecisions.htm). If defined, `RTC_CENTER` specifies the center position that all vertex positions are relative to after any coordinate system transformations have been applied.
Vertex positions may be defined relative-to-center for high-precision rendering, see [Precisions, Precisions](http://help.agi.com/AGIComponents/html/BlogPrecisionsPrecisions.htm). If defined, `RTC_CENTER` specifies the center position that all vertex positions are relative to after the coordinate system transform and glTF node hierarchy transforms have been applied.

## File extension and MIME type

Expand Down

0 comments on commit c7c8614

Please sign in to comment.