Mesh disappears on camera rotate (bounding box far away from mesh)

Hi there -
When i rotate camera some of my meshes disappear. I thought it was the frustrum/bounding box problem as described here. In fact, it probably is. But digging deeper I found the root cause.

The bounding box for the mesh is quite far away from the mesh itself - which causes other problems, like the mesh can’t be picked.

Im using a bunch of stock 3d assets - so sometimes get stuff like this. What i’m wondering is: is there any programatic way to fix this? Or even a batch process i can run with Command-line quickstart | glTF Transform? (i dont see anything that seems like a fix there).

Would love any tips!

Oh - just made another discovery… Sometimes this train (node130) doesn’t show up in the inspector - and sometimes it does. And in Blender it’s named something all together different (Mesh.9581)

Here’s the same asset open in two inspectors:

game_board_wild_west_02.glb.zip (819.3 KB)

Ah, figured it out! The problem was introduced after centering and Draco compressing the asset using GLTF transform. False alarm. (or alarm for another reason).

thx

2 Likes

I learned something interesting about GLTF transform from some followup questions to the amazing Don McCurdy. In case useful to anyone in the future: Some bounding boxes don't move on: center (pivot:above) · donmccurdy/glTF-Transform · Discussion #1018 · GitHub

In sum: the “optimize” command instances repeated meshes (eg: the same train mesh is used 5 times in my sample above, and instancing it saves 500 draw calls), but then combines them into a single node, the effect of which is that babylon gives them a single bounding box, which makes them unpickable individually - and also creates the frustum culling behavior.

What would be amazing is if babylon ran a similar process at runtime, but maintained individual bounding boxes and pickability.

I haven’t seen a GLB load option like that. Apparently there is something like that in “React Three Fiber” - sounds like it would be an amazing add.

-ben