Describe the bug
I used osgearth to load local 3DTiles, found the performance of load and render is very slowly. I try to use CesiumJS to load the same 3DTiles, the performance is better than osgearth. How to speed up it?
To Reproduce
My main code is below:
#include <iostream>
#include <string>
#include <osgViewer/Viewer>
#include <osgDB/ReadFile>
#include <osgDB/Options>
#include <osgEarth/MapNode>
#include <osgEarth/ShaderGenerator>
#include <osgEarth/ImageLayer>
#include <osgEarth/Viewpoint>
#include <osgEarth/GeoTransform>
#include <osgEarth/ThreeDTilesLayer>
#include <osgEarth/ModelLayer>
#include <osgEarth/Registry>
#include <osgEarth/EarthManipulator>
#include <osgEarth/TMS>
using namespace std;
void AddModel(osg::ref_ptr<osgEarth::Map> map, osg::ref_ptr<osgEarth::MapNode> mapNode)
{
// Create a new ThreeDTiles Layer object.
osg::ref_ptr<osgEarth::Contrib::ThreeDTilesLayer> modelLayer = new osgEarth::Contrib::ThreeDTilesLayer();
// Set the URL of the 3D Tiles file.
modelLayer->setURL("/home/chenx/data/3dtiles/lod_3dtiles/tileset.json");
modelLayer->setName("3DTiles");
map->addLayer(modelLayer);
}
int main()
{
osgEarth::initialize();
osgViewer::Viewer viewer;
viewer.setUpViewInWindow(0, 100, 800, 600);
viewer.getCamera()->setClearColor(osg::Vec4(0, 0, 0, 0));
osg::ref_ptr< osgEarth::EarthManipulator> mainManipulator = new osgEarth::EarthManipulator;
viewer.setCameraManipulator(mainManipulator);
//create map
osg::ref_ptr<osgEarth::Map> map = new osgEarth::Map;
osg::ref_ptr<osgEarth::MapNode> mapNode = new osgEarth::MapNode(map);
AddModel(map, mapNode);
viewer.setSceneData(mapNode);
osgEarth::Viewpoint vp;
osgEarth::GeoPoint newPoint(map->getSRS(), 121.56241165900519, 25.034966733139754, 500);
vp.focalPoint() = newPoint;
vp.heading()->set(0, osgEarth::Units::DEGREES);
vp.pitch()->set(-90, osgEarth::Units::DEGREES);
vp.range()->set(1000, osgEarth::Units::METERS);
mainManipulator->setViewpoint(vp, 5);
viewer.setThreadingModel(osgViewer::Viewer::CullThreadPerCameraDrawThreadPerContext);
return viewer.run();
}
Load the 3DTiles with CesiumJS through steps as follows:
2. Access the http://localhost:8080, you will get the following screen
![image](https://github.com/gwaldron/osgearth/assets/12945934/4c0324fe-2768-472c-b57a-4f92aa2608cb)
3. Click the link: Sandcastle
4. paste the following code into JavaScript code tab
// San Miguel model created by Guillermo M. Leal Llaguno. Cleaned up and hosted by Morgan McGuire: http://graphics.cs.williams.edu/data/meshes.xml
Cesium.Ion.defaultAccessToken ="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiJkZDUwMzZmYi1jYWRiLTQ2YjEtYjZmMy1jZmRjOTliMjc0NjEiLCJpZCI6OTYwNzAsImlhdCI6MTY4ODYwNzg1MH0.B2oA7SWN2V95xzb1qYTV354j0MoUWeXsXSmsJ4I4vMM"; //this is my token
const viewer = new Cesium.Viewer("cesiumContainer", {
shadows: true,
});
![image](https://github.com/gwaldron/osgearth/assets/12945934/ed975ad4-b129-4846-a095-455a4b62fdbd)
Click the Run button to load 3DTiles file!!
5. Compare the speed of render, find the osgearth is slower than CesiumJS
**Expected behavior**
How to optimize the my code to speed up the render?
**Desktop (please complete the following information):**
- OS: [e.g. iOS] Ubuntu22.04
- Browser [e.g. chrome, safari] chrome
- Version [e.g. 22] osgearth version: 3.5.0 build 149 , osgversion: 3.7.0
The new osgEarthCesium library should have performance that is much closer to CesiumJS than our original 3DTiles implementation, so I'd suggest using that.
Describe the bug I used osgearth to load local 3DTiles, found the performance of load and render is very slowly. I try to use CesiumJS to load the same 3DTiles, the performance is better than osgearth. How to speed up it?
To Reproduce My main code is below:
Load the 3DTiles with CesiumJS through steps as follows:
Cesium development server running locally. Connect to http://localhost:8080/
// San Miguel model created by Guillermo M. Leal Llaguno. Cleaned up and hosted by Morgan McGuire: http://graphics.cs.williams.edu/data/meshes.xml Cesium.Ion.defaultAccessToken ="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiJkZDUwMzZmYi1jYWRiLTQ2YjEtYjZmMy1jZmRjOTliMjc0NjEiLCJpZCI6OTYwNzAsImlhdCI6MTY4ODYwNzg1MH0.B2oA7SWN2V95xzb1qYTV354j0MoUWeXsXSmsJ4I4vMM"; //this is my token const viewer = new Cesium.Viewer("cesiumContainer", { shadows: true, });