Search code examples
three.jscesiumjsgltf

How to add '_BATCHID' into glTF File?


I wonder the meaning of '_BATCHID' in glTF, and how to add it into a glTF file. Cause I will use Cesium to render .b3dm File to achieve monomerization(singularity).

scene:

  • Cesium
  • three.js
  • b3dm

Thanks a lot!😋


Solution

  • The glTF 2.0 format allows for custom vertex attributes using a prefix in front of the attribute name (to indicate that it is not part of the core glTF standard). The 3D Tiles standard makes use of this to store batch IDs per vertex. Batch IDs are indexes into the Batch Table in 3D Tiles.

    So, a set of vertices in a glTF file could have POSITION, TEXCOORD_0, and _BATCHID as its vertex attributes. A typical glTF loader will recognize the position and texture coordinates as standard, and would safely ignore the _BATCHID ones, but a loader that is aware of 3D Tiles would use them as batch IDs.

    This is described in more detail in the 3D Tiles Specification.