-
Notifications
You must be signed in to change notification settings - Fork 459
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
Definition of Feature IDs in EXT_mesh_features
#624
Comments
This has mostly been addressed in CesiumGS/glTF#51, but one open question is how runtime engines will support interaction with features defined by global feature IDs. CesiumJS has the concept of a batch texture which stored colors and show/hide for features, allocated based on the feature count, and so feature IDs are expected to be between With arbitrarily large feature IDs this technique won't work. One solution is to map global feature IDs to local feature IDs before uploading the data to the GPU. This is straightforward for feature ID attributes (though a little costly) but not so straightforward for feature ID textures since the only way to get pixel values is to write the image to a canvas, unless there's some GPGPU technique to consider here. Another idea that is probably too complex and slow:
|
The missing differentiation between "ID" and "index" will cause confusion and will require clients to create different sorts of "mappings". I'd say that that this is more anticipated among JavaScript developers than C/C++/Java developers, depending on how nonchalantly somebody is writing code like |
Some structural changes to the
EXT_mesh_features
extension have been started recently. The largest change is thatEXT_mesh_features
will now only cover the definition of Feature IDs. (The remaining parts - property tables and property textures - will be moved into a dedicated extension). This includes some changes to the definition of feature IDs:The "Implicit Feature IDs" (that had been defined via
offset
andrepeat
) are removedThe JSON structure is changed slightly:
meshPrimitive.featureIds
array. This array contained either "feature ID attributes" or "feature ID textures". They had been associated with property tables via thepropertyTables
array that contained property table indices. The Feature ID and the property table had been associated implicitly by "appearing at the same array index".The feature ID objects now contain additional properties:
nullFeatureId
is a sentinel value that indicates that a certain element is not associated with any feature IDfeatureCount
indicates how many distinct features there areThe
featureCount
is supposed to be the the number of unique non-null feature ID values:[0,1,null,null,4,5,null]
, thefeatureCount
would be 4[0,1,null,null,4,4,null]
, thefeatureCount
would be 3This property and its purpose sparked some discussion.
The property might be useful for a client, in order to create sorts of "mappings". For example, for the first example above, the client might create an array of size
4
, and fill it with the feature IDs:[0, 1, 4, 5]
. But this array itself then constitutes a mapping from indices to feature ID, although clients might actually rather need the inverse - namely, a mapping from feature IDs to indices (i.e. rows of a property table).There have been considerations to put some additional constraints on the feature IDs: Instead of allowing them to be "arbitrary, sparse IDs", they could be restricted to be consecutive integers, starting at 0 (aka indices). That could make parts of the implementation and consumption much easier: The
featureCount
would then simply the the number of indices, knowing that they are in the range [0, featureCount).Slight generalizations would be possible. For example, these indices could be restricted to a range, by defining a
minId
and amaxId
, which still would allow a direct mapping of these "IDs" to indices. If this option is explored further, there are further questions to consider. For example, the question of whether clients rather need afeatureCount
or atotalFeatureCount
. For example, there might be one property table with 10 rows, and two primitives, where the first one contains feature IDs [0,5), and the second one contains feature IDs [5, 10). For both feature ID sets, thefeatureCount
would be 5, but thetotalFeatureCount
would be 10.Constraining the IDs to be indices would no longer allow users to directly store arbitrary values as feature IDs. For example, users might want to store IDs that are used in their custom database system. like
[1234, 2345, 3456, 4567]
that are then used to look up the corresponding data. The support of this use case right now is also limited by the fact that the feature IDs have to be integers. But it could still be emulated by using Property Tables to store these custom IDs: If users wanted to identify 4 features with their custom IDs, then this could be accomplished with Feature ID values[0,1,2,3]
and a property table that contains the actual, corresponding custom IDs,[1234, 2345, 3456, 4567]
. The latter, if applied consistently, could even be a generalization of the external lookup concept, because it would allow the users to use, for example,STRING
values as their actual, custom IDs.There has also been the idea of allowing both IDs and indices, and indicate the nature of the IDs explicitly. Very roughly speaking: There could be some sort of boolean
featureIdsAreIndices
flag that indicates whether these IDs are in fact indices, or sparse, arbitrary ID values. But mixing these fundamentally different concepts - IDs vs. indices - in the same structure might cause confusion.For some cases, one could consider to directly use the indices of the glTF mesh primitive itself as "feature IDs". But whether there are reasonable use-cases for this (beyond assigning different IDs for each point of a point cloud) has to be investigated.
The text was updated successfully, but these errors were encountered: