Re: 3D Tiles Building positioned above the world.HELP!

409 views
Skip to first unread message
Message has been deleted

Rachel Hwang

unread,
Jun 16, 2017, 2:37:18 PM6/16/17
to cesium-dev, 2801...@qq.com
Hi there,

Try experimenting with different height offset values. Looks like you using code similar to this thread: https://groups.google.com/forum/#!searchin/cesium-dev/height$203d$20tiles%7Csort:relevance/cesium-dev/CqYeu6L6bhU/P0WywsBhBQAJ , in which our resident 3D tiles expert Sean explains how to position tilesets.

Hope that helps,
- Rachel

On Friday, June 16, 2017 at 12:30:11 AM UTC-4, 2801...@qq.com wrote:
Using 3D tiles generated from Context Capture, the tiles are positioned above the world.

I've tried building Cesium myself by cloning Cesium,Then replace the Cesium folder in your App folder with the Build/Cesium folder that was just generated. but that doesn't have much of an effect.

How can I make sure the model is positioned on top of the terrain?

var viewer = new Cesium.Viewer('cesiumContainer', {  
        timeline:false,
        animation:false,
        vrButton:true,
        sceneModePicker:false,
        infoBox:true,
        baseLayerPicker:false,
        scene3DOnly:true,
        terrainProviderViewModels: terrainModels,
        selectedTerrainProviderViewModel: terrainModels[1], // Select STK high-res terrain

        imageryProvider : new Cesium.ArcGisMapServerImageryProvider({
        url : 'https://services.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer'
    })
 
});

viewer.scene.globe.depthTestAgainstTerrain = false;


var boundingSphere = new Cesium.BoundingSphere(Cesium.Cartesian3.fromDegrees(6.681247027, 46.55189101, 871.5000123), 493.3407689);

viewer.homeButton.viewModel.command.beforeExecute.addEventListener(function(commandInfo) {
        // Fly to custom position
        viewer.camera.flyToBoundingSphere(boundingSphere);

        // Tell the home button not to do anything
        commandInfo.cancel = true;
});


viewer.camera.flyToBoundingSphere(boundingSphere, {duration: 0});

var tileset = viewer.scene.primitives.add(new Cesium.Cesium3DTileset({
        url: '../Scene/Production_4.json',
        maximumScreenSpaceError : isMobile.any() ? 8 : 1, // Temporary workaround for low memory mobile devices - Increase maximum error to 8.
        maximumNumberOfLoadedTiles : isMobile.any() ? 10 : 1000 // Temporary workaround for low memory mobile devices - Decrease (disable) tile cache.
 
}));

var heightOffset = 0;
 
tileset.readyPromise.then(function(tileset) {
     console.log("STARTING!!");
 
 
     var boundingSphere = tileset.boundingSphere;
     viewer.camera.viewBoundingSphere(boundingSphere, new Cesium.HeadingPitchRange(0, -2.0, 0));
     viewer.camera.lookAtTransform(Cesium.Matrix4.IDENTITY);
     // Position tileset
     var cartographic = Cesium.Cartographic.fromCartesian(boundingSphere.center);
     var surface = Cesium.Cartesian3.fromRadians(cartographic.longitude, cartographic.latitude, 0.0);
     var offset = Cesium.Cartesian3.fromRadians(cartographic.longitude, cartographic.latitude, heightOffset);
     var translation = Cesium.Cartesian3.subtract(offset, surface, new Cesium.Cartesian3());
     tileset.modelMatrix = Cesium.Matrix4.fromTranslation(translation);
     console.log(tileset.modelMatrix);
 });

Message has been deleted
Message has been deleted

Sean Lilley

unread,
Jun 17, 2017, 2:17:08 PM6/17/17
to cesium-dev, elkw...@gmail.com, lill...@gmail.com, 2801...@qq.com
I gave a few tips over here but to simplify the steps a bit:

Download the 3d-tiles branch directly: https://github.com/AnalyticalGraphicsInc/cesium/archive/3d-tiles.zip

Then run the following commands from the command line:

npm install
npm run minifyRelease

Then use the generated Cesium.js file.

On Saturday, June 17, 2017 at 1:01:48 PM UTC-4, Jack Lee wrote:
Hi there
I added the code,but it doesn't work well,there is no change about the height,Sean said that we should do something  just like 'npm  run minifyRelease', I have tried this also,but there is always  something wrong,so that  I can't create a new cesium branch, It is really terrible! I have no idea now,please give me a hand.
Jack
---Original---
From: "Rachel Hwang"<elkw...@gmail.com>
Date: 2017/6/17 02:38:24
To: "cesium-dev"<cesiu...@googlegroups.com>;
Cc: "280147597"<2801...@qq.com>;
Subject: [cesium-dev] Re: 3D Tiles Building positioned above the world.HELP!
--
You received this message because you are subscribed to a topic in the Google Groups "cesium-dev" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/cesium-dev/3p5XyXAzkbs/unsubscribe.
To unsubscribe from this group and all its topics, send an email to cesium-dev+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Message has been deleted

guojins...@gmail.com

unread,
Jun 21, 2017, 10:28:53 AM6/21/17
to cesium-dev, 2801...@qq.com
Have you solved your problem? I have the same problem as you

Sean Lilley

unread,
Jun 22, 2017, 8:06:22 PM6/22/17
to cesium-dev, 2801...@qq.com, guojins...@gmail.com
If your tileset is similar, we discovered that there is a problem in the root tileset.json file where a geometricError isn't specified. Make sure to add the geometric error like below (the value you use should be equal to its parent's geometric error).

        "children": [
          {
            "boundingVolume": {
              "sphere": [
                4364741.3891374189406633,
                511291.0278625306673348,
                4608281.8367103915661573,
                493.3407689303687107
              ]
            },
            "geometricError": 493.3407689303687107,
            "content": {
              "url": "Data/Model/Model.json"
            }
          }
        ]
Reply all
Reply to author
Forward
0 new messages