-
Notifications
You must be signed in to change notification settings - Fork 472
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
Draco compression for pnts #310
Conversation
* `byteLength` specifies the length of the Draco binary data. | ||
* `semantics` is an array containing the per-point semantics contained in the Draco binary data. Allowed semantics are `"POSITION"`, `"RGBA"`, `"RGB"`, `"NORMAL"`, and `"BATCH_ID"`. | ||
|
||
Point attribute data shall be encoded and decoded using the parameters in the following table. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we specify that they must be encoded/decoded with the draco tools as well (and link to them)?
@@ -171,6 +171,32 @@ This is useful for per-object picking and storing application-specific metadata | |||
The `BATCH_ID` semantic may have a `componentType` of `UNSIGNED_BYTE`, `UNSIGNED_SHORT`, or `UNSIGNED_INT`. When `componentType` is not present, `UNSIGNED_SHORT` is used. | |||
The global semantic `BATCH_LENGTH` defines the number of unique `batchId` values, similar to the `batchLength` field in the [Batched 3D Model](../Batched3DModel/README.md) header. | |||
|
|||
### Draco | |||
|
|||
Per-point semantics such as position, color, normal, and batch id may may be compressed with [Draco](https://google.github.io/draco/). Draco binary data is stored in the Feature Table binary and a list of the compressed per-point semantics is stored in the Feature Table JSON. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
batch id
-> batchId
or batch ID
`RGB` | `uint8` | 3 | `COLOR` | ||
`BATCH_ID` | `uint8`, `uint16`, or `uint32` | 1 | `GENERIC` | ||
|
||
If a semantic type is defined in both `DRACO.semantics` and in the Feature Table JSON header, the Draco attribute data should be used for rendering. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also state that POSITION
or POSITION_QUANTIZED
is no longer required.
}; | ||
|
||
// Use Draco encoder to build dracoBuffer | ||
var featureTableBinary = dracoBuffer; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this line in the example adds much. Instead I would say that the binary much be encoded with the Draco encoder in the section above and link to the encoder tool(s).
@@ -171,6 +171,32 @@ This is useful for per-object picking and storing application-specific metadata | |||
The `BATCH_ID` semantic may have a `componentType` of `UNSIGNED_BYTE`, `UNSIGNED_SHORT`, or `UNSIGNED_INT`. When `componentType` is not present, `UNSIGNED_SHORT` is used. | |||
The global semantic `BATCH_LENGTH` defines the number of unique `batchId` values, similar to the `batchLength` field in the [Batched 3D Model](../Batched3DModel/README.md) header. | |||
|
|||
### Draco | |||
|
|||
Per-point semantics such as position, color, normal, and batch id may may be compressed with [Draco](https://google.github.io/draco/). Draco binary data is stored in the Feature Table binary and a list of the compressed per-point semantics is stored in the Feature Table JSON. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe add a quick sentence on why this would be used, eg. the glTF extension says
This allows glTF to support streaming compressed geometry data instead of the raw data
`NORMAL` | `float32` | 3 | `NORMAL` | ||
`RGBA` | `uint8` | 4 | `COLOR` | ||
`RGB` | `uint8` | 3 | `COLOR` | ||
`BATCH_ID` | `uint8`, `uint16`, or `uint32` | 1 | `GENERIC` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How do we define the component here?
Sorry for the churn, but I noticed a flaw with the current design yesterday. Since draco shuffles around the order of points we'll need to encode batch table properties in the draco buffer so that feature table properties and batch table properties are in sync. This realization led to a few changes:
The new design is modeled more after glTF and looks like: Feature Table {
POSITION: {
byteOffset: 0 // ignored if draco encoded
},
RGB: {
byteOffset: 0
},
BATCH_ID: {
byteOffset: 0,
componentType: 'UNSIGNED_BYTE'
},
extensions: {
"3DTILES_draco_point_compression": {
properties: {
POSITION: 0,
RGB: 1,
BATCH_ID: 2
},
byteOffset: 0,
byteLength: 100
}
}
} Batch Table {
Intensity: {
byteOffset: 0,
type: 'SCALAR',
componentType: 'UNSIGNED_BYTE'
},
Classification: {
byteOffset: 0,
type: 'SCALAR',
componentType: 'UNSIGNED_BYTE'
}
extensions: {
"3DTILES_draco_point_compression": {
properties: {
Intensity: 3,
Classiciation: 4
}
}
}
} If a property is encoded in Draco its |
One other thing, the draco buffer is still stored in the feature table binary but this is pretty awkward when batch table properties are stored there as well. Ideally draco would be its own buffer after the feature table and batch table sections but I wasn't sure if this was worth it since it complicates the overall tile design. |
Why does this target the 1.0 branch? Isn't that branch just for the OGC Community Standard? Even as an extension, this should target a |
I mentioned this in the PR description:
Due to all the formatting changes and moving around of files I thought it would be best to write this extension against the most recent spec. Once |
Ah, gotcha. |
48e0064
to
b7f41ea
Compare
b7f41ea
to
d8ea050
Compare
@ggetz updated. Rewritten to account for the changes in #310 (comment). I think I've addressed most of the initial feedback. This is still targeting |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @lilleyse! Just some comments to clarify, looks good otherwise.
|
||
### Batch Table | ||
|
||
Per-point metadata can also be compressed. The Batch Table may be extended to include a `3DTILES_draco_point_compression` object that defines additional compressed properties. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Per-point metadata can also be compressed.
Maybe in the "Feature Table" section, define when you would specify a property there vs in the Batch Table.
When a semantic is compressed its `byteOffset` property is ignored and may be set to zero. Its `componentType`, if present, | ||
defines the component type of the uncompressed data. | ||
|
||
Each property is associated with a unique ID. This ID is used by the Draco decoder to get the property data from the compressed data. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unique only to the list of properties, correct? They do not reference the index of a property. Maybe just clarify a little.
When a property is compressed its `byteOffset` property is ignored and may be set to zero. Its `componentType` and `type` properties | ||
define the component type and type, respectively, of the uncompressed data. | ||
|
||
Each property is associated with a unique ID. This ID is also unique among properties in the Feature Table extension. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, that answers my "what is this unique to" question. I think you may want to re-iterate this above, and maybe link here.
If some properties are compressed and others are not, the Draco encoder must apply the `POINT_CLOUD_SEQUENTIAL_ENCODING` encoding method. | ||
This ensures that Draco preserves the original ordering of point data. | ||
|
||
> **Implementation Note:** For best results when using Draco, all properties in the Feature Table and Batch Table should be Draco compressed, in which |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What are the best results? Faster performance, smaller file sizes?
} | ||
``` | ||
|
||
#### properties |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Generate Documentation with wetzel?
|
||
This extension is based on [Draco bitstream version 2.2](https://google.github.io/draco/spec/), which is normative and included in scope. | ||
|
||
## Point Cloud schema updates |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think schema
also encompass changes to the binary body? I would say Point Cloud tile format updates
, and have a section for the JSON schema updates and binary body updates for both the Feature and Batch Tables, to make it clear that both are required.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I changed the title, however I'm not sure if there are any binary body updates, besides that the extension references data in the binary body.
I left it as one section but added a Schema updates
section within the Feature Table and Batch Table sections.
"type": "number", | ||
"minimum": 0 | ||
} | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we disallow additional properties?
eb9ed95
to
73ed516
Compare
@ggetz Updated! |
73ed516
to
b061080
Compare
Looks good, thanks @lilleyse ! Did we want to merge this into 1.0 or wait until 1.0 is in master? I think it should be fine to merge into 1.0 since it's an extension. |
I would wait to merge this into |
@ggetz I retargeted this to |
What is the plan with this PR? If this goes into |
I think the plan was to merge into master still. We have a 1.0 tag that marks when the OGC community standard submission was released which can be converted to a branch if needed. |
The 1.0 tag is also what we linked to from the OGC documents. So I think this should be fine to go into |
Please make sure there is a clear link to the OGC version from the main link. Also, how will the tag work and bug fixes go into the OGC version? |
I can add a link. We can branch off the tag (now or later), and we can update the tag as needed. |
This PR adds support for Draco compression to the Point Cloud tile format.
Do not merge yet - this is targeting
1.0-formatting
just to minimize the amount of formatting differences, but will eventually target3d-tiles-next
.Cesium implementation: CesiumGS/cesium#6559
TODO: