some questions about batchId in b3dm

According to,

Data Type
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.

So, the max number of features in the batch can be 2^32. Is this correct?


The batchId parameter is specified in a glTF mesh primitive by providing the _BATCHID attribute semantic, along with the index of the batchId accessor. For example,

"primitives": [
        "attributes": {
            "_BATCHID": 0
    "accessors": [
            "bufferView": 1,
            "byteOffset": 0,
            "componentType": 5125,
            "count": 4860,
            "max": [2],
            "min": [0],
            "type": "SCALAR"

The accessor.type must be a value of "SCALAR". All other properties must conform to the glTF schema, but have no additional requirements.

From above description, the batch_id can be an UNSIGNED_INT(5125), so each batchId can be any integer range [0, 2^32]?

But I see below definition in shader.

attribute float a_batchId;


From IEEE754, 4 byte float can only represent only 2^23 Integers.

So, any limitations or restrictions on batchId?

I think you’re right! The spec does allow batchIds to go up to 2^32. I think the problem is WebGL 1 requires attributes to be float, which is why it’s implemented that way in CesiumJS.

In practice, I think you’d run out of memory long before you hit that limit of batchIds, but theoretically yes you could hit precision errors with really big batchIds.