Hello, i am trying to visualize a simple cube using 3d tiles. I have read the documentation and i have created a bgltf using the converter provided by cesium [https://cesiumjs.org/convertmodel.html], at this point i have created, by hand, the .b3dm file by writing the header and attaching the binary gltf at the end. Batch length is set to 1 and BatchTableSize is set to 0.
The cube is already georeferenced, and its inside the bounding volume specified in the tileset.json.
The problem is that i get the following error when i try to load the page: Compile log: ERROR: 0:26: 'a_batchId' : undeclared identifier
To fix this error i suppose that i need to specify this batch id. The point is that in the documentation [https://github.com/AnalyticalGraphicsInc/3d-tiles/blob/master/TileFormats/Batched3DModel/README.md] it is written that "When a Batch Table is present, the a_batchId attribute (with the parameter semantic BATCHID) is required; otherwise, it is not."
Did i misunderstand the docs? Or is this a bug?
Hi Davide,
you need to set the batch length to zero if you do not supply a
batch id array.
cheers,
Manuel
Thank you for the prompt response. By putting 0 as Batch length i no more get the error. But i can't see the cube inside the bounding volume, which is visible.
As a test, i tried to change the batch length of the file provided as example from 0x64 to 0x00, by doing this all the shapes are no more visible.
The strange thing is that batch table size is set to 0, so why is batch id still used?
ps: im not using CESIUM_RTC extension, because it is said to be optional (and the converter does not provide an option to enable it).
Hi Davide,
Thank you for the prompt response. By putting 0 as Batch length i no more get the error. But i can't see the cube inside the bounding volume, which is visible.
the cube is probably not specified in the correct coordinate system.
For 3D tiles, you need to position your models in ECEF coordinates (global cartesian coordinates), i.e. the model coordinates must be
relative to the earth center.
Manuel
Hi Davide,
For 3D tiles, you need to position your models in ECEF coordinates
(global cartesian coordinates), i.e. the model coordinates must be
relative to the earth center.
actually, its a bit more idiosyncratic than that: cesium applies
a y-up => z-up transform upon loading of the 3d tiles, so you
need to compensate for that as well... e.g., if you have your
model in ECEF coordinates, transform them by the inverse (i.e.
map z-up => y-up):
>1.0 0.0 0.0 0.0|
>0.0 0.0 1.0 0.0|
x' = |0.0 -1.0 0.0 0.0|*x
>0.0 0.0 0.0 1.0|
Manuel
I think the converter does that in automatic, since in the binary this matrix is defined:
"node_1":
{
"children":["Cube"],
"matrix":[1,0,0,0,0,0,-1,0,0,1,0,0,0,0,0,1],
"name":"Y_UP_Transform"
}
Unfortunately the model still doesnt show up. The reference system should be ok, if someone wants to give it a try, here is the obj geometry:
vn -3.141593 -3.141593 -3.141593
v 1217155.000000 1022855.000000 -6156090.000000
vn -3.141593 3.141593 -3.141593
v 1217155.000000 1022850.000000 -6156090.000000
vn 3.141593 3.141593 -3.141593
v 1217150.000000 1022850.000000 -6156090.000000
vn 3.141593 -3.141593 -3.141593
v 1217150.000000 1022855.000000 -6156090.000000
vn -3.141593 -3.141593 3.141593
v 1217155.000000 1022855.000000 -6156096.000000
vn -3.141593 3.141593 3.141593
v 1217155.000000 1022850.000000 -6156096.000000
vn 3.141593 3.141593 3.141593
v 1217150.000000 1022850.000000 -6156096.000000
vn 3.141593 -3.141593 3.141593
v 1217150.000000 1022855.000000 -6156096.000000
f 1//1 3//3 4//4
f 8//8 6//6 5//5
f 5//5 2//2 1//1
f 6//6 3//3 2//2
f 3//3 8//8 4//4
f 1//1 8//8 5//5
f 1//1 2//2 3//3
f 8//8 7//7 6//6
f 5//5 6//6 2//2
f 6//6 7//7 3//3
f 3//3 7//7 8//8
f 1//1 4//4 8//8
f 1//1 3//3 4//4
f 8//8 6//6 5//5
f 5//5 2//2 1//1
f 6//6 3//3 2//2
f 3//3 8//8 4//4
f 1//1 8//8 5//5
f 1//1 2//2 3//3
f 8//8 7//7 6//6
f 5//5 6//6 2//2
f 6//6 7//7 3//3
f 3//3 7//7 8//8
f 1//1 4//4 8//8
and here is the tileset:
{
"asset": {
"version": "0.0"
},
"geometricError": 700,
"refine": "add",
"root": {
"boundingVolume": {
"region": [
-1.3197004795898053,
0.6988582109,
-1.3196595204101946,
0.6988897891,
0,
100
]
},
"geometricError": 700,
"content": {
"url": "cubofin.b3dm"
}
}
}