vsgXchange icon indicating copy to clipboard operation
vsgXchange copied to clipboard

Cannot load 3dtiles dataset with root transform

Open xiaoxin0214 opened this issue 4 months ago • 2 comments

When attempting to load a 3D Tiles dataset using vsgviewer, the model does not appear.

vsgviewer tileset.json

After some investigation,I found that the tileset contains a root transform and uses a region-based boundingVolume.

"boundingVolume": {
  "region": [
    -1.3197004795898053,
    0.6988582109,
    -1.3196595204101946,
    0.6988897891,
    0,
    20
  ]
}

when loading this dataset, the bound of LOD and PagedLOD is caculated from the region-based boundingVolume,it's in the world coordinate.This seems to interfere with visibility culling or frustum testing, resulting in the model not being rendered.

As a temporary solution, I recomputed the bounds within the createTile function as follows:

vsg::dsphere computeSphere(vsg::ref_ptr<vsg::Node> node)
{
    vsg::ComputeBounds computeBounds;
    computeBounds.useNodeBounds = false;
    node->accept(computeBounds);
    vsg::dvec3 center = (computeBounds.bounds.min + computeBounds.bounds.max) * 0.5;
    double radius = vsg::length(computeBounds.bounds.max - computeBounds.bounds.min) * 0.5;
    return vsg::dsphere(center,radius);
}

vsg::ref_ptr<vsg::Node> Tiles3D::SceneGraphBuilder::createTile(vsg::ref_ptr<Tiles3D::Tile> tile, uint32_t level, const std::string& inherited_refine)
{
    if (tile->children.values.empty())
    {
    }
    else if (usePagedLOD)
    {
        auto plod = vsg::PagedLOD::create();
        plod->bound = computeSphere(local_subgraph);
    }
    else // use LOD
    {
        auto lod = vsg::LOD::create();
        lod->bound = computeSphere(highres_subgraph);
    }
    return {};
}

This modification allows the model to appear correctly. However, I'm unsure if this is the correct approach.

xiaoxin0214 avatar Aug 21 '25 06:08 xiaoxin0214