Skip to content

Cannot load 3dtiles dataset with root transform #234

@xiaoxin0214

Description

@xiaoxin0214

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions